MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / ComboBox

Method ComboBox

src/Interface/ComboBox.cpp:46–68  ·  view source on GitHub ↗

* 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. */

Source from the content-addressed store, hash-verified

44 * @param y Y position in pixels.
45 */
46ComboBox::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.

Callers

nothing calls this directly

Calls 8

setThinBorderMethod · 0.80
setColumnsMethod · 0.80
setScrollingMethod · 0.80
setComboBoxMethod · 0.45
getWidthMethod · 0.45
setSelectableMethod · 0.45
setBackgroundMethod · 0.45
setAlignMethod · 0.45

Tested by

no test coverage detected