19 #ifndef OPENXCOM_COMBOBOX_H
20 #define OPENXCOM_COMBOBOX_H
22 #include "../Engine/InteractiveSurface.h"
41 static const int HORIZONTAL_MARGIN;
42 static const int VERTICAL_MARGIN;
43 static const int MAX_ITEMS;
44 static const int BUTTON_WIDTH;
45 static const int TEXT_HEIGHT;
52 ActionHandler _change;
60 void setDropdown(
int options);
63 ComboBox(
State *state,
int width,
int height,
int x = 0,
int y = 0);
71 void setPalette(SDL_Color *colors,
int firstcolor = 0,
int ncolors = 256);
89 void setOptions(
const std::vector<std::string> &options);
91 void setOptions(
const std::vector<std::wstring> &options);
99 void toggle(
bool first =
false);
101 void onChange(ActionHandler handler);
void initText(Font *big, Font *small, Language *lang)
Initializes the resources for the text list.
Definition: ComboBox.cpp:129
void setY(int y)
Sets the Y position of the surface.
Definition: ComboBox.cpp:98
Container for all the information associated with a given user action, like mouse clicks...
Definition: Action.h:34
void setOptions(const std::vector< std::string > &options)
Sets the list of options.
Definition: ComboBox.cpp:273
void setX(int x)
Sets the X position of the surface.
Definition: ComboBox.cpp:85
A game state that receives user input and reacts accordingly.
Definition: State.h:44
Box with a coloured border and custom background.
Definition: Window.h:42
void think()
Thinks arrow buttons.
Definition: ComboBox.cpp:346
Surface that the user can interact with.
Definition: InteractiveSurface.h:39
void setSelected(size_t sel)
Sets the selected option in the list.
Definition: ComboBox.cpp:242
List of Text's split into columns.
Definition: TextList.h:42
void toggle(bool first=false)
Toggles the combo box state.
Definition: ComboBox.cpp:359
void setPalette(SDL_Color *colors, int firstcolor=0, int ncolors=256)
Sets the palette of the text list.
Definition: ComboBox.cpp:114
size_t getSelected() const
Gets the selected option in the list.
Definition: ComboBox.cpp:233
void setArrowColor(Uint8 color)
Sets the arrow color of the text list.
Definition: ComboBox.cpp:224
ComboBox(State *state, int width, int height, int x=0, int y=0)
Creates a combo box with the specified size and position.
Definition: ComboBox.cpp:46
Contains strings used throughout the game for localization.
Definition: Language.h:42
Text button with a list dropdown when pressed.
Definition: ComboBox.h:38
Takes care of loading and storing each character in a sprite font.
Definition: Font.h:40
Coloured button with a text label.
Definition: TextButton.h:40
Element that is blit (rendered) onto the screen.
Definition: Surface.h:39
void onChange(ActionHandler handler)
Hooks an action handler to when the slider changes.
Definition: ComboBox.cpp:385
void setHighContrast(bool contrast)
Sets the high contrast color setting.
Definition: ComboBox.cpp:213
Uint8 getColor() const
Gets the border color.
Definition: ComboBox.cpp:162
void handle(Action *action, State *state)
Handle arrow buttons.
Definition: ComboBox.cpp:322
void setColor(Uint8 color)
Sets the border color.
Definition: ComboBox.cpp:149
void setBackground(Surface *bg)
Sets the background surface.
Definition: ComboBox.cpp:140
~ComboBox()
Cleans up the combo box.
Definition: ComboBox.cpp:73
void blit(Surface *surface)
Blits the combo box onto another surface.
Definition: ComboBox.cpp:304