PixelLightAPI  .
Classes | Protected Member Functions | Protected Attributes
PLGui::AbstractMenu Class Reference

Abstract base class for widgets that display a menu. More...

#include <AbstractMenu.h>

Inheritance diagram for PLGui::AbstractMenu:
Inheritance graph
[legend]

List of all members.

Classes

struct  SItem
 Position and state data for a menu item. More...

Protected Member Functions

virtual PLGUI_API void OnItemClicked (MenuItem *pItem)
 Called when a menu item has been clicked.
virtual PLGUI_API PLMath::Vector2i OnPreferredSize (const PLMath::Vector2i &vRefSize) const override
 Called when the widget is to calculate it's preferred size.
virtual PLGUI_API void OnMouseMove (const PLMath::Vector2i &vPos) override
 Called when the mouse is moved within the widget or captured by it.
virtual PLGUI_API void OnMouseButtonDown (PLCore::uint32 nButton, const PLMath::Vector2i &vPos) override
 Called when a mouse button is pressed.
virtual PLGUI_API void OnMouseButtonUp (PLCore::uint32 nButton, const PLMath::Vector2i &vPos) override
 Called when a mouse button is released.
virtual PLGUI_API void OnKeyDown (PLCore::uint32 nKey, PLCore::uint32 nModifiers) override
 Called when a key was pressed.
virtual PLGUI_API void OnGetFocus () override
 Called when the widget gets the keyboard focus.
virtual PLGUI_API void OnLooseFocus () override
 Called when the widget looses the keyboard focus.
PLGUI_API void OpenSubmenu (MenuItem *pItem, int nItem)
 Open submenu.
PLGUI_API void CloseSubmenu ()
 Close submenu.
PLGUI_API void PressShortcut (char nShortcut)
 Activate menu shortcut.
PLGUI_API void UpdateMenuData ()
 Update menu data.
PLGUI_API void DeleteMenuData ()
 Delete menu data.
PLGUI_API int GetItemFromMousePos (const PLMath::Vector2i &vPos)
 Check which item is selected based on mouse position.
PLGUI_API void SetControlledMenu (AbstractMenu *pMenu)
 Set currently active menu in the chain of sub-menus.
PLGUI_API PLMath::Vector2i CalculateItemSize (EOrientation nOrientation, MenuItem *pItem)
 Calculate size of menu item.

Protected Attributes

Menum_pMenu
EOrientation m_nOrientation
ESide m_nOpenSideHorizontal
ESide m_nOpenSideVertical
int m_nSelection
SItemm_pItems
int m_nItems
int m_nSize
int m_nMaxWidth
int m_nMouseOver
MenuItemm_pSelectedItem
PopupMenum_pPopupMenu
int m_nIgnoreMouse
AbstractMenum_pParentMenu
AbstractMenum_pController
AbstractMenum_pControlMenu
bool m_bAllowButtonUp

Detailed Description

Abstract base class for widgets that display a menu.


Member Function Documentation

virtual PLGUI_API void PLGui::AbstractMenu::OnItemClicked ( MenuItem pItem) [protected, virtual]

Called when a menu item has been clicked.

Parameters:
[in]pItemMenu item
virtual PLGUI_API PLMath::Vector2i PLGui::AbstractMenu::OnPreferredSize ( const PLMath::Vector2i vRefSize) const [override, protected, virtual]

Called when the widget is to calculate it's preferred size.

Parameters:
[in]vRefSizePrecalculated reference size, can be (-1, -1) if no reference size is available
Returns:
Preferred size
Remarks:
If the widget returns -1 in a component (X/Y), it means that there is no preferred size in that direction. A layout will in that case use 'as much space as possible', while the FitSize() functions will use the current size.

Reimplemented from PLGui::Widget.

Reimplemented in PLGui::MenuBar.

virtual PLGUI_API void PLGui::AbstractMenu::OnMouseMove ( const PLMath::Vector2i vPos) [override, protected, virtual]

Called when the mouse is moved within the widget or captured by it.

Parameters:
[in]vPosMouse position within the widget

Reimplemented from PLGui::WidgetFunctions.

virtual PLGUI_API void PLGui::AbstractMenu::OnMouseButtonDown ( PLCore::uint32  nButton,
const PLMath::Vector2i vPos 
) [override, protected, virtual]

Called when a mouse button is pressed.

Parameters:
[in]nButtonMouse button that is pressed
[in]vPosMouse position within the widget

Reimplemented from PLGui::WidgetFunctions.

virtual PLGUI_API void PLGui::AbstractMenu::OnMouseButtonUp ( PLCore::uint32  nButton,
const PLMath::Vector2i vPos 
) [override, protected, virtual]

Called when a mouse button is released.

Parameters:
[in]nButtonMouse button that is released
[in]vPosMouse position within the widget

Reimplemented from PLGui::WidgetFunctions.

virtual PLGUI_API void PLGui::AbstractMenu::OnKeyDown ( PLCore::uint32  nKey,
PLCore::uint32  nModifiers 
) [override, protected, virtual]

Called when a key was pressed.

Parameters:
[in]nKeyPressed key
[in]nModifiersModifier keys pressed
Note:
  • Because of a possible autorepeat the key may be 'pressed' multiple times before the 'OnKeyUp'-function is called

Reimplemented from PLGui::WidgetFunctions.

virtual PLGUI_API void PLGui::AbstractMenu::OnGetFocus ( ) [override, protected, virtual]

Called when the widget gets the keyboard focus.

Reimplemented from PLGui::WidgetFunctions.

virtual PLGUI_API void PLGui::AbstractMenu::OnLooseFocus ( ) [override, protected, virtual]

Called when the widget looses the keyboard focus.

Reimplemented from PLGui::WidgetFunctions.

PLGUI_API void PLGui::AbstractMenu::OpenSubmenu ( MenuItem pItem,
int  nItem 
) [protected]

Open submenu.

Parameters:
[in]pItemMenu item
[in]nItemMenu item index
PLGUI_API void PLGui::AbstractMenu::CloseSubmenu ( ) [protected]

Close submenu.

PLGUI_API void PLGui::AbstractMenu::PressShortcut ( char  nShortcut) [protected]

Activate menu shortcut.

Parameters:
[in]nShortcutASCII value of shortcut
PLGUI_API void PLGui::AbstractMenu::UpdateMenuData ( ) [protected]

Update menu data.

PLGUI_API void PLGui::AbstractMenu::DeleteMenuData ( ) [protected]

Delete menu data.

PLGUI_API int PLGui::AbstractMenu::GetItemFromMousePos ( const PLMath::Vector2i vPos) [protected]

Check which item is selected based on mouse position.

Parameters:
[in]vPosCurrent mouse position
Returns:
Index of selected item, -1 if none
PLGUI_API void PLGui::AbstractMenu::SetControlledMenu ( AbstractMenu pMenu) [protected]

Set currently active menu in the chain of sub-menus.

Parameters:
[in]pMenuMenu that shall be controlled by the keyboard
PLGUI_API PLMath::Vector2i PLGui::AbstractMenu::CalculateItemSize ( EOrientation  nOrientation,
MenuItem pItem 
) [protected]

Calculate size of menu item.

Parameters:
[in]nOrientationOrientation
[in]pItemMenu item
Returns:
Size

Member Data Documentation

Menu that is displayed

Menu orientation

Side on which a submenu is opened (horizontal)

Side on which a submenu is opened (vertical)

Currently selected item

Items

Size of m_pItems

Size of all items

Max width of all items

Index of currently selected item

Currently open item

Currently open submenu

Ignore mouse-move events for n times

Menu widget that has opened this menu widget

Menu widget that has the control (focus)

Menu that is currently controlled by the keyboard

Only right after popup, the release of the mouse button can cause a click-event


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


PixelLight PixelLight 0.9.11-R1
Copyright (C) 2002-2012 by The PixelLight Team
Last modified Thu Feb 23 2012 14:09:33
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported