* Sets up a combobox with the specified size and position. * @param state Pointer to state the combobox belongs to. * @param width Width in pixels. * @param height Height in pixels. * @param x X position in pixels. * @param y Y position in pixels. */
| 44 | * @param y Y position in pixels. |
| 45 | */ |
| 46 | ComboBox::ComboBox(State *state, int width, int height, int x, int y) : InteractiveSurface(width, height, x, y), _change(0), _sel(0), _state(state), _lang(0), _toggled(false) |
| 47 | { |
| 48 | _button = new TextButton(width, height, x, y); |
| 49 | _button->setComboBox(this); |
| 50 | |
| 51 | _arrow = new Surface(11, 8, x + width - BUTTON_WIDTH, y + 4); |
| 52 | |
| 53 | _window = new Window(state, width, MAX_ITEMS * 8 + VERTICAL_MARGIN * 2, x, y + height); |
| 54 | _window->setThinBorder(); |
| 55 | |
| 56 | _list = new TextList(width - HORIZONTAL_MARGIN * 2 - BUTTON_WIDTH + 1, |
| 57 | MAX_ITEMS * TEXT_HEIGHT - 2, |
| 58 | x + HORIZONTAL_MARGIN, |
| 59 | y + height + VERTICAL_MARGIN); |
| 60 | _list->setComboBox(this); |
| 61 | _list->setColumns(1, _list->getWidth()); |
| 62 | _list->setSelectable(true); |
| 63 | _list->setBackground(_window); |
| 64 | _list->setAlign(ALIGN_CENTER); |
| 65 | _list->setScrolling(true, 0); |
| 66 | |
| 67 | toggle(true); |
| 68 | } |
| 69 | |
| 70 | /** |
| 71 | * Deletes all the stuff contained in the list. |
nothing calls this directly
no test coverage detected