xoreos  0.0.5
listbox.h
Go to the documentation of this file.
1 /* xoreos - A reimplementation of BioWare's Aurora engine
2  *
3  * xoreos is the legal property of its developers, whose names
4  * can be found in the AUTHORS file distributed with this source
5  * distribution.
6  *
7  * xoreos is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 3
10  * of the License, or (at your option) any later version.
11  *
12  * xoreos is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with xoreos. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
25 #ifndef ENGINES_AURORA_KOTORJADEGUI_LISTBOX_H
26 #define ENGINES_AURORA_KOTORJADEGUI_LISTBOX_H
27 
29 
30 namespace Engines {
31 
32 class WidgetScrollbar;
33 class WidgetProtoItem;
34 
38 };
39 
41 public:
42  WidgetListBox(GUI &gui, const Common::UString &tag);
44 
45  void load(const Aurora::GFF3Struct &gff);
46 
47  void setItemType(ListBoxItemType itemType);
48 
52  void setItemSelectionEnabled(bool itemSelectionEnabled);
53 
58  void setAdjustHeight(bool adjustHeight);
59 
64  void setHideScrollbar(bool hideScrollbar);
65 
66  void setPadding(uint32 padding);
67  void setItemTextColor(float r, float g, float b, float a);
68  void setItemBorderColor(float r, float g, float b, float a);
69 
70  // .--- Item widgets
71 
72  void createItemWidgets(uint32 count);
73  void refreshItemWidgets();
74 
75  // '---
76 
77  // .--- Underlying items
78 
79  void addItem(const Common::UString &contents);
80  void removeAllItems();
81 
82  // '---
83 
84  // .--- Item selection
85 
86  void selectItemByWidgetTag(const Common::UString &tag);
87  void selectItemByIndex(int index);
88  void selectNextItem();
89  void selectPreviousItem();
90 
91  int getSelectedIndex() const;
92 
93  // '---
94 
95  void setHeight(float height);
96 
97  void subActive(Widget &widget);
98 
99  void mouseWheel(uint8 state, int x, int y);
100 
101  void setSoundSelectItem(const Common::UString &resRef);
102  void setSoundHoverItem(const Common::UString &resRef);
103  void setSoundClickItem(const Common::UString &resRef);
104 
105 private:
108  std::vector<WidgetProtoItem *> _itemWidgets;
109  std::vector<Common::UString> _items;
110 
120 
123 
126 
130 
131  void createScrollbar(const Aurora::GFF3Struct &gff);
132  void positionItemWidgets();
134 };
135 
136 } // End of namespace Engines
137 
138 #endif // ENGINES_AURORA_KOTORJADEGUI_LISTBOX_H
WidgetListBox(GUI &gui, const Common::UString &tag)
Definition: listbox.cpp:43
void mouseWheel(uint8 state, int x, int y)
A mouse wheel was used on the widget.
Definition: listbox.cpp:392
A class holding an UTF-8 string.
Definition: ustring.h:48
void createItemWidgets(uint32 count)
Definition: listbox.cpp:131
WidgetScrollbar * _scrollbar
Definition: listbox.h:107
uint8_t uint8
Definition: types.h:200
void setSoundClickItem(const Common::UString &resRef)
Definition: listbox.cpp:338
Common::UString _soundClickItem
Definition: listbox.h:129
void setPadding(uint32 padding)
Definition: listbox.cpp:98
const Aurora::GFF3Struct * _protoItem
Definition: listbox.h:106
Common::UString _soundHoverItem
Definition: listbox.h:128
A GUI.
Definition: gui.h:43
void setItemTextColor(float r, float g, float b, float a)
Definition: listbox.cpp:102
void setItemSelectionEnabled(bool itemSelectionEnabled)
Toggle item selection mode.
Definition: listbox.cpp:82
void addItem(const Common::UString &contents)
Definition: listbox.cpp:122
void selectItemByWidgetTag(const Common::UString &tag)
Definition: listbox.cpp:234
void subActive(Widget &widget)
A sub-widget was activated.
Definition: listbox.cpp:321
Common base for Star Wars: Knights of the Old Republic and Jade Empire widgets.
Common::UString _soundSelectItem
Definition: listbox.h:127
void setHideScrollbar(bool hideScrollbar)
Toggle scroll bar visibility mode.
Definition: listbox.cpp:94
void selectItemByIndex(int index)
Definition: listbox.cpp:251
void setAdjustHeight(bool adjustHeight)
Toggle height adjustment mode.
Definition: listbox.cpp:90
void setItemBorderColor(float r, float g, float b, float a)
Definition: listbox.cpp:112
A widget in a GUI.
Definition: widget.h:40
ListBoxItemType _itemType
Definition: listbox.h:111
A struct within a GFF3.
Definition: gff3file.h:164
uint32_t uint32
Definition: types.h:204
void load(const Aurora::GFF3Struct &gff)
Definition: listbox.cpp:65
void createScrollbar(const Aurora::GFF3Struct &gff)
Definition: listbox.cpp:343
std::vector< WidgetProtoItem * > _itemWidgets
Definition: listbox.h:108
void setHeight(float height)
Set the height of the widget.
Definition: listbox.cpp:310
void setItemType(ListBoxItemType itemType)
Definition: listbox.cpp:78
void applyChangesToItemWidgets()
Definition: listbox.cpp:377
std::vector< Common::UString > _items
Definition: listbox.h:109
void setSoundHoverItem(const Common::UString &resRef)
Definition: listbox.cpp:333
int getSelectedIndex() const
Definition: listbox.cpp:306
void setSoundSelectItem(const Common::UString &resRef)
Definition: listbox.cpp:328
ListBoxItemType
Definition: listbox.h:35