xoreos
0.0.5
|
#include <listbox.h>
Public Member Functions | |
WidgetListBox (GUI &gui, const Common::UString &tag) | |
~WidgetListBox () | |
void | load (const Aurora::GFF3Struct &gff) |
void | setItemType (ListBoxItemType itemType) |
void | setItemSelectionEnabled (bool itemSelectionEnabled) |
Toggle item selection mode. More... | |
void | setAdjustHeight (bool adjustHeight) |
Toggle height adjustment mode. More... | |
void | setHideScrollbar (bool hideScrollbar) |
Toggle scroll bar visibility mode. More... | |
void | setPadding (uint32 padding) |
void | setItemTextColor (float r, float g, float b, float a) |
void | setItemBorderColor (float r, float g, float b, float a) |
void | createItemWidgets (uint32 count) |
void | refreshItemWidgets () |
void | addItem (const Common::UString &contents) |
void | removeAllItems () |
void | selectItemByWidgetTag (const Common::UString &tag) |
void | selectItemByIndex (int index) |
void | selectNextItem () |
void | selectPreviousItem () |
int | getSelectedIndex () const |
void | setHeight (float height) |
Set the height of the widget. More... | |
void | subActive (Widget &widget) |
A sub-widget was activated. More... | |
void | mouseWheel (uint8 state, int x, int y) |
A mouse wheel was used on the widget. More... | |
void | setSoundSelectItem (const Common::UString &resRef) |
void | setSoundHoverItem (const Common::UString &resRef) |
void | setSoundClickItem (const Common::UString &resRef) |
Public Member Functions inherited from Engines::KotORJadeWidget | |
KotORJadeWidget (GUI &gui, const Common::UString &tag) | |
~KotORJadeWidget () | |
void | setClickable (bool clickable) |
Set the widget clickable, or not clickable. More... | |
void | setScissor (int x, int y, int width, int height) |
Create a scissor test over this widget. More... | |
void | setFill (const Common::UString &fill) |
void | setColor (float r, float g, float b, float a) |
void | setBorderColor (float r, float g, float b, float a) |
void | setWrapped (bool wrapped) |
void | setSubScene (Graphics::Aurora::SubSceneQuad *subscene) |
float | getBorderDimension () const |
void | setHighlight (const Common::UString &hilight) |
void | setHighlight (bool highlight) |
Set if the widget should be highlighted. More... | |
bool | isHighlight () |
If the widget is highlighted. More... | |
void | createText (const Common::UString &font, const Common::UString &str) |
Initialize the text within this widget. More... | |
void | setFont (const Common::UString &fnt) |
Change the font for this widget. More... | |
void | setText (const Common::UString &text) |
void | setTextColor (float r, float g, float b, float a) |
void | setHorizontalTextAlign (float halign) |
void | setVerticalTextAlign (float valign) |
float | getTextHeight (const Common::UString &text) const |
void | setTag (const Common::UString &tag) |
Set the widget's tag. More... | |
virtual void | show () |
Show the widget. More... | |
virtual void | hide () |
Hide the widget. More... | |
virtual void | setPosition (float x, float y, float z) |
Set the widget's position. More... | |
virtual void | setRotation (float angle) |
Set the rotation of the widget in degrees. More... | |
virtual void | setWidth (float width) |
Set the width of the widget. More... | |
float | getWidth () const |
Get the widget's width. More... | |
float | getHeight () const |
Get the widget's height. More... | |
virtual void | setInvisible (bool invisible) |
Make the widget invisible. More... | |
Public Member Functions inherited from Engines::Widget | |
Widget (GUI &gui, const Common::UString &tag) | |
virtual | ~Widget () |
const Common::UString & | getTag () const |
Get the widget's tag. More... | |
bool | isActive () const |
Was the widget activated? More... | |
bool | isVisible () const |
Is the widget visible? More... | |
bool | isDisabled () const |
Is the widget disabled? More... | |
bool | isInvisible () const |
Is the widget invisible (never visible)? More... | |
Widget * | getParent () |
const Widget * | getParent () const |
Widget * | getChild (const Common::UString &childTag) |
Get the widget's child by tag. More... | |
virtual void | movePosition (float x, float y, float z) |
Move the widget, relative to its current position. More... | |
virtual void | getPosition (float &x, float &y, float &z) const |
Get the widget's position. More... | |
virtual void | setDisabled (bool disabled) |
Disable/Enable the widget. More... | |
virtual void | enter () |
The mouse entered the widget. More... | |
virtual void | leave () |
The mouse left the widget. More... | |
virtual void | mouseMove (uint8 state, float x, float y) |
The mouse was moved over the widget. More... | |
virtual void | mouseDown (uint8 state, float x, float y) |
A mouse button was pressed on the widget. More... | |
virtual void | mouseUp (uint8 state, float x, float y) |
A mouse button was released on the widget. More... | |
virtual void | mouseDblClick (uint8 state, float x, float y) |
A mouse button was double-clicked on the widget. More... | |
void | remove () |
Remove the widget from the GUI. More... | |
virtual void | addSub (Widget &widget) |
Add a sub-widget to the widget. More... | |
virtual void | addChild (Widget &widget) |
Add a child to the widget. More... | |
virtual void | addGroupMember (Widget &widget) |
Add a fellow group member to the widget. More... | |
virtual void | removeSub (Widget &widget) |
Remove a sub-widget from the widget. More... | |
virtual void | removeChild (Widget &widget) |
Remove a child from the widget. More... | |
virtual void | removeGroupMember (Widget &widget) |
Remove fellow group member from the widget. More... | |
Private Member Functions | |
void | createScrollbar (const Aurora::GFF3Struct &gff) |
void | positionItemWidgets () |
void | applyChangesToItemWidgets () |
Private Attributes | |
const Aurora::GFF3Struct * | _protoItem |
WidgetScrollbar * | _scrollbar |
std::vector< WidgetProtoItem * > | _itemWidgets |
std::vector< Common::UString > | _items |
ListBoxItemType | _itemType |
uint32 | _padding |
bool | _leftScrollbar |
bool | _itemSelectionEnabled |
bool | _adjustHeight |
bool | _hideScrollbar |
int | _selectedIndex |
int | _startIndex |
int | _numVisibleItems |
bool | _textColorChanged |
float | _textR |
float | _textG |
float | _textB |
float | _textA |
bool | _borderColorChanged |
float | _borderR |
float | _borderG |
float | _borderB |
float | _borderA |
Common::UString | _soundSelectItem |
Common::UString | _soundHoverItem |
Common::UString | _soundClickItem |
Engines::WidgetListBox::WidgetListBox | ( | GUI & | gui, |
const Common::UString & | tag | ||
) |
Definition at line 43 of file listbox.cpp.
Engines::WidgetListBox::~WidgetListBox | ( | ) |
Definition at line 62 of file listbox.cpp.
void Engines::WidgetListBox::addItem | ( | const Common::UString & | contents | ) |
Definition at line 122 of file listbox.cpp.
References _items.
Referenced by Engines::KotOR::SaveLoadMenu::addSavedGameItems(), Engines::KotOR::MenuEquipment::fillEquipableItemsList(), Engines::KotOR::ContainerMenu::fillFromInventory(), Engines::Jade::MainMenu::MainMenu(), Engines::KotOR::DialogGUIBase::refresh(), Engines::KotOR::SaveLoadMenu::SaveLoadMenu(), and Engines::KotOR::ConfirmDialog::setText().
|
private |
Definition at line 377 of file listbox.cpp.
References _borderA, _borderB, _borderColorChanged, _borderG, _borderR, _itemSelectionEnabled, _itemWidgets, _soundClickItem, _soundHoverItem, _textA, _textB, _textColorChanged, _textG, and _textR.
Referenced by createItemWidgets(), setItemBorderColor(), setItemSelectionEnabled(), setItemTextColor(), setSoundClickItem(), setSoundHoverItem(), and setSoundSelectItem().
void Engines::WidgetListBox::createItemWidgets | ( | uint32 | count | ) |
Definition at line 131 of file listbox.cpp.
References Engines::Widget::_gui, _itemType, _itemWidgets, _protoItem, Engines::Widget::_tag, Engines::Widget::addChild(), Engines::Widget::addSub(), applyChangesToItemWidgets(), Common::UString::c_str(), Common::UString::format(), Engines::kLBItemTypeDefault, Engines::kLBItemTypeKotORInventory, and positionItemWidgets().
Referenced by Engines::KotOR::ConfirmDialog::ConfirmDialog(), Engines::KotOR::ContainerMenu::ContainerMenu(), Engines::Jade::MainMenu::MainMenu(), Engines::KotOR::MenuEquipment::MenuEquipment(), Engines::KotOR::SaveLoadMenu::SaveLoadMenu(), and Engines::KotOR::DialogGUIBase::update().
|
private |
Definition at line 343 of file listbox.cpp.
References Engines::Widget::_gui, Engines::KotORJadeWidget::_height, _leftScrollbar, _scrollbar, Engines::Widget::_tag, Engines::KotORJadeWidget::_width, Engines::Widget::addChild(), Engines::Widget::addSub(), Engines::Widget::getPosition(), Aurora::GFF3Struct::getString(), Engines::KotORJadeWidget::getWidth(), Engines::WidgetScrollbar::load(), Engines::WidgetScrollbar::setHeight(), and Engines::WidgetScrollbar::setPosition().
Referenced by load().
int Engines::WidgetListBox::getSelectedIndex | ( | ) | const |
Definition at line 306 of file listbox.cpp.
References _selectedIndex.
Referenced by Engines::KotOR::MenuEquipment::callbackActive(), Engines::KotOR::DialogGUIBase::callbackActive(), and Engines::KotOR::SaveLoadMenu::callbackActive().
|
virtual |
Reimplemented from Engines::KotORJadeWidget.
Definition at line 65 of file listbox.cpp.
References _leftScrollbar, _padding, _protoItem, createScrollbar(), Aurora::GFF3Struct::getBool(), Aurora::GFF3Struct::getSint(), Aurora::GFF3Struct::getStruct(), Aurora::GFF3Struct::hasField(), and Engines::KotORJadeWidget::load().
|
virtual |
A mouse wheel was used on the widget.
Reimplemented from Engines::Widget.
Definition at line 392 of file listbox.cpp.
References _adjustHeight, _itemWidgets, _numVisibleItems, _startIndex, MAX(), MIN(), and refreshItemWidgets().
Referenced by Engines::WidgetProtoItem::mouseWheel().
|
private |
Definition at line 361 of file listbox.cpp.
References Engines::KotORJadeWidget::_height, _itemWidgets, _leftScrollbar, _padding, _scrollbar, Engines::KotORJadeWidget::getBorderDimension(), Engines::KotORJadeWidget::getHeight(), Engines::Widget::getPosition(), and Engines::KotORJadeWidget::getWidth().
Referenced by createItemWidgets().
void Engines::WidgetListBox::refreshItemWidgets | ( | ) |
Definition at line 161 of file listbox.cpp.
References _adjustHeight, Engines::KotORJadeWidget::_height, _hideScrollbar, _items, _itemWidgets, _numVisibleItems, _padding, _scrollbar, _selectedIndex, _startIndex, Engines::KotORJadeWidget::getHeight(), Engines::Widget::getPosition(), Engines::KotORJadeWidget::getTextHeight(), GfxMan, Engines::WidgetScrollbar::hide(), Engines::KotORJadeWidget::hide(), Engines::Widget::isVisible(), Engines::WidgetProtoItem::setContents(), Engines::KotORJadeWidget::setHeight(), Engines::KotORJadeWidget::setHighlight(), Engines::KotORJadeWidget::setInvisible(), Engines::KotORJadeWidget::setPosition(), Engines::WidgetScrollbar::show(), and Engines::KotORJadeWidget::show().
Referenced by Engines::KotOR::MenuEquipment::fillEquipableItemsList(), Engines::KotOR::ContainerMenu::fillFromInventory(), Engines::KotOR::MenuEquipment::fixateOnSlot(), Engines::Jade::MainMenu::MainMenu(), mouseWheel(), Engines::KotOR::DialogGUIBase::refresh(), Engines::KotOR::SaveLoadMenu::SaveLoadMenu(), selectItemByWidgetTag(), selectNextItem(), selectPreviousItem(), and Engines::KotOR::ConfirmDialog::setText().
void Engines::WidgetListBox::removeAllItems | ( | ) |
Definition at line 126 of file listbox.cpp.
References _items, and _startIndex.
Referenced by Engines::KotOR::MenuEquipment::fillEquipableItemsList(), Engines::KotOR::ContainerMenu::fillFromInventory(), Engines::KotOR::DialogGUIBase::refresh(), and Engines::KotOR::ConfirmDialog::setText().
void Engines::WidgetListBox::selectItemByIndex | ( | int | index | ) |
Definition at line 251 of file listbox.cpp.
References _items, and _selectedIndex.
void Engines::WidgetListBox::selectItemByWidgetTag | ( | const Common::UString & | tag | ) |
Definition at line 234 of file listbox.cpp.
References _selectedIndex, _soundSelectItem, _startIndex, Engines::Widget::_tag, Common::UString::beginsWith(), Sound::kSoundTypeSFX, Common::parseString(), Engines::playSound(), refreshItemWidgets(), and Common::UString::replaceAll().
Referenced by Engines::KotOR::DialogGUIBase::callbackActive(), Engines::KotOR::MenuEquipment::fixateOnSlot(), and subActive().
void Engines::WidgetListBox::selectNextItem | ( | ) |
Definition at line 258 of file listbox.cpp.
References _items, _itemSelectionEnabled, _numVisibleItems, _selectedIndex, _soundSelectItem, _startIndex, Sound::kSoundTypeSFX, Engines::playSound(), and refreshItemWidgets().
Referenced by Engines::KotOR::ContainerMenu::callbackKeyInput(), Engines::KotOR::MenuEquipment::callbackKeyInput(), Engines::KotOR::DialogGUIBase::callbackKeyInput(), and Engines::KotOR::SaveLoadMenu::callbackKeyInput().
void Engines::WidgetListBox::selectPreviousItem | ( | ) |
Definition at line 282 of file listbox.cpp.
References _items, _itemSelectionEnabled, _selectedIndex, _soundSelectItem, _startIndex, Sound::kSoundTypeSFX, Engines::playSound(), and refreshItemWidgets().
Referenced by Engines::KotOR::ContainerMenu::callbackKeyInput(), Engines::KotOR::MenuEquipment::callbackKeyInput(), Engines::KotOR::DialogGUIBase::callbackKeyInput(), and Engines::KotOR::SaveLoadMenu::callbackKeyInput().
void Engines::WidgetListBox::setAdjustHeight | ( | bool | adjustHeight | ) |
Toggle height adjustment mode.
When enabled item widgets will adjust their height during refresh based on the size of their contents.
Definition at line 90 of file listbox.cpp.
References _adjustHeight.
Referenced by Engines::KotOR::DialogGUIBase::update().
|
virtual |
Set the height of the widget.
Reimplemented from Engines::KotORJadeWidget.
Definition at line 310 of file listbox.cpp.
References Engines::KotORJadeWidget::_height, _scrollbar, Engines::KotORJadeWidget::getHeight(), Engines::WidgetScrollbar::setHeight(), and Engines::KotORJadeWidget::setHeight().
Referenced by Engines::KotOR::DialogGUIBase::update().
void Engines::WidgetListBox::setHideScrollbar | ( | bool | hideScrollbar | ) |
Toggle scroll bar visibility mode.
When enabled it will only be displayed when number of underlying items exceeds number of item widgets.
Definition at line 94 of file listbox.cpp.
References _hideScrollbar.
Referenced by Engines::KotOR::MenuEquipment::MenuEquipment(), and Engines::KotOR::SaveLoadMenu::SaveLoadMenu().
void Engines::WidgetListBox::setItemBorderColor | ( | float | r, |
float | g, | ||
float | b, | ||
float | a | ||
) |
Definition at line 112 of file listbox.cpp.
References _borderA, _borderB, _borderColorChanged, _borderG, _borderR, and applyChangesToItemWidgets().
Referenced by Engines::KotOR::MenuEquipment::fixateOnSlot(), Engines::KotOR::MenuEquipment::MenuEquipment(), and Engines::KotOR::SaveLoadMenu::SaveLoadMenu().
void Engines::WidgetListBox::setItemSelectionEnabled | ( | bool | itemSelectionEnabled | ) |
Toggle item selection mode.
When enabled list box items can be selected by clicking on them.
Definition at line 82 of file listbox.cpp.
References _itemSelectionEnabled, _selectedIndex, and applyChangesToItemWidgets().
Referenced by Engines::KotOR::MenuEquipment::fixateOnSlot(), and Engines::KotOR::SaveLoadMenu::SaveLoadMenu().
void Engines::WidgetListBox::setItemTextColor | ( | float | r, |
float | g, | ||
float | b, | ||
float | a | ||
) |
Definition at line 102 of file listbox.cpp.
References _textA, _textB, _textColorChanged, _textG, _textR, and applyChangesToItemWidgets().
Referenced by Engines::KotOR::DialogGUIBase::update().
void Engines::WidgetListBox::setItemType | ( | ListBoxItemType | itemType | ) |
Definition at line 78 of file listbox.cpp.
References _itemType.
Referenced by Engines::KotOR::ContainerMenu::ContainerMenu(), and Engines::KotOR::MenuEquipment::MenuEquipment().
void Engines::WidgetListBox::setPadding | ( | uint32 | padding | ) |
Definition at line 98 of file listbox.cpp.
References _padding.
Referenced by Engines::KotOR::ContainerMenu::ContainerMenu(), Engines::KotOR::MenuEquipment::MenuEquipment(), and Engines::KotOR::SaveLoadMenu::SaveLoadMenu().
void Engines::WidgetListBox::setSoundClickItem | ( | const Common::UString & | resRef | ) |
Definition at line 338 of file listbox.cpp.
References _soundClickItem, and applyChangesToItemWidgets().
Referenced by Engines::KotOR::DialogGUIBase::update().
void Engines::WidgetListBox::setSoundHoverItem | ( | const Common::UString & | resRef | ) |
Definition at line 333 of file listbox.cpp.
References _soundHoverItem, and applyChangesToItemWidgets().
Referenced by Engines::KotOR::DialogGUIBase::update().
void Engines::WidgetListBox::setSoundSelectItem | ( | const Common::UString & | resRef | ) |
Definition at line 328 of file listbox.cpp.
References _soundSelectItem, and applyChangesToItemWidgets().
Referenced by Engines::KotOR::MenuEquipment::MenuEquipment(), and Engines::KotOR::SaveLoadMenu::SaveLoadMenu().
|
virtual |
A sub-widget was activated.
Reimplemented from Engines::Widget.
Definition at line 321 of file listbox.cpp.
References _itemSelectionEnabled, Engines::Widget::getTag(), Engines::Widget::raiseCallbackActive(), and selectItemByWidgetTag().
|
private |
Definition at line 115 of file listbox.h.
Referenced by mouseWheel(), refreshItemWidgets(), and setAdjustHeight().
|
private |
Definition at line 125 of file listbox.h.
Referenced by applyChangesToItemWidgets(), and setItemBorderColor().
|
private |
Definition at line 125 of file listbox.h.
Referenced by applyChangesToItemWidgets(), and setItemBorderColor().
|
private |
Definition at line 124 of file listbox.h.
Referenced by applyChangesToItemWidgets(), and setItemBorderColor().
|
private |
Definition at line 125 of file listbox.h.
Referenced by applyChangesToItemWidgets(), and setItemBorderColor().
|
private |
Definition at line 125 of file listbox.h.
Referenced by applyChangesToItemWidgets(), and setItemBorderColor().
|
private |
Definition at line 116 of file listbox.h.
Referenced by refreshItemWidgets(), and setHideScrollbar().
|
private |
Definition at line 109 of file listbox.h.
Referenced by addItem(), refreshItemWidgets(), removeAllItems(), selectItemByIndex(), selectNextItem(), and selectPreviousItem().
|
private |
Definition at line 114 of file listbox.h.
Referenced by applyChangesToItemWidgets(), selectNextItem(), selectPreviousItem(), setItemSelectionEnabled(), and subActive().
|
private |
Definition at line 111 of file listbox.h.
Referenced by createItemWidgets(), and setItemType().
|
private |
Definition at line 108 of file listbox.h.
Referenced by applyChangesToItemWidgets(), createItemWidgets(), mouseWheel(), positionItemWidgets(), and refreshItemWidgets().
|
private |
Definition at line 113 of file listbox.h.
Referenced by createScrollbar(), load(), and positionItemWidgets().
|
private |
Definition at line 119 of file listbox.h.
Referenced by mouseWheel(), refreshItemWidgets(), and selectNextItem().
|
private |
Definition at line 112 of file listbox.h.
Referenced by load(), positionItemWidgets(), refreshItemWidgets(), and setPadding().
|
private |
Definition at line 106 of file listbox.h.
Referenced by createItemWidgets(), and load().
|
private |
Definition at line 107 of file listbox.h.
Referenced by createScrollbar(), positionItemWidgets(), refreshItemWidgets(), and setHeight().
|
private |
Definition at line 117 of file listbox.h.
Referenced by getSelectedIndex(), refreshItemWidgets(), selectItemByIndex(), selectItemByWidgetTag(), selectNextItem(), selectPreviousItem(), and setItemSelectionEnabled().
|
private |
Definition at line 129 of file listbox.h.
Referenced by applyChangesToItemWidgets(), and setSoundClickItem().
|
private |
Definition at line 128 of file listbox.h.
Referenced by applyChangesToItemWidgets(), and setSoundHoverItem().
|
private |
Definition at line 127 of file listbox.h.
Referenced by selectItemByWidgetTag(), selectNextItem(), selectPreviousItem(), and setSoundSelectItem().
|
private |
Definition at line 118 of file listbox.h.
Referenced by mouseWheel(), refreshItemWidgets(), removeAllItems(), selectItemByWidgetTag(), selectNextItem(), and selectPreviousItem().
|
private |
Definition at line 122 of file listbox.h.
Referenced by applyChangesToItemWidgets(), and setItemTextColor().
|
private |
Definition at line 122 of file listbox.h.
Referenced by applyChangesToItemWidgets(), and setItemTextColor().
|
private |
Definition at line 121 of file listbox.h.
Referenced by applyChangesToItemWidgets(), and setItemTextColor().
|
private |
Definition at line 122 of file listbox.h.
Referenced by applyChangesToItemWidgets(), and setItemTextColor().
|
private |
Definition at line 122 of file listbox.h.
Referenced by applyChangesToItemWidgets(), and setItemTextColor().