Planeshift
Public Member Functions | Protected Member Functions | Protected Attributes

pawsMenu Class Reference

pawsMenu is standard PAWS menu widget. More...

#include <pawsmenu.h>

List of all members.

Public Member Functions

void AddItem (pawsIMenuItem *item, pawsIMenuItem *nextItem=NULL)
void DeleteItem (pawsIMenuItem *item)
 Item is deleted from the menu and destructed.
virtual void DoAction (pawsIMenuItem *item)
 Processes action invoked by user:

  • according to action type either opens a new menu or sends notification to subscriber 'item' is menu item that was activated 'action' is description of the action that should be taken.

virtual void Draw ()
 Draws the widget and all of it's children.
bool HasSubmenus ()
 Does menu have any submenus ?
virtual bool OnButtonPressed (int button, int keyModifier, pawsWidget *widget)
 Called whenever a button is pressed.
virtual void OnChildMenuDestroyed (pawsIMenu *child, pawsMenuClose reason)
 Called when child menu was closed.
virtual bool OnMouseDown (int button, int modifiers, int x, int y)
 Manage mouse down event to test for and apply window changes.
virtual void OnParentMenuDestroyed (pawsMenuClose reason)
 Called when parent menu was closed.
virtual void OnSiblingOpened ()
 Called when another submenu of parent menu was opened.
 pawsMenu ()
 pawsMenu (const pawsMenu &origin)
virtual bool PostSetup ()
 This is called after the widget and all of it's children have been created.
void SetItemAction (pawsIMenuItem *item, const pawsMenuAction &action)
 Sets action that should be invoked when 'item' is activated by user.
virtual void SetNotify (pawsWidget *notifyTarget)
 Sets widget that should be receiving OnMenuAction events.
virtual void SetParentMenu (pawsIMenu *parentMenu)
 Sets parent menu of submenu.
virtual bool Setup (iDocumentNode *node)
 Setup this widget.
 ~pawsMenu ()

Protected Member Functions

void Autosize ()
 Calculates and sets its size according to size of its content.
void DestroyMenu (pawsMenuClose reason)
 Sends MENU_DESTROY_ACTION_NAME event and notifies its parent and children.
csPtr< iDocumentNode > FindSubmenuNode (iDocumentNode *node, const csString &name)
 Searches for node with attribute "name" equal to parameter in 'node' and its children.
int GetContentHeight ()
int GetContentWidth ()
 Calculates dimensions of menu items.
void SendDestroyAction ()
 Sends OnMenuAction event that requests destruction of this menu (MENU_DESTROY_ACTION_NAME)
void SendOnMenuAction (const pawsMenuAction &action)
 Sends OnMenuAction event to notification target.
void SetButtonPositions ()
 Sets positions of the Sticky and Close buttons.
void SetPositionsOfItems ()
 Calculates and sets position of each menu item.
void SetSubmenuPos (pawsMenu *submenu, int recommY)
 Sets appropriate position of a submenu on screen.

Protected Attributes

pawsMenuAlign align
csRef< iPawsImagearrowImage
bool autosize
 should Autosize() method be used ?
pawsButtoncloseButton
iGraphics2D * graphics2d
csArray< pawsIMenuItem * > items
 list of menu items
pawsTextBoxlabel
pawsWidgetnotifyTarget
 target of OnMenuAction events
pawsIMenuparentMenu
bool sticky
 Is the menu "stickied" on screen ? Stickied menu can only be closed by clicking on the closing button.
pawsButtonstickyButton
csArray< pawsIMenu * > submenus
 list of open submenus

Detailed Description

pawsMenu is standard PAWS menu widget.

Definition at line 192 of file pawsmenu.h.


Constructor & Destructor Documentation

pawsMenu::pawsMenu ( )
pawsMenu::~pawsMenu ( )
pawsMenu::pawsMenu ( const pawsMenu origin)

Member Function Documentation

void pawsMenu::AddItem ( pawsIMenuItem item,
pawsIMenuItem nextItem = NULL 
)
void pawsMenu::Autosize ( ) [protected]

Calculates and sets its size according to size of its content.

void pawsMenu::DeleteItem ( pawsIMenuItem item)

Item is deleted from the menu and destructed.

void pawsMenu::DestroyMenu ( pawsMenuClose  reason) [protected]

Sends MENU_DESTROY_ACTION_NAME event and notifies its parent and children.

Thanks to this all references from parent and children and the widget that is catching menu events are dropped before the destruction.

virtual void pawsMenu::DoAction ( pawsIMenuItem item) [virtual]

Processes action invoked by user:

  • according to action type either opens a new menu or sends notification to subscriber 'item' is menu item that was activated 'action' is description of the action that should be taken.

Implements pawsIMenu.

virtual void pawsMenu::Draw ( ) [virtual]

Draws the widget and all of it's children.

Remarks:
Uses clipping rect of it's parent to define drawing area. If the drawing area defined is empty it returns.

Reimplemented from pawsWidget.

csPtr<iDocumentNode> pawsMenu::FindSubmenuNode ( iDocumentNode *  node,
const csString &  name 
) [protected]

Searches for node with attribute "name" equal to parameter in 'node' and its children.

If succeeds returns pointer to the node found, or returns NULL.

int pawsMenu::GetContentHeight ( ) [protected]
int pawsMenu::GetContentWidth ( ) [protected]

Calculates dimensions of menu items.

bool pawsMenu::HasSubmenus ( )

Does menu have any submenus ?

virtual bool pawsMenu::OnButtonPressed ( int  button,
int  keyModifier,
pawsWidget widget 
) [virtual]

Called whenever a button is pressed.

Parameters:
buttonThe button pressed.
keyModifierModifier key in effect.
widgetThe widget the button belongs to.
Returns:
bool Parent's result or FALSE if no parent.

Reimplemented from pawsWidget.

virtual void pawsMenu::OnChildMenuDestroyed ( pawsIMenu child,
pawsMenuClose  reason 
) [virtual]

Called when child menu was closed.

Implements pawsIMenu.

virtual bool pawsMenu::OnMouseDown ( int  button,
int  modifiers,
int  x,
int  y 
) [virtual]

Manage mouse down event to test for and apply window changes.

Parameters:
buttonType of button: 1 resizable or movable, 2 context menu or config window.
modifiersUsed with PAWS_CONSTRUCTION.
xUsed to test for resize.
yUsed to test for resize.
Returns:
bool TRUE if movable or resizable.
Remarks:
calls OnMouseDown on it's parent.

Reimplemented from pawsWidget.

virtual void pawsMenu::OnParentMenuDestroyed ( pawsMenuClose  reason) [virtual]

Called when parent menu was closed.

Implements pawsIMenu.

virtual void pawsMenu::OnSiblingOpened ( ) [virtual]

Called when another submenu of parent menu was opened.

Implements pawsIMenu.

virtual bool pawsMenu::PostSetup ( ) [virtual]

This is called after the widget and all of it's children have been created.

Remarks:
This can be useful for widgets that want to get pointers to some of it's children for quick access.

Reimplemented from pawsWidget.

void pawsMenu::SendDestroyAction ( ) [protected]

Sends OnMenuAction event that requests destruction of this menu (MENU_DESTROY_ACTION_NAME)

void pawsMenu::SendOnMenuAction ( const pawsMenuAction action) [protected]

Sends OnMenuAction event to notification target.

void pawsMenu::SetButtonPositions ( ) [protected]

Sets positions of the Sticky and Close buttons.

void pawsMenu::SetItemAction ( pawsIMenuItem item,
const pawsMenuAction action 
)

Sets action that should be invoked when 'item' is activated by user.

virtual void pawsMenu::SetNotify ( pawsWidget notifyTarget) [virtual]

Sets widget that should be receiving OnMenuAction events.

Implements pawsIMenu.

virtual void pawsMenu::SetParentMenu ( pawsIMenu parentMenu) [virtual]

Sets parent menu of submenu.

Implements pawsIMenu.

void pawsMenu::SetPositionsOfItems ( ) [protected]

Calculates and sets position of each menu item.

void pawsMenu::SetSubmenuPos ( pawsMenu submenu,
int  recommY 
) [protected]

Sets appropriate position of a submenu on screen.

virtual bool pawsMenu::Setup ( iDocumentNode *  ) [virtual]

Setup this widget.

Reimplemented from pawsWidget.


Member Data Documentation

Definition at line 309 of file pawsmenu.h.

csRef<iPawsImage> pawsMenu::arrowImage [protected]

Definition at line 307 of file pawsmenu.h.

bool pawsMenu::autosize [protected]

should Autosize() method be used ?

Definition at line 314 of file pawsmenu.h.

Definition at line 304 of file pawsmenu.h.

iGraphics2D* pawsMenu::graphics2d [protected]

Definition at line 322 of file pawsmenu.h.

list of menu items

Definition at line 292 of file pawsmenu.h.

Definition at line 305 of file pawsmenu.h.

target of OnMenuAction events

Definition at line 302 of file pawsmenu.h.

Definition at line 287 of file pawsmenu.h.

bool pawsMenu::sticky [protected]

Is the menu "stickied" on screen ? Stickied menu can only be closed by clicking on the closing button.

Definition at line 320 of file pawsmenu.h.

Definition at line 304 of file pawsmenu.h.

list of open submenus

Definition at line 297 of file pawsmenu.h.


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