22 #include "../Engine/InteractiveSurface.h" 28 enum ArrowOrientation { ARROW_VERTICAL, ARROW_HORIZONTAL };
43 std::vector< std::vector<Text*> > _texts;
44 std::vector<size_t> _columns, _rows;
45 Font *_big, *_small, *_font;
47 size_t _scroll, _visibleRows, _selRow;
48 Uint8 _color, _color2;
49 std::map<int, TextHAlign> _align;
50 bool _dot, _selectable, _condensed, _contrast, _wrap, _flooding;
56 std::vector<ArrowButton*> _arrowLeft, _arrowRight;
57 int _arrowPos, _scrollPos;
58 ArrowOrientation _arrowType;
59 ActionHandler _leftClick, _leftPress, _leftRelease, _rightClick, _rightPress, _rightRelease;
60 int _arrowsLeftEdge, _arrowsRightEdge;
69 TextList(
int width,
int height,
int x = 0,
int y = 0);
83 void setCellColor(
size_t row,
size_t column, Uint8 color);
87 std::string
getCellText(
size_t row,
size_t column)
const;
89 void setCellText(
size_t row,
size_t column,
const std::string &text);
105 void addRow(
int cols, ...);
109 void setPalette(SDL_Color *colors,
int firstcolor = 0,
int ncolors = 256);
127 void setAlign(TextHAlign align,
int col = -1);
165 void scrollUp(
bool toMax,
bool scrollByWheel =
false);
167 void scrollDown(
bool toMax,
bool scrollByWheel =
false);
197 int getScrollbarColor();
void setCondensed(bool condensed)
Sets whether to condense columns instead of a table like layout.
Definition: TextList.cpp:658
Container for all the information associated with a given user action, like mouse clicks...
Definition: Action.h:32
void setMargin(int margin)
Sets the margin of the text list.
Definition: TextList.cpp:694
int getNumTextLines(size_t row) const
Gets the number of lines in the wrapped text for the specified row.
Definition: TextList.cpp:231
void setBorderColor(Uint8 color)
Sets the border colour of the surface.
Definition: TextList.cpp:1257
A game state that receives user input and reacts accordingly.
Definition: State.h:44
void setHeight(int height)
Sets the height of the surface.
Definition: TextList.cpp:497
std::string getCellText(size_t row, size_t column) const
Gets the text of a certain cell.
Definition: TextList.cpp:179
Surface that the user can interact with.
Definition: InteractiveSurface.h:37
List of Text's split into columns.
Definition: TextList.h:40
ComboBox * getComboBox() const
Check for a combobox.
Definition: TextList.cpp:1252
void setColor(Uint8 color)
Sets the text color of the text list.
Definition: TextList.cpp:511
void think()
Thinks arrow buttons.
Definition: TextList.cpp:1054
size_t getVisibleRows() const
Gets the amount of visible rows in the list.
Definition: TextList.cpp:258
void setColumns(int cols,...)
Sets the columns in the text list.
Definition: TextList.cpp:423
int getColumnX(size_t column) const
Gets the X position of a certain column.
Definition: TextList.cpp:201
void setBackground(Surface *bg)
Sets the background for the selector.
Definition: TextList.cpp:684
void setCellText(size_t row, size_t column, const std::string &text)
Sets the text of a certain cell.
Definition: TextList.cpp:190
void draw()
Draws the text onto the text list.
Definition: TextList.cpp:935
void onRightArrowPress(ActionHandler handler)
Hooks an action handler to a mouse press over the right arrows.
Definition: TextList.cpp:789
void setDot(bool dot)
Sets whether to separate columns with dots.
Definition: TextList.cpp:608
void blit(Surface *surface)
Blits the text list onto another surface.
Definition: TextList.cpp:970
Uint8 getSecondaryColor() const
Gets the secondary color of the text list.
Definition: TextList.cpp:548
int getArrowsRightEdge()
Gets the arrowsRightEdge.
Definition: TextList.cpp:125
void setArrowColumn(int pos, ArrowOrientation type)
Sets the arrow column of the text list.
Definition: TextList.cpp:725
void setWordWrap(bool wrap)
Sets the text list's wordwrap setting.
Definition: TextList.cpp:559
void setRowColor(size_t row, Uint8 color)
Sets the text color of a certain row.
Definition: TextList.cpp:164
void scrollDown(bool toMax, bool scrollByWheel=false)
Scrolls the list down.
Definition: TextList.cpp:864
Contains strings used throughout the game for localization.
Definition: Language.h:39
int getArrowsLeftEdge()
Gets the arrowsLeftEdge.
Definition: TextList.cpp:116
void mouseOver(Action *action, State *state)
Special handling for mouse hovering.
Definition: TextList.cpp:1150
void setBig()
Sets the text size to big.
Definition: TextList.cpp:626
Text button with a list dropdown when pressed.
Definition: ComboBox.h:36
void setX(int x)
Sets the X position of the surface.
Definition: TextList.cpp:88
int getRowY(size_t row) const
Gets the Y position of a certain row.
Definition: TextList.cpp:211
Takes care of loading and storing each character in a sprite font.
Definition: Font.h:46
size_t getRows() const
Gets the amount of rows in the list.
Definition: TextList.cpp:249
void handle(Action *action, State *state)
Handles arrow buttons.
Definition: TextList.cpp:1020
void setSmall()
Sets the text size to small.
Definition: TextList.cpp:641
~TextList()
Cleans up the text list.
Definition: TextList.cpp:61
void mouseOut(Action *action, State *state)
Special handling for mouse hovering out.
Definition: TextList.cpp:1206
void onRightArrowClick(ActionHandler handler)
Hooks an action handler to a mouse click on the right arrows.
Definition: TextList.cpp:776
void onLeftArrowClick(ActionHandler handler)
Hooks an action handler to a mouse click on the left arrows.
Definition: TextList.cpp:737
void setCellColor(size_t row, size_t column, Uint8 color)
Sets the text color of a certain cell.
Definition: TextList.cpp:153
void setSecondaryColor(Uint8 color)
Sets the secondary color of the text list.
Definition: TextList.cpp:539
void mouseClick(Action *action, State *state)
Special handling for mouse clicks.
Definition: TextList.cpp:1125
void onLeftArrowRelease(ActionHandler handler)
Hooks an action handler to a mouse release over the left arrows.
Definition: TextList.cpp:763
size_t getScroll()
get the scroll depth
Definition: TextList.cpp:1220
Element that is blit (rendered) onto the screen.
Definition: Surface.h:38
unsigned int getSelectedRow() const
Gets the selected row in the list.
Definition: TextList.cpp:668
TextList(int width, int height, int x=0, int y=0)
Creates a text list with the specified size and position.
Definition: TextList.cpp:42
void unpress(State *state)
Unpresses the surface.
Definition: TextList.cpp:134
void clearList()
Clears the list.
Definition: TextList.cpp:814
void initText(Font *big, Font *small, Language *lang)
Initializes the resources for the text list.
Definition: TextList.cpp:477
void scrollTo(size_t scroll)
set the scroll depth
Definition: TextList.cpp:1229
void setScrolling(bool scrolling, int scrollPos=4)
Sets the list scrolling.
Definition: TextList.cpp:920
void setComboBox(ComboBox *comboBox)
Attaches this button to a combobox.
Definition: TextList.cpp:1243
void onRightArrowRelease(ActionHandler handler)
Hooks an action handler to a mouse release over the right arrows.
Definition: TextList.cpp:802
void scrollUp(bool toMax, bool scrollByWheel=false)
Scrolls the list up.
Definition: TextList.cpp:835
size_t getTexts() const
Gets the amount of text in the list.
Definition: TextList.cpp:240
void onLeftArrowPress(ActionHandler handler)
Hooks an action handler to a mouse press over the left arrows.
Definition: TextList.cpp:750
int getTextHeight(size_t row) const
Gets the height of the row text in pixels.
Definition: TextList.cpp:221
Uint8 getColor() const
Gets the text color of the text list.
Definition: TextList.cpp:530
void setPalette(SDL_Color *colors, int firstcolor=0, int ncolors=256)
Sets the palette of the text list.
Definition: TextList.cpp:443
void mouseRelease(Action *action, State *state)
Special handling for mouse releases.
Definition: TextList.cpp:1105
void setY(int y)
Sets the Y position of the surface.
Definition: TextList.cpp:102
void mousePress(Action *action, State *state)
Special handling for mouse presses.
Definition: TextList.cpp:1075
void setFlooding(bool flooding)
Allows the cell to flood into other columns.
Definition: TextList.cpp:1269
void addRow(int cols,...)
Adds a new row to the text list.
Definition: TextList.cpp:269
void setAlign(TextHAlign align, int col=-1)
Sets the text horizontal alignment of the text list.
Definition: TextList.cpp:588
void setArrowColor(Uint8 color)
Sets the arrow color of the text list.
Definition: TextList.cpp:712
void setHighContrast(bool contrast)
Sets the text list's high contrast color setting.
Definition: TextList.cpp:569
int getMargin() const
Gets the margin of the text list.
Definition: TextList.cpp:703
void setSelectable(bool selectable)
Sets whether the list is selectable.
Definition: TextList.cpp:618
Definition: BaseInfoState.cpp:40