Public Member Functions | Private Types | Private Member Functions | Private Attributes

ListBox Class Reference

A Basic ListBox. More...

#include <ListBox.h>

Inheritance diagram for ListBox:
ScrollArea Container Control Broadcaster Listener

List of all members.

Public Member Functions

 ListBox (const std::string &name, Uint width, Uint height, ListBoxType type=LIST_SINGLE)
 ~ListBox ()
StringList getList () const
StringList getSelection () const
Uint getSelectionIndex () const
void addItem (ListItem *item)
void addItem (const StringList &strList)
void setSelection (const std::string &ref)
void clearSelection ()
void clear ()

Private Types

typedef vector< ListItem * > ItemList

Private Member Functions

void scrollAreaInit ()
void areaChanged ()
void drawSkin ()
void drawPlain ()
void drawList ()
void onClick (Event *event)
void onKeyDown (Event *event)
void onKeyUp (Event *event)

Private Attributes

ItemList mItemList
StringList mTextList
ListBoxType mType
Uint mLineSelection
Uint mMaxNumItems
Uint mCurrentLine
Uint mPreviousLine
Uint mCurrentSelection
bool mCtrlPressed

Detailed Description

A Basic ListBox.

The list box is used to select an item in a list.


Member Typedef Documentation

typedef vector<ListItem*> ListBox::ItemList [private]

Constructor & Destructor Documentation

ListBox::ListBox ( const std::string &  name,
Uint  width,
Uint  height,
ListBoxType  type = LIST_SINGLE 
)
ListBox::~ListBox (  )  [inline]

Member Function Documentation

void ListBox::addItem ( ListItem item  ) 

Adds a ListItem to the ListBox.

Parameters:
item A pointer to a ListItem box.
Note:
Any ListItem objects that are added to the ListBox are then owned by the ListBox and should not be deleted.
void ListBox::addItem ( const StringList strList  ) 

Adds a set of text-only items based on a string list.

Parameters:
strList A reference to a StringList.
void ListBox::areaChanged (  )  [private, virtual]
Todo:
Comment me.

Reimplemented from ScrollArea.

void ListBox::clear (  ) 

Clears the ListBox of all items.

Warning:
Clearing the ListBox also invalidates any pointers or references to any of the stored ListItem objects.
void ListBox::clearSelection (  ) 

Clears the current selection.

void ListBox::drawList (  )  [private]

Draws the list.

void ListBox::drawPlain (  )  [private, virtual]

Draws a Control without a Skin.

Reimplemented from ScrollArea.

void ListBox::drawSkin (  )  [private, virtual]

Render this control.

Reimplemented from ScrollArea.

StringList ListBox::getList (  )  const

Returns a list of all items in the ListBox.

StringList ListBox::getSelection (  )  const

Gets a list of the currently selected items.

Uint ListBox::getSelectionIndex (  )  const [inline]
void ListBox::onClick ( Event event  )  [private, virtual]

Reimplemented from Control.

void ListBox::onKeyDown ( Event event  )  [private, virtual]

Called whenever an EVENT_KEYDOWN event is fired.

Reimplemented from Control.

void ListBox::onKeyUp ( Event event  )  [private, virtual]

Called whenever an EVENT_KEYUP event is fired.

Reimplemented from Control.

void ListBox::scrollAreaInit (  )  [private, virtual]

Ensure that we're automatically setting our height/width parameters.

Reimplemented from ScrollArea.

void ListBox::setSelection ( const std::string &  ref  ) 

Sets the selection using a std::string reference.

Parameters:
ref A reference to a std::string.

Member Data Documentation

bool ListBox::mCtrlPressed [private]

Current line based on scrollbar's position.

Index of the currently selected item.

List of ListItem objects.

Position of the Insertion Cursor.

COMMENT ME!

Previous line based on scrollbar's position.

Vector of text to list.

Type of ListBox.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines