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

CUI_Menu Class Reference

A menu or submenu. More...

#include <CUI_Menu.h>

Inheritance diagram for CUI_Menu:

CUI_ListBox CUI_Control CUI_Frame List of all members.

Public Member Functions

 CUI_Menu (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, IUI_Shader *submenuicon=NULL)
virtual ~CUI_Menu ()
 destructor

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

virtual bool AddItem (CUI_MenuItem *item)
 add a pre-created item to the list

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

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

virtual bool Render (double dtime, IUI_Renderer *renderer)
 overloaded render

virtual 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 ActivateSubMenu (bool select)
 Activate the sublist (if any) of currently selected item.

virtual bool DeactivateSubMenu (bool updateselect)
 Deactivate the sublist (if any) of currently selected item.

virtual bool GetSubMenuPosition (float &x, float &y)
 get the position that the sublist for the selected item should open at

virtual bool UpdateView ()
 update view

virtual bool SetSubMenuIcon (IUI_Shader *icon)
 set the icon to use for a submenu item

virtual bool SetParentMenu (CUI_Menu *parent)
 set parent menu pointer

virtual CUI_MenuGetParentMenu ()
 get parent menu pointer

virtual bool SetFlag (unsigned long flag, bool set)
 Intercept flag handling to detect de-selection.


Protected Types

typedef std::list< CUI_MenuItem * > MENUITEMLIST
 type for the listitem list


Protected Member Functions

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

virtual bool SelectNext (bool open)
 Select Next item.

virtual bool SelectPrevious (bool open)
 Select Previous item.


Protected Attributes

CUI_MenuItemm_selected
 pointer to the currently selected listitem

MENUITEMLIST m_itemList
 a list of the items in this list

IUI_Shaderm_subMenuIcon
 the submenu icon

CUI_Menum_parentMenu
 Parent menu (if this is a submenu).

CUI_Menum_subMenu
 open submenu


Detailed Description

A menu or submenu.

Adds submenu functionality to CUI_ListBox

Circular connections in the menu tree are evil. It will not work. Don't do it. There must be some sort of checking we can do to prevent this.

Recognized flags:
[system]
UI_CLICKED
UI_HOVER
UI_SELECTED

UI_DISABLED
UI_INACTIVE
UI_SQUEEZE
UI_VERTICAL


Member Function Documentation

bool CUI_Menu::ActivateSubMenu bool  select  )  [virtual]
 

Activate the sublist (if any) of currently selected item.

Parameters:
select if true, move selection to sublist
Returns:
true if submenu is activated, false if not

bool CUI_Menu::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_ListBox.

bool CUI_Menu::Render double  dtime,
IUI_Renderer renderer
[virtual]
 

overloaded render

overloaded from CUI_ListBox because it has to deal with items, which are of a different type in CUI_Menu

Reimplemented from CUI_ListBox.

bool CUI_Menu::SelectNext bool  open  )  [protected, virtual]
 

Select Next item.

Parameters:
open if true, open the sublist for the new item

bool CUI_Menu::SelectPrevious bool  open  )  [protected, virtual]
 

Select Previous item.

Parameters:
open if true, open the sublist for the new item

bool CUI_Menu::SetFlag unsigned long  flag,
bool  set
[virtual]
 

Intercept flag handling to detect de-selection.

deactive any submenus when this menu is deselected

Reimplemented from CUI_Frame.

bool CUI_Menu::UpdateView  )  [virtual]
 

update view

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

Reimplemented from CUI_ListBox.


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