Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

CUI_ListBox Class Reference

A list box - high level control. More...

#include <CUI_ListBox.h>

Inheritance diagram for CUI_ListBox:

CUI_Control CUI_Frame CUI_Menu List of all members.

Public Member Functions

 CUI_ListBox (CUI_UI *ui=NULL, float x=0, float y=0, float x2=1, float y2=1, CUI_Frame *parent=NULL, IUI_Shader *shader=NULL, IUI_Shader *cursor=NULL, CUI_CoordSys *coordsys=NULL, IUI_Shader *itemshader=NULL, IUI_Shader *hovershader=NULL, IUI_Shader *selectedshader=NULL, IUI_Border *itemborder=NULL, IUI_Font *font=NULL)
 constructor

virtual ~CUI_ListBox ()
 destructor

virtual bool AddItem (char *text=NULL, unsigned int itemID=0, IUI_Shader *icon=NULL, unsigned short flags=UI_ITEM_BUTTON)
 add an item to the list

virtual bool AddItem (CUI_ListItem *item)
 add a pre-created item (probably an app-specific inherited class)

virtual bool RemoveItem (unsigned int itemID)
 remove an item - flags it as inactive

virtual bool EnableItem (unsigned int itemID, bool enable=true)
 enable/disable an item

virtual bool ProcessKey (unsigned long key)
 Process a incoming key.

virtual bool Render (double dtime, IUI_Renderer *renderer)
 overloaded render - update selected item's shader

bool CallbackFunc (int id, int numparam, void *param)
 Callback function to handle updating the selection.

virtual bool Select (CUI_Frame *frame)
 select a child frame

virtual bool Select (unsigned int id)
 select a child frame with this id

virtual bool SetItemSize (float size)
 set the size of each item (in the control's parent's coordinate system)

virtual bool SetItemFlag (unsigned int itemID, unsigned short flag, bool enable=true)
 general flag flipping

virtual bool SetItemIcon (unsigned int itemID, IUI_Shader *icon)
 set the icon for an item

virtual bool SetHoverShader (IUI_Shader *shader)
 set the hover shader for each item

virtual bool SetSelectedShader (IUI_Shader *shader)
 set the shader for the selected item

virtual bool SetItemShader (IUI_Shader *shader)
 set the shader for each item

virtual bool SetItemBorder (IUI_Border *border)
 Set the border for each item.

virtual bool UpdateView ()
 update view

virtual int GetActiveItems ()
 Get the number of active items in the list.

virtual char * GetSelectedText ()
 Get the text label of the selected item.

virtual int GetSelectedID ()
 Get the ID of the selected item.

virtual IUI_ShaderGetSelectedIconShader ()
 Get the icon for the selected item.

virtual bool SetToggleIcons (IUI_Shader *off, IUI_Shader *on)
 set toggle Icon shaders


Protected Types

typedef std::list< CUI_ListItem * > LISTITEMLIST
 type for the listitem list


Protected Member Functions

CUI_ListItemFindItem (unsigned int itemID)
 Find the first item with this ID.

bool SelectNext ()
 Select Next item.

bool SelectPrevious ()
 Select Previous item.


Protected Attributes

float m_itemSize
 The size of each item (in the control's parent's coordinate system).

CUI_ListItemm_selected
 pointer to the currently selected listitem

IUI_Shaderm_itemShader
 default shader for each item

IUI_Borderm_itemBorder
 default border for each item

IUI_Shaderm_selectedShader
 shader for the selected item

LISTITEMLIST m_itemList
 a list of the items in this list

int m_activeItems
 number of active items in the list

IUI_Shaderm_hoverShader
 shader for the item being hovered over

IUI_Shaderm_toggleOnIcon
 Toggle on icon shader.

IUI_Shaderm_toggleOffIcon
 Toggle off icon shader.


Detailed Description

A list box - high level control.

The list box is responsible for creating and deleting list items.

The list box itself is not clickable or draggable. That functionality is handled by the CUI_Buttons that are its children.

Recognized flags:
[system]
UI_CLICKED
UI_HOVER
UI_SELECTED

UI_DISABLED
UI_INACTIVE
UI_SQUEEZE
UI_VERTICAL


Member Function Documentation

bool CUI_ListBox::CallbackFunc int  id,
int  numparam,
void *  param
[virtual]
 

Callback function to handle updating the selection.

Returns:
true if the global callback does NOT need to be called

false if the global callback needs to be called

Reimplemented from CUI_Frame.

Reimplemented in CUI_Menu.

bool CUI_ListBox::UpdateView  )  [virtual]
 

update view

update the placement of items and the overall view of the control

Reimplemented in CUI_Menu.


Member Data Documentation

float CUI_ListBox::m_itemSize [protected]
 

The size of each item (in the control's parent's coordinate system).

If UI_SQUEEZE is set, this is ignored


The documentation for this class was generated from the following files:
Generated on Mon Sep 29 23:07:03 2003 for glGUI by doxygen 1.3.4