xoreos  0.0.5
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Engines::WidgetListBox Class Reference

#include <listbox.h>

Inheritance diagram for Engines::WidgetListBox:
Inheritance graph
[legend]
Collaboration diagram for Engines::WidgetListBox:
Collaboration graph
[legend]

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::UStringgetTag () 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...
 
WidgetgetParent ()
 
const WidgetgetParent () const
 
WidgetgetChild (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
 

Additional Inherited Members

- Protected Member Functions inherited from Engines::KotORJadeWidget
Graphics::Aurora::HighlightablegetTextHighlightableComponent () const
 
Graphics::Aurora::HighlightablegetQuadHighlightableComponent () const
 
Extend createExtend (const Aurora::GFF3Struct &gff)
 
Border createBorder (const Aurora::GFF3Struct &gff)
 
Text createText (const Aurora::GFF3Struct &gff)
 
Hilight createHilight (const Aurora::GFF3Struct &gff)
 
- Protected Member Functions inherited from Engines::Widget
virtual void signalGroupMemberActive ()
 A fellow group member signaled that it is now active. More...
 
void setActive (bool active)
 The widget's active state. More...
 
void raiseCallbackActive (Widget &widget)
 
- Protected Attributes inherited from Engines::KotORJadeWidget
float _width
 
float _height
 
uint32 _borderDimension
 
float _r
 
float _g
 
float _b
 
float _a
 
float _unselectedR
 
float _unselectedG
 
float _unselectedB
 
float _unselectedA
 
bool _wrapped
 
Common::ScopedPtr< Graphics::Aurora::GUIQuad_quad
 
Common::ScopedPtr< Graphics::Aurora::GUIQuad_highlight
 
Common::ScopedPtr< Graphics::Aurora::HighlightableText_text
 
Common::ScopedPtr< Graphics::Aurora::BorderQuad_border
 
Graphics::Aurora::SubSceneQuad_subScene
 
bool _highlighted
 
- Protected Attributes inherited from Engines::Widget
GUI_gui
 The GUI the widget belongs to. More...
 
Common::UString _tag
 The widget's tag. More...
 
Widget_parent
 The widget's parent, if any. More...
 
Widget_owner
 The widget's owner, if any. More...
 
std::list< Widget * > _subWidgets
 The widget's sub-widgets. More...
 
std::list< Widget * > _children
 The widget's children. More...
 
std::list< Widget * > _groupMembers
 The widget's fellow group members. More...
 

Detailed Description

Definition at line 40 of file listbox.h.

Constructor & Destructor Documentation

◆ WidgetListBox()

Engines::WidgetListBox::WidgetListBox ( GUI gui,
const Common::UString tag 
)

Definition at line 43 of file listbox.cpp.

◆ ~WidgetListBox()

Engines::WidgetListBox::~WidgetListBox ( )

Definition at line 62 of file listbox.cpp.

Member Function Documentation

◆ addItem()

void Engines::WidgetListBox::addItem ( const Common::UString contents)

◆ applyChangesToItemWidgets()

void Engines::WidgetListBox::applyChangesToItemWidgets ( )
private

◆ createItemWidgets()

void Engines::WidgetListBox::createItemWidgets ( uint32  count)

◆ createScrollbar()

void Engines::WidgetListBox::createScrollbar ( const Aurora::GFF3Struct gff)
private

◆ getSelectedIndex()

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().

Here is the caller graph for this function:

◆ load()

void Engines::WidgetListBox::load ( const Aurora::GFF3Struct gff)
virtual

◆ mouseWheel()

void Engines::WidgetListBox::mouseWheel ( uint8  state,
int  x,
int  y 
)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ positionItemWidgets()

void Engines::WidgetListBox::positionItemWidgets ( )
private

◆ refreshItemWidgets()

void Engines::WidgetListBox::refreshItemWidgets ( )

◆ removeAllItems()

void Engines::WidgetListBox::removeAllItems ( )

◆ selectItemByIndex()

void Engines::WidgetListBox::selectItemByIndex ( int  index)

Definition at line 251 of file listbox.cpp.

References _items, and _selectedIndex.

◆ selectItemByWidgetTag()

void Engines::WidgetListBox::selectItemByWidgetTag ( const Common::UString tag)

◆ selectNextItem()

void Engines::WidgetListBox::selectNextItem ( )

◆ selectPreviousItem()

void Engines::WidgetListBox::selectPreviousItem ( )

◆ setAdjustHeight()

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().

Here is the caller graph for this function:

◆ setHeight()

void Engines::WidgetListBox::setHeight ( float  height)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setHideScrollbar()

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().

Here is the caller graph for this function:

◆ setItemBorderColor()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setItemSelectionEnabled()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setItemTextColor()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setItemType()

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().

Here is the caller graph for this function:

◆ setPadding()

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().

Here is the caller graph for this function:

◆ setSoundClickItem()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSoundHoverItem()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSoundSelectItem()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ subActive()

void Engines::WidgetListBox::subActive ( Widget widget)
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().

Here is the call graph for this function:

Member Data Documentation

◆ _adjustHeight

bool Engines::WidgetListBox::_adjustHeight
private

Definition at line 115 of file listbox.h.

Referenced by mouseWheel(), refreshItemWidgets(), and setAdjustHeight().

◆ _borderA

float Engines::WidgetListBox::_borderA
private

Definition at line 125 of file listbox.h.

Referenced by applyChangesToItemWidgets(), and setItemBorderColor().

◆ _borderB

float Engines::WidgetListBox::_borderB
private

Definition at line 125 of file listbox.h.

Referenced by applyChangesToItemWidgets(), and setItemBorderColor().

◆ _borderColorChanged

bool Engines::WidgetListBox::_borderColorChanged
private

Definition at line 124 of file listbox.h.

Referenced by applyChangesToItemWidgets(), and setItemBorderColor().

◆ _borderG

float Engines::WidgetListBox::_borderG
private

Definition at line 125 of file listbox.h.

Referenced by applyChangesToItemWidgets(), and setItemBorderColor().

◆ _borderR

float Engines::WidgetListBox::_borderR
private

Definition at line 125 of file listbox.h.

Referenced by applyChangesToItemWidgets(), and setItemBorderColor().

◆ _hideScrollbar

bool Engines::WidgetListBox::_hideScrollbar
private

Definition at line 116 of file listbox.h.

Referenced by refreshItemWidgets(), and setHideScrollbar().

◆ _items

std::vector<Common::UString> Engines::WidgetListBox::_items
private

◆ _itemSelectionEnabled

bool Engines::WidgetListBox::_itemSelectionEnabled
private

◆ _itemType

ListBoxItemType Engines::WidgetListBox::_itemType
private

Definition at line 111 of file listbox.h.

Referenced by createItemWidgets(), and setItemType().

◆ _itemWidgets

std::vector<WidgetProtoItem *> Engines::WidgetListBox::_itemWidgets
private

◆ _leftScrollbar

bool Engines::WidgetListBox::_leftScrollbar
private

Definition at line 113 of file listbox.h.

Referenced by createScrollbar(), load(), and positionItemWidgets().

◆ _numVisibleItems

int Engines::WidgetListBox::_numVisibleItems
private

Definition at line 119 of file listbox.h.

Referenced by mouseWheel(), refreshItemWidgets(), and selectNextItem().

◆ _padding

uint32 Engines::WidgetListBox::_padding
private

Definition at line 112 of file listbox.h.

Referenced by load(), positionItemWidgets(), refreshItemWidgets(), and setPadding().

◆ _protoItem

const Aurora::GFF3Struct* Engines::WidgetListBox::_protoItem
private

Definition at line 106 of file listbox.h.

Referenced by createItemWidgets(), and load().

◆ _scrollbar

WidgetScrollbar* Engines::WidgetListBox::_scrollbar
private

Definition at line 107 of file listbox.h.

Referenced by createScrollbar(), positionItemWidgets(), refreshItemWidgets(), and setHeight().

◆ _selectedIndex

int Engines::WidgetListBox::_selectedIndex
private

◆ _soundClickItem

Common::UString Engines::WidgetListBox::_soundClickItem
private

Definition at line 129 of file listbox.h.

Referenced by applyChangesToItemWidgets(), and setSoundClickItem().

◆ _soundHoverItem

Common::UString Engines::WidgetListBox::_soundHoverItem
private

Definition at line 128 of file listbox.h.

Referenced by applyChangesToItemWidgets(), and setSoundHoverItem().

◆ _soundSelectItem

Common::UString Engines::WidgetListBox::_soundSelectItem
private

◆ _startIndex

int Engines::WidgetListBox::_startIndex
private

◆ _textA

float Engines::WidgetListBox::_textA
private

Definition at line 122 of file listbox.h.

Referenced by applyChangesToItemWidgets(), and setItemTextColor().

◆ _textB

float Engines::WidgetListBox::_textB
private

Definition at line 122 of file listbox.h.

Referenced by applyChangesToItemWidgets(), and setItemTextColor().

◆ _textColorChanged

bool Engines::WidgetListBox::_textColorChanged
private

Definition at line 121 of file listbox.h.

Referenced by applyChangesToItemWidgets(), and setItemTextColor().

◆ _textG

float Engines::WidgetListBox::_textG
private

Definition at line 122 of file listbox.h.

Referenced by applyChangesToItemWidgets(), and setItemTextColor().

◆ _textR

float Engines::WidgetListBox::_textR
private

Definition at line 122 of file listbox.h.

Referenced by applyChangesToItemWidgets(), and setItemTextColor().


The documentation for this class was generated from the following files: