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

A NWN listbox widget. More...

#include <listbox.h>

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

Public Types

enum  Mode { kModeStatic = 0, kModeSelectable }
 

Public Member Functions

 WidgetListBox (::Engines::GUI &gui, const Common::UString &tag, const Common::UString &model)
 
 ~WidgetListBox ()
 
Mode getMode () const
 
void setMode (Mode mode)
 
void show ()
 Show the widget. More...
 
void hide ()
 Hide the widget. More...
 
void setPosition (float x, float y, float z)
 Set the widget's position. More...
 
float getContentWidth () const
 
float getContentHeight () const
 
void lock ()
 
void clear ()
 
void reserve (size_t n)
 
void add (WidgetListItem *item, bool noTag=false)
 
void remove (WidgetListItem *item)
 
void unlock ()
 
void sortByTag ()
 
void setText (const Common::UString &font, const Common::UString &text, float spacing=0.0f)
 
void select (size_t item)
 
size_t getSelected () const
 
WidgetListItemgetSelectedItem () const
 
void deselect ()
 
void setStartItem (size_t firstItem)
 Set the first item to show in the list. More...
 
size_t getStartItem () const
 Get the first item shown in the list. More...
 
std::vector< WidgetListItem * >::iterator begin ()
 Get begin iterator from all the items in WidgetListBox. More...
 
std::vector< WidgetListItem * >::iterator end ()
 Get end iterator from all the items in WidgetListBox. More...
 
bool wasDblClicked ()
 
void mouseDown (uint8 state, float x, float y)
 A mouse button was pressed on the widget. More...
 
void mouseWheel (uint8 state, int x, int y)
 A mouse wheel was used on the widget. More...
 
void subActive (Widget &widget)
 A sub-widget was activated. More...
 
- Public Member Functions inherited from Engines::NWN::ModelWidget
 ModelWidget (::Engines::GUI &gui, const Common::UString &tag, const Common::UString &model)
 
 ~ModelWidget ()
 
void show ()
 Show the widget. More...
 
void hide ()
 Hide the widget. More...
 
void setPosition (float x, float y, float z)
 Set the widget's position. More...
 
float getWidth () const
 Get the widget's width. More...
 
float getHeight () const
 Get the widget's height. More...
 
void setTag (const Common::UString &tag)
 Set the widget's tag. More...
 
Graphics::Aurora::ModelNodegetNode (const Common::UString &nodeName) const
 
- Public Member Functions inherited from Engines::NWN::NWNWidgetWithCaption
 NWNWidgetWithCaption (::Engines::GUI &gui, const Common::UString &tag)
 
 ~NWNWidgetWithCaption ()
 
void show ()
 Show the widget. More...
 
void hide ()
 Hide the widget. More...
 
virtual void initCaption (const Common::UString &font, const Common::UString &text, float r=1.0f, float g=1.0f, float b=1.0f, float a=1.0f, float halign=Graphics::Aurora::kHAlignLeft, float valign=Graphics::Aurora::kVAlignTop)
 
void setPosition (float x, float y, float z)
 Set the widget's position. More...
 
void setColor (float r, float g, float b, float a)
 
void setText (const Common::UString &text)
 
const Common::UString getText () const
 
float getWidth () const
 Get the widget's width. More...
 
float getHeight () const
 Get the widget's height. More...
 
float getHorizontalAlign () const
 
float getVerticalAlign () const
 
void setDisabled (bool disabled)
 Disable/Enable the widget. More...
 
- Public Member Functions inherited from Engines::NWN::NWNWidget
 NWNWidget (::Engines::GUI &gui, const Common::UString &tag)
 
 ~NWNWidget ()
 
void enter ()
 The mouse entered the widget. More...
 
void leave ()
 The mouse left the widget. More...
 
void setTooltip (const Common::UString &text)
 
void setTooltipPosition (float x, float y, float z)
 
- 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 setInvisible (bool invisible)
 Make the widget invisible. More...
 
virtual void mouseMove (uint8 state, float x, float y)
 The mouse was moved over 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...
 

Protected Member Functions

virtual void updateScrollbarLength ()
 
virtual void updateScrollbarPosition ()
 
virtual void scrollUp (size_t n)
 
virtual void scrollDown (size_t n)
 
virtual void updateVisible ()
 
- 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

float _contentX
 
float _contentY
 
float _contentZ
 
float _contentWidth
 
float _contentHeight
 
std::vector< WidgetListItem * > _items
 
std::vector< WidgetListItem * > _visibleItems
 
size_t _startItem
 
size_t _selectedItem
 
WidgetButton_up
 
WidgetButton_down
 
WidgetScrollbar_scrollbar
 
bool _locked
 
- Protected Attributes inherited from Engines::NWN::ModelWidget
Graphics::Aurora::Model_model
 
- Protected Attributes inherited from Engines::NWN::NWNWidgetWithCaption
Common::ScopedPtr< Graphics::Aurora::Text_caption
 
float _r
 
float _g
 
float _b
 
float _a
 
- 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...
 

Private Member Functions

void getProperties ()
 
void createScrollbar ()
 
void itemDblClicked ()
 

Private Attributes

Mode _mode
 
bool _hasScrollbar
 
bool _dblClicked
 

Friends

class WidgetListItem
 

Detailed Description

A NWN listbox widget.

Definition at line 116 of file listbox.h.

Member Enumeration Documentation

◆ Mode

Enumerator
kModeStatic 
kModeSelectable 

Definition at line 118 of file listbox.h.

Constructor & Destructor Documentation

◆ WidgetListBox()

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

Definition at line 232 of file listbox.cpp.

References Engines::NWN::ModelWidget::_model, createScrollbar(), getProperties(), and Graphics::Renderable::setClickable().

Here is the call graph for this function:

◆ ~WidgetListBox()

Engines::NWN::WidgetListBox::~WidgetListBox ( )

Definition at line 245 of file listbox.cpp.

Member Function Documentation

◆ add()

void Engines::NWN::WidgetListBox::add ( WidgetListItem item,
bool  noTag = false 
)

◆ begin()

std::vector< WidgetListItem * >::iterator Engines::NWN::WidgetListBox::begin ( )

◆ clear()

void Engines::NWN::WidgetListBox::clear ( )

◆ createScrollbar()

void Engines::NWN::WidgetListBox::createScrollbar ( )
private

◆ deselect()

void Engines::NWN::WidgetListBox::deselect ( )

Definition at line 636 of file listbox.cpp.

References _items, and _selectedItem.

Referenced by Engines::NWN::CharFeatsPopup::callbackActive(), and Engines::NWN::CharSkills::reset().

Here is the caller graph for this function:

◆ end()

std::vector< WidgetListItem * >::iterator Engines::NWN::WidgetListBox::end ( )

◆ getContentHeight()

float Engines::NWN::WidgetListBox::getContentHeight ( ) const

Definition at line 377 of file listbox.cpp.

References _contentHeight.

◆ getContentWidth()

float Engines::NWN::WidgetListBox::getContentWidth ( ) const

Definition at line 373 of file listbox.cpp.

References _contentWidth.

Referenced by setText().

Here is the caller graph for this function:

◆ getMode()

WidgetListBox::Mode Engines::NWN::WidgetListBox::getMode ( ) const

Definition at line 309 of file listbox.cpp.

References _mode.

Referenced by Engines::NWN::WidgetListItem::activate(), and Engines::NWN::WidgetListItem::deactivate().

Here is the caller graph for this function:

◆ getProperties()

void Engines::NWN::WidgetListBox::getProperties ( )
private

◆ getSelected()

size_t Engines::NWN::WidgetListBox::getSelected ( ) const

◆ getSelectedItem()

WidgetListItem * Engines::NWN::WidgetListBox::getSelectedItem ( ) const

Definition at line 630 of file listbox.cpp.

References _items, and _selectedItem.

Referenced by Engines::NWN::CharInfoVoice::callbackActive(), Engines::NWN::CharSkills::callbackActive(), and Engines::NWN::CharInfoVoice::show().

Here is the caller graph for this function:

◆ getStartItem()

size_t Engines::NWN::WidgetListBox::getStartItem ( ) const

Get the first item shown in the list.

Definition at line 650 of file listbox.cpp.

References _startItem.

Referenced by Engines::NWN::CharFeats::changeAvailFeats().

Here is the caller graph for this function:

◆ hide()

void Engines::NWN::WidgetListBox::hide ( )
virtual

Hide the widget.

Reimplemented from Engines::Widget.

Definition at line 332 of file listbox.cpp.

References _down, _hasScrollbar, _scrollbar, _up, _visibleItems, Engines::NWN::ModelWidget::hide(), and Engines::NWN::WidgetScrollbar::hide().

Referenced by Engines::NWN::WidgetEditBox::hide(), Engines::NWN::WidgetGridBox::updateVisible(), and updateVisible().

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

◆ itemDblClicked()

void Engines::NWN::WidgetListBox::itemDblClicked ( )
private

Definition at line 586 of file listbox.cpp.

References _dblClicked, and Engines::Widget::setActive().

Referenced by Engines::NWN::WidgetListItem::mouseDblClick().

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

◆ lock()

void Engines::NWN::WidgetListBox::lock ( )

◆ mouseDown()

void Engines::NWN::WidgetListBox::mouseDown ( uint8  state,
float  x,
float  y 
)
virtual

A mouse button was pressed on the widget.

Reimplemented from Engines::Widget.

Definition at line 705 of file listbox.cpp.

References _scrollbar, _visibleItems, Engines::NWN::WidgetScrollbar::getBarPosition(), Engines::Widget::getPosition(), Engines::NWN::ModelWidget::getWidth(), Engines::Widget::isDisabled(), scrollDown(), and scrollUp().

Here is the call graph for this function:

◆ mouseWheel()

void Engines::NWN::WidgetListBox::mouseWheel ( uint8  state,
int  x,
int  y 
)
virtual

A mouse wheel was used on the widget.

Reimplemented from Engines::Widget.

Definition at line 725 of file listbox.cpp.

References Engines::Widget::isDisabled(), scrollDown(), and scrollUp().

Here is the call graph for this function:

◆ remove()

void Engines::NWN::WidgetListBox::remove ( WidgetListItem item)

◆ reserve()

void Engines::NWN::WidgetListBox::reserve ( size_t  n)

Definition at line 405 of file listbox.cpp.

References _items, and _locked.

Referenced by Engines::NWN::CharPremadeMenu::initCharacterList(), Engines::NWN::NewModuleMenu::initModuleList(), and Engines::NWN::NewPremiumMenu::initModuleList().

Here is the caller graph for this function:

◆ scrollDown()

void Engines::NWN::WidgetListBox::scrollDown ( size_t  n)
protectedvirtual

Reimplemented in Engines::NWN::WidgetGridBox.

Definition at line 605 of file listbox.cpp.

References _items, _startItem, _visibleItems, updateScrollbarPosition(), and updateVisible().

Referenced by mouseDown(), mouseWheel(), and subActive().

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

◆ scrollUp()

void Engines::NWN::WidgetListBox::scrollUp ( size_t  n)
protectedvirtual

Reimplemented in Engines::NWN::WidgetGridBox.

Definition at line 592 of file listbox.cpp.

References _startItem, _visibleItems, updateScrollbarPosition(), and updateVisible().

Referenced by mouseDown(), mouseWheel(), and subActive().

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

◆ select()

void Engines::NWN::WidgetListBox::select ( size_t  item)

◆ setMode()

void Engines::NWN::WidgetListBox::setMode ( Mode  mode)

◆ setPosition()

void Engines::NWN::WidgetListBox::setPosition ( float  x,
float  y,
float  z 
)
virtual

Set the widget's position.

Reimplemented from Engines::Widget.

Definition at line 347 of file listbox.cpp.

References _contentX, _contentY, _contentZ, Engines::Widget::_subWidgets, Engines::Widget::getPosition(), and Engines::NWN::ModelWidget::setPosition().

Referenced by Engines::NWN::CharPortrait::CharPortrait().

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

◆ setStartItem()

void Engines::NWN::WidgetListBox::setStartItem ( size_t  firstItem)

Set the first item to show in the list.

Definition at line 643 of file listbox.cpp.

References _items, _startItem, _visibleItems, updateScrollbarPosition(), and updateVisible().

Referenced by Engines::NWN::CharFeats::changeAvailFeats().

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

◆ setText()

void Engines::NWN::WidgetListBox::setText ( const Common::UString font,
const Common::UString text,
float  spacing = 0.0f 
)

◆ show()

void Engines::NWN::WidgetListBox::show ( )
virtual

Show the widget.

Reimplemented from Engines::Widget.

Definition at line 317 of file listbox.cpp.

References _down, _hasScrollbar, _scrollbar, _up, _visibleItems, Engines::NWN::ModelWidget::show(), and Engines::NWN::WidgetScrollbar::show().

Referenced by Engines::NWN::WidgetEditBox::show().

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

◆ sortByTag()

void Engines::NWN::WidgetListBox::sortByTag ( )

◆ subActive()

void Engines::NWN::WidgetListBox::subActive ( Widget widget)
virtual

◆ unlock()

void Engines::NWN::WidgetListBox::unlock ( )

◆ updateScrollbarLength()

void Engines::NWN::WidgetListBox::updateScrollbarLength ( )
protectedvirtual

Reimplemented in Engines::NWN::WidgetGridBox.

Definition at line 539 of file listbox.cpp.

References _items, _scrollbar, _visibleItems, and Engines::NWN::WidgetScrollbar::setLength().

Referenced by add(), clear(), and unlock().

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

◆ updateScrollbarPosition()

void Engines::NWN::WidgetListBox::updateScrollbarPosition ( )
protectedvirtual

Definition at line 549 of file listbox.cpp.

References _items, _scrollbar, _startItem, _visibleItems, and Engines::NWN::WidgetScrollbar::setState().

Referenced by add(), Engines::NWN::WidgetGridBox::scrollDown(), scrollDown(), Engines::NWN::WidgetGridBox::scrollUp(), scrollUp(), setStartItem(), Engines::NWN::WidgetGridBox::unlock(), and unlock().

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

◆ updateVisible()

void Engines::NWN::WidgetListBox::updateVisible ( )
protectedvirtual

Reimplemented in Engines::NWN::WidgetGridBox.

Definition at line 560 of file listbox.cpp.

References _contentX, _contentY, _contentZ, _items, _startItem, _visibleItems, GfxMan, hide(), Engines::Widget::isVisible(), and Engines::NWN::NWNWidget::setPosition().

Referenced by scrollDown(), scrollUp(), setStartItem(), sortByTag(), subActive(), and unlock().

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

◆ wasDblClicked()

bool Engines::NWN::WidgetListBox::wasDblClicked ( )

Definition at line 662 of file listbox.cpp.

References _dblClicked.

Friends And Related Function Documentation

◆ WidgetListItem

friend class WidgetListItem
friend

Definition at line 208 of file listbox.h.

Member Data Documentation

◆ _contentHeight

float Engines::NWN::WidgetListBox::_contentHeight
protected

◆ _contentWidth

float Engines::NWN::WidgetListBox::_contentWidth
protected

Definition at line 184 of file listbox.h.

Referenced by getContentWidth(), getProperties(), and Engines::NWN::WidgetGridBox::unlock().

◆ _contentX

float Engines::NWN::WidgetListBox::_contentX
protected

◆ _contentY

float Engines::NWN::WidgetListBox::_contentY
protected

◆ _contentZ

float Engines::NWN::WidgetListBox::_contentZ
protected

◆ _dblClicked

bool Engines::NWN::WidgetListBox::_dblClicked
private

Definition at line 202 of file listbox.h.

Referenced by itemDblClicked(), and wasDblClicked().

◆ _down

WidgetButton* Engines::NWN::WidgetListBox::_down
protected

Definition at line 193 of file listbox.h.

Referenced by createScrollbar(), hide(), and show().

◆ _hasScrollbar

bool Engines::NWN::WidgetListBox::_hasScrollbar
private

Definition at line 201 of file listbox.h.

Referenced by createScrollbar(), getProperties(), hide(), and show().

◆ _items

std::vector<WidgetListItem *> Engines::NWN::WidgetListBox::_items
protected

◆ _locked

bool Engines::NWN::WidgetListBox::_locked
protected

Definition at line 196 of file listbox.h.

Referenced by add(), clear(), lock(), remove(), reserve(), Engines::NWN::WidgetGridBox::unlock(), and unlock().

◆ _mode

Mode Engines::NWN::WidgetListBox::_mode
private

Definition at line 199 of file listbox.h.

Referenced by getMode(), and setMode().

◆ _scrollbar

WidgetScrollbar* Engines::NWN::WidgetListBox::_scrollbar
protected

◆ _selectedItem

size_t Engines::NWN::WidgetListBox::_selectedItem
protected

◆ _startItem

size_t Engines::NWN::WidgetListBox::_startItem
protected

◆ _up

WidgetButton* Engines::NWN::WidgetListBox::_up
protected

Definition at line 192 of file listbox.h.

Referenced by createScrollbar(), hide(), and show().

◆ _visibleItems

std::vector<WidgetListItem *> Engines::NWN::WidgetListBox::_visibleItems
protected

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