Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

PG_ListBox Class Reference

A scrollable box that can hold any number of text items. More...

#include <pglistbox.h>

Inheritance diagram for PG_ListBox:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 PG_ListBox (PG_Widget *parent, const PG_Rect &r=PG_Rect::null, const std::string &style="ListBox")
 ~PG_ListBox ()
void SetMultiSelect (bool multi=true)
bool GetMultiSelect ()
PG_ListBoxBaseItemGetSelectedItem ()
void SelectItem (PG_ListBoxBaseItem *item, bool select=true, bool fireEvent=true)
void SelectFirstItem (bool fireEvent=true)
void SelectNextItem (bool fireEvent=true)
void SelectPrevItem (bool fireEvent=true)
void RemoveAll ()
 Remove all widgets from the list (without deletion).
void DeleteAll ()
 Delete (destroy) all widgets in the list.
void SetIndent (Uint16 indent)
 Set the item indentation.
Uint16 GetIndent ()
 Returns the item indentation.
void SetAlignment (PG_Label::TextAlign style)
 Set the alignment for all items.
PG_Label::TextAlign GetAlignment ()
 Returns the set alignment rule of this list.
int GetSelectedIndex ()
 Returns the index of the last selected item.
void GetSelectedItems (std::vector< PG_ListBoxBaseItem * > &items)
void AddChild (PG_Widget *child)
 Add a clientwidget (which will be embedded into this widget).

Public Attributes

SignalSelectItem sigSelectItem

Protected Member Functions

virtual bool eventSelectItem (PG_ListBoxBaseItem *item)
bool eventMouseButtonUp (const SDL_MouseButtonEvent *button)
 Overridable Eventhandler for a SDL_MouseButtonEvent message.
bool eventMouseButtonDown (const SDL_MouseButtonEvent *button)
 Overridable Eventhandler for a SDL_MouseButtonEvent message.
bool eventMouseMotion (const SDL_MouseMotionEvent *motion)
 Overridable Eventhandler for a SDL_MouseMotionEvent message.

Friends

class PG_ListBoxBaseItem

Classes

class  SignalSelectItem
 Signal type declaration. More...

Detailed Description

A scrollable box that can hold any number of text items.

Author:
Alexander Pipelka
listbox.png

listbox screenshot

Definition at line 49 of file pglistbox.h.


Constructor & Destructor Documentation

PG_ListBox::PG_ListBox PG_Widget parent,
const PG_Rect r = PG_Rect::null,
const std::string &  style = "ListBox"
 

Definition at line 36 of file pglistbox.cpp.

References PG_ScrollWidget::EnableScrollBar(), PG_ScrollBar::HORIZONTAL, PG_PropStr::ListBox, and PG_ThemeWidget::LoadThemeStyle().

PG_ListBox::~PG_ListBox  ) 
 

Definition at line 45 of file pglistbox.cpp.


Member Function Documentation

void PG_ListBox::AddChild PG_Widget child  )  [virtual]
 

Add a clientwidget (which will be embedded into this widget).

Parameters:
child the widget to add

Reimplemented from PG_WidgetList.

Definition at line 47 of file pglistbox.cpp.

References PG_WidgetList::AddChild(), PG_Widget::GetChildList(), PG_Rect::Height(), PG_ScrollWidget::my_scrollarea, PG_Widget::SetID(), PG_Widget::SizeWidget(), and PG_Rect::Width().

Referenced by PG_DropDown::AddChild().

void PG_ListBox::DeleteAll  )  [virtual]
 

Delete (destroy) all widgets in the list.

Reimplemented from PG_ScrollWidget.

Definition at line 118 of file pglistbox.cpp.

References PG_ScrollArea::DeleteAll(), PG_ScrollWidget::my_scrollarea, PG_ScrollArea::ScrollTo(), and PG_Widget::Update().

Referenced by PG_DropDown::DeleteAll(), and SelectFromMap::updateList().

bool PG_ListBox::eventMouseButtonDown const SDL_MouseButtonEvent *  button  )  [protected, virtual]
 

Overridable Eventhandler for a SDL_MouseButtonEvent message.

This handler is called when a mouse button is pressed. The default implementation returns 'false' which indicates that this message is not processed by this object.

Parameters:
button SDL_MouseButtonEvent message
Returns:
Notifies the message pump if this message is processed by this object or it should be routed to the next message receiver.

Reimplemented from PG_ScrollWidget.

Definition at line 104 of file pglistbox.cpp.

bool PG_ListBox::eventMouseButtonUp const SDL_MouseButtonEvent *  button  )  [protected, virtual]
 

Overridable Eventhandler for a SDL_MouseButtonEvent message.

This handler is called when a mouse button is released. The default implementation returns 'false' which indicates that this message is not processed by this object.

Parameters:
button SDL_MouseButtonEvent message
Returns:
Notifies the message pump if this message is processed by this object or it should be routed to the next message receiver.

Reimplemented from PG_MessageObject.

Definition at line 100 of file pglistbox.cpp.

bool PG_ListBox::eventMouseMotion const SDL_MouseMotionEvent *  motion  )  [protected, virtual]
 

Overridable Eventhandler for a SDL_MouseMotionEvent message.

This handler is called when mouse movement is detected. The default implementation returns 'false' which indicates that this message is not processed by this object.

Parameters:
motion SDL_MouseMotionEvent message
Returns:
Notifies the message pump if this message is processed by this object or it should be routed to the next message receiver.

Reimplemented from PG_MessageObject.

Definition at line 108 of file pglistbox.cpp.

bool PG_ListBox::eventSelectItem PG_ListBoxBaseItem item  )  [protected, virtual]
 

Definition at line 96 of file pglistbox.cpp.

Referenced by SelectItem().

PG_Label::TextAlign PG_ListBox::GetAlignment  ) 
 

Returns the set alignment rule of this list.

Definition at line 213 of file pglistbox.cpp.

Referenced by PG_DropDown::GetAlignment().

Uint16 PG_ListBox::GetIndent  ) 
 

Returns the item indentation.

Definition at line 195 of file pglistbox.cpp.

Referenced by PG_DropDown::GetIndent().

bool PG_ListBox::GetMultiSelect  ) 
 

Definition at line 63 of file pglistbox.cpp.

int PG_ListBox::GetSelectedIndex  ) 
 

Returns the index of the last selected item.

Definition at line 177 of file pglistbox.cpp.

Referenced by ImportBI3MapDialog::getImportTable(), and PG_DropDown::GetSelectedItemIndex().

PG_ListBoxBaseItem * PG_ListBox::GetSelectedItem  ) 
 

Definition at line 126 of file pglistbox.cpp.

void PG_ListBox::GetSelectedItems std::vector< PG_ListBoxBaseItem * > &  items  ) 
 

Definition at line 181 of file pglistbox.cpp.

References PG_RectList::first(), PG_Widget::GetChildList(), PG_ListBoxBaseItem::IsSelected(), PG_ScrollWidget::my_scrollarea, and PG_Rect::next().

void PG_ListBox::RemoveAll  )  [virtual]
 

Remove all widgets from the list (without deletion).

Reimplemented from PG_ScrollWidget.

Definition at line 112 of file pglistbox.cpp.

References PG_ScrollWidget::my_scrollarea, and PG_ScrollArea::RemoveAll().

Referenced by PG_DropDown::RemoveAll().

void PG_ListBox::SelectFirstItem bool  fireEvent = true  ) 
 

Definition at line 144 of file pglistbox.cpp.

References PG_WidgetList::FindWidget(), and PG_ListBoxBaseItem::Select().

Referenced by PG_DropDown::SelectFirstItem(), and PG_DropDown::SelectItem().

void PG_ListBox::SelectItem PG_ListBoxBaseItem item,
bool  select = true,
bool  fireEvent = true
 

Definition at line 67 of file pglistbox.cpp.

References eventSelectItem(), PG_Widget::GetID(), PG_ListBoxBaseItem::Select(), sigSelectItem, and PG_Widget::Update().

Referenced by ListBoxImageItem< SelectionType >::eventMouseButtonUp().

void PG_ListBox::SelectNextItem bool  fireEvent = true  ) 
 

Definition at line 155 of file pglistbox.cpp.

References PG_WidgetList::FindWidget(), and PG_ListBoxBaseItem::Select().

Referenced by PG_DropDown::SelectItem(), and PG_DropDown::SelectNextItem().

void PG_ListBox::SelectPrevItem bool  fireEvent = true  ) 
 

Definition at line 166 of file pglistbox.cpp.

References PG_WidgetList::FindWidget(), and PG_ListBoxBaseItem::Select().

Referenced by PG_DropDown::SelectPrevItem().

void PG_ListBox::SetAlignment PG_Label::TextAlign  style  ) 
 

Set the alignment for all items.

Parameters:
style alignment to be used for all items

Definition at line 199 of file pglistbox.cpp.

References PG_RectList::first(), PG_Widget::GetChildList(), PG_ScrollWidget::my_scrollarea, PG_Rect::next(), and PG_Widget::Update().

Referenced by PG_DropDown::SetAlignment().

void PG_ListBox::SetIndent Uint16  indent  ) 
 

Set the item indentation.

Parameters:
indent number of pixels for item indentation (must be set before adding items)

Definition at line 130 of file pglistbox.cpp.

References PG_RectList::first(), PG_Widget::GetChildList(), PG_ScrollWidget::my_scrollarea, PG_Rect::next(), PG_Label::SetIndent(), and PG_Widget::Update().

Referenced by PG_DropDown::SetIndent().

void PG_ListBox::SetMultiSelect bool  multi = true  ) 
 

Definition at line 59 of file pglistbox.cpp.

Referenced by EventAreasDialog::EventAreasDialog(), EventWindChangesDialog::EventWindChangesDialog(), MultiListBox::MultiListBox(), and NewStringChooser::NewStringChooser().


Friends And Related Function Documentation

friend class PG_ListBoxBaseItem [friend]
 

Definition at line 143 of file pglistbox.h.


Member Data Documentation

SignalSelectItem PG_ListBox::sigSelectItem
 

Definition at line 127 of file pglistbox.h.

Referenced by NewStringChooser::NewStringChooser(), PG_DropDown::PG_DropDown(), SelectFromMap::SelectFromMap(), and SelectItem().


The documentation for this class was generated from the following files:
Generated on Tue Jun 24 02:18:59 2008 for Advanced Strategic Command by  doxygen 1.4.2