NovaTK::Menu Class Reference

Inheritance diagram for NovaTK::Menu:
Collaboration diagram for NovaTK::Menu:

List of all members.


Detailed Description

A menu presents a list of options in the form text items, which may or may not have icons or checkboxes, in which only one item may be selected. When a menu is shown, it takes control of the mouse and is hidden when the user has selected an item or cancels the menu.

Public Member Functions

virtual NOVATKAPI int Create (Window *owner)
virtual NOVATKAPI NStatus DeleteItem (uint itemID)
virtual NOVATKAPI void Destroy ()
virtual NOVATKAPI void Draw ()
virtual NOVATKAPI bool GetItemCheckState (uint itemID) const
virtual NOVATKAPI int GetSelection () const
virtual NOVATKAPI uint InsertItem (const NString &name)
virtual NOVATKAPI bool IsItemDisabled (uint itemID) const
virtual NOVATKAPI NStatus SetItemIcon (uint itemID, const Image *icon)
virtual NOVATKAPI NStatus SetItemCheckable (uint itemID, bool isCheckable)
virtual NOVATKAPI NStatus SetItemCheckState (uint itemID, bool state)
virtual NOVATKAPI NStatus SetItemDisabled (uint itemID, bool state)
virtual NOVATKAPI NStatus SetItemSubmenu (uint itemID, Menu *submenu)
virtual NOVATKAPI void Show (int sx, int sy)

Protected Member Functions

NStatus Create (Window *parent, int c_x, int c_y, int c_width, int c_height)
void Show ()

Member Function Documentation

NStatus NovaTK::Menu::Create ( Window parent,
int  c_x,
int  c_y,
int  c_width,
int  c_height 
) [inline, protected, virtual]

This prototype of Create is not available for this widget.

Reimplemented from NovaTK::Widget.

void NovaTK::Menu::Show (  )  [inline, protected, virtual]

This prototype of Show is not available for this widget.

Reimplemented from NovaTK::Widget.

int NovaTK::Menu::Create ( Window owner  )  [virtual]

Performs initialization of the menu.

Parameters:
owner - Pointer to the top-level window that is responsible for the creation of the window.

NStatus NovaTK::Menu::DeleteItem ( uint  itemID  )  [virtual]

Deletes the item specified by itemID from the menu.

Returns:
NOVATK_ERROR_DOES_NOT_EXIST if the itemID does not refer a valid item, otherwise returns NOVATK_SUCCESS.

void NovaTK::Menu::Destroy (  )  [virtual]

Destroys the widget.

Reimplemented from NovaTK::Widget.

void NovaTK::Menu::Draw (  )  [virtual]

Redraws the widget. This function is called by NovaTK and doesn't normally need to be called outside of the toolkit.

Reimplemented from NovaTK::Widget.

bool NovaTK::Menu::GetItemCheckState ( uint  itemID  )  const [virtual]

Parameters:
itemID - Specifies the item.
Returns:
TRUE if the specified item is checked or FALSE if the specified item is not checked or is not checkable.

virtual NOVATKAPI int NovaTK::Menu::GetSelection (  )  const [inline, virtual]

Returns:
The currently selected item or -1 if no item is selected.

uint NovaTK::Menu::InsertItem ( const NString name  )  [virtual]

Inserts an item with the specified name at the end of the menu. By default items are not checkable.

Returns:
The ID corresponding to this item. Note that unlike other widgets, the IDs used by Menu are NOT unique and correspond directly to the items position in the menu as menus typically don't change frequently.

bool NovaTK::Menu::IsItemDisabled ( uint  itemID  )  const [virtual]

Returns:
TRUE if the item specified by itemID is disabled, otherwise returns FALSE.

NStatus NovaTK::Menu::SetItemIcon ( uint  itemID,
const Image icon 
) [virtual]

Sets the an image to displayed to the left of the item name on the menu. You should ensure that the item is of appropriate dimensions to be displayed in the space it is allocated. Note that an item cannot have both an icon and be checkable at the same time.

Parameters:
itemID - Specifies the item whose icon is to be set.
icon - A pointer to the image containing the icon.
Returns:
NOVATK_SUCCESS upon success, NOVATK_ERROR_DOES_NOT_EXIST if itemID does not refer to a valid item or NOVATK_ERROR_BAD_REQUEST if the item is set as checkable.

NStatus NovaTK::Menu::SetItemCheckable ( uint  itemID,
bool  isCheckable 
) [virtual]

Items aren't checkable by default. A checkable item is a togglable item that represents either a true or false state. When the user clicks on such an item the state is toggled. The default state is unchecked or false. Note that an item cannot have both an icon and be checkable at the same time.

Parameters:
itemID - Specifies the item whose icon is to be set.
isCheckable - If TRUE then the item is checkable. If FALSE the item becomes uncheckable(normal item).
Returns:
NOVATK_SUCCESS upon success, NOVATK_ERROR_DOES_NOT_EXIST if itemID does not refer to a valid item or NOVATK_ERROR_BAD_REQUEST if the item already has an icon.

NStatus NovaTK::Menu::SetItemCheckState ( uint  itemID,
bool  state 
) [virtual]

Sets the state of a checkable item.

Parameters:
itemID - Specifies the item whose check state is to be set.
state - If TRUE then the item will be checked. If FALSE then the item will be unchecked.
Returns:
NOVATK_SUCCESS upon success, NOVATK_ERROR_DOES_NOT_EXIST if itemID does not refer to a valid item or NOVATK_ERROR_BAD_REQUEST if the specified item is not checkable.

NStatus NovaTK::Menu::SetItemDisabled ( uint  itemID,
bool  state 
) [virtual]

If state is TRUE then the item is disabled and cannot be selected, otherwise the item can be selected as normal. If a submenu is attached to the item, it will not be accessable if the item is disabled.

Parameters:
itemID - Specifies the item is to be disabled/enabled.
state - If TRUE then the item will be disabled. If FALSE then the item will be enabled.
Returns:
NOVATK_SUCCESS upon success, NOVATK_ERROR_DOES_NOT_EXIST if itemID does not refer to a valid item.

NStatus NovaTK::Menu::SetItemSubmenu ( uint  itemID,
Menu submenu 
) [virtual]

Attaches a submenu to the specified item. If submenu is NULL and the item referred to be itemID already has a submenu then it will be removed.

Returns:
NOVATK_SUCCESS upon success, NOVATK_ERROR_DOES_NOT_EXIST if itemID does not refer to a valid item or NOVATK_ERROR_BAD_REQUEST if the specified item is checkable as checkable items cannot have submenus.

void NovaTK::Menu::Show ( int  sx,
int  sy 
) [virtual]

Displays the menu at the location specified.


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

Generated on Sat Sep 13 22:34:21 2008 for NovaTK by  doxygen 1.5.5