Guiliani  Version 2.4 revision 5970 (build 3)
CGUIMenuBar Class Reference

A horizontal menu bar. It can contain several Menu-items, which can open pulldown menus. More...

#include <GUIMenuBar.h>

Inheritance diagram for CGUIMenuBar:

Public Member Functions

 CGUIMenuBar (CGUICompositeObject *const pParent, const eC_Value &vX, const eC_Value &vY, const eC_Value &vWidth, const eC_Value &vHeight, const ObjectHandle_t &eID=NO_HANDLE)
 
 CGUIMenuBar (CGUICompositeObject *const pParent, const CGUIRect &kRect, const ObjectHandle_t &eID=NO_HANDLE)
 
 CGUIMenuBar ()
 
virtual ~CGUIMenuBar ()
 This destructor is automatically virtual, as the base class destructor is virtual.
 
eC_Bool AddItem (CGUIMenuItem *pBarItem, CGUIMenu *pMenu)
 
virtual eC_Bool DoClick (const eC_Value &vAbsX=eC_FromInt(-1), const eC_Value &vAbsY=eC_FromInt(-1))
 
virtual eC_Bool DoDraw ()
 
virtual eC_Bool DoMouseEnter (const eC_Value &vAbsX, const eC_Value &vAbsY)
 
virtual eC_Bool DoUserEvent (CGUIEvent *const pEvent)
 
virtual eC_Bool FourWayNext (FourWayFocus_t eFocusDirection)
 
virtual void GetFocus ()
 Customized focus handling which ensures that focus and selection handling works correctly within menus.
 
CGUIMenuAndItem GetFocussedMenuAndItem ()
 
virtual CGUIMenuBaseGetMenuBar ()
 
CGUIMenuAndItem GetSelectedMenuAndItem ()
 
eC_Bool IsObjBarItem (const CGUIObject *pObj) const
 
virtual void ReadFromStream ()
 
void ReleaseSelection ()
 Deselects any potentially selected item in the menu bar and automatically closes any related menus.
 
void RemoveItem (CGUIMenuItem *pMenuItem)
 
virtual void WriteToStream (const eC_Bool bWriteClassID=false)
 
- Public Member Functions inherited from CGUIMenuBase
eC_Bool AddItem (CGUIMenuItem *pMenuItem, CGUIMenu *pSubMenu=NULL, CGUIMenuItemSeparator *pItemSeparator=NULL)
 
virtual eC_Bool DoKeyDown (const GUIKeyIdentifier_t &eKeyIdentifier, const eC_UInt &uiModifiers)
 
virtual eC_Bool FocusAny ()
 
eC_Bool IsOpen ()
 
eC_Bool IsSubmenu () const
 
void RemoveItem (CGUIMenuItem *pMenuItem)
 
void SetBgImage (const ImageResource_t &eBgImage)
 
void SetIsSubmenu (const eC_Bool bIsSubmenu)
 
- Public Member Functions inherited from CGUIRepositionCompositeObject
 CGUIRepositionCompositeObject (CGUICompositeObject *const pParent, const eC_Value &vX, const eC_Value &vY, const eC_Value &vWidth, const eC_Value &vHeight, const CGUILayoutHelper::RepositionAlignment_t &eBasePoint=CGUILayoutHelper::REPOSITION_ALIGN_INVALID, const eC_Value &vGap=eC_FromInt(0), const ObjectHandle_t &eID=NO_HANDLE)
 
 CGUIRepositionCompositeObject (CGUICompositeObject *const pParent, const CGUIRect &kRect, const CGUILayoutHelper::RepositionAlignment_t &eBasePoint=CGUILayoutHelper::REPOSITION_ALIGN_INVALID, const eC_Value &vGap=eC_FromInt(0), const ObjectHandle_t &eID=NO_HANDLE)
 
 CGUIRepositionCompositeObject ()
 
virtual ~CGUIRepositionCompositeObject ()
 
eC_Value GetGap () const
 
void RepositionChildren ()
 
void SetBasePoint (CGUILayoutHelper::RepositionAlignment_t eNewBasePoint)
 
void SetBorder (const eC_Value vBorder)
 
void SetGap (const eC_Value vGap)
 
- Public Member Functions inherited from CGUICompositeObject
 CGUICompositeObject ()
 
 CGUICompositeObject (CGUICompositeObject *const pParent, const eC_Value &vX, const eC_Value &vY, const eC_Value &vWidth, const eC_Value &vHeight, const ObjectHandle_t &eID=NO_HANDLE)
 
 CGUICompositeObject (CGUICompositeObject *const pParent, const CGUIRect &kRect, const ObjectHandle_t &eID=NO_HANDLE)
 
 CGUICompositeObject (const CGUICompositeObject &kSource)
 
virtual ~CGUICompositeObject ()
 This destructor is automatically virtual, as the base class destructor is virtual.
 
eC_Bool BringToFront (const CGUIObject *pkObject)
 
eC_Bool CanBeCyclicFocussed () const
 
virtual eC_Bool DoPostDraw ()
 
void DrawOnTop (CGUIObject *pkObject)
 
void DrawOnTopOf (CGUIObject *const pkObject, CGUIObject *const pDrawOnTopOf)
 
virtual CGUIObjectFindObject (const eC_Value &vAbsX, const eC_Value &vAbsY)
 
void Flip (const eC_Bool &rbVertical)
 
virtual eC_Bool FocusNext (CGUIObject *const pRefObj=NULL, const eC_Bool &bSubTreeOfRefObjDone=false)
 
virtual eC_Bool FocusPrevious (CGUIObject *const pRefObj=NULL, const eC_Bool &bSubTreeOfRefObjDone=false)
 
const CGUIObjectGetAndCheckObjectByID (ObjectHandle_t eObjID, const eC_String &kObjectName) const
 
CGUIObjectGetAndCheckObjectByID (ObjectHandle_t eObjID, const eC_String &kObjectName)
 
CGUIObjectGetChild (const eC_UInt uIndex) const
 
CGUIObjectGetChild (const eC_UInt uIndex)
 
const ObjectPtrListGetChildObjectsList () const
 
const ObjectPtrListGetDrawOrderList () const
 
eC_Int GetIndexOfChild (const CGUIObject *pkObject) const
 
eC_UInt GetNumberOfChildren () const
 
CGUIObjectGetObjectByID (const ObjectHandle_t &eID, const eC_Bool &bOnlyVisible=false)
 
const CGUIObjectGetObjectByID (const ObjectHandle_t &eID, const eC_Bool &bOnlyVisible=false) const
 
eC_Bool InsertChildAt (const eC_UInt cuiIndex, CGUIObject *pkChild)
 
void InvalidateChildren ()
 Invalidates all chidren, but not this parent.
 
eC_Bool IsAncestorOf (const CGUIObject *pkObject) const
 
virtual eC_Bool IsCompositeObject () const
 
eC_Bool LowerOneLevel (const CGUIObject *pkObject)
 
CGUICompositeObjectoperator= (const CGUICompositeObject &kSource)
 
eC_Bool RaiseOneLevel (const CGUIObject *pkObject)
 
virtual void RefreshLayout (CGUILayouter::eMovedEdges_t eMovedEdges) const
 
void RemoveAllChildren ()
 
void Rotate (const eC_UInt &ruiDegrees, const eC_Bool &rbFirst=false)
 
eC_Bool SendToBack (const CGUIObject *pkObject)
 
virtual void SetClickThrough (const eC_Bool &bClickThrough)
 
virtual void SetClickThrough (const eC_Bool &bClickThrough, const eC_Bool &bChildrenClickThrough)
 
void SetCyclicFocus (const eC_Bool &bCyclicFocus)
 
virtual void SetDisabled (const eC_Bool &bDisabled)
 
virtual void SetDisabled (const eC_Bool &bDisabled, const eC_Bool &bChildrenDisabled)
 
virtual void SetFocussable (const eC_Bool &bFocussable)
 
virtual void SetFocussable (const eC_Bool &bFocussable, const eC_Bool &bChildrenFocussable)
 
virtual void SetGrayedOut (const eC_Bool &bGrayedOut)
 
virtual void SetGrayedOut (const eC_Bool &bGrayedOut, const eC_Bool &bChildrenGrayedOut)
 
virtual void SetHeight (const eC_Value &vY)
 
virtual void SetInvisible (const eC_Bool &bInvisible)
 
virtual void SetInvisible (const eC_Bool &bInvisible, const eC_Bool &bChildrenInvisible)
 
virtual void SetWidth (const eC_Value &vX)
 
- Public Member Functions inherited from CGUIObject
 CGUIObject (CGUICompositeObject *const pParent, const eC_Value &vX, const eC_Value &vY, const eC_Value &vWidth, const eC_Value &vHeight, const ObjectHandle_t &eID=NO_HANDLE)
 
 CGUIObject (CGUICompositeObject *const pParent, const CGUIRect &kRect, const ObjectHandle_t &eID=NO_HANDLE)
 
 CGUIObject ()
 
 CGUIObject (const CGUIObject &kSource)
 
virtual ~CGUIObject ()
 
void AddValueObserver (CGUIObserver *pObserver)
 
eC_Bool CalculateInvalidatedRect (CGUIRect &rRect) const
 
virtual eC_Bool ClaimFocus ()
 
virtual void CreateSnapshot (eC_UInt uiBackColor=0x00)
 
eC_Bool DataPoolConnectorExists () const
 
void DeleteSnapshot ()
 
virtual void DisableSnapshotDrawing (eC_Bool bDeleteSnapshot=true)
 
virtual eC_Bool DoDrawSnapshot ()
 
virtual void EnableSnapshotDrawing ()
 
CGUIRect GetAbsRect () const
 
eC_Value GetAbsXPos () const
 
eC_Value GetAbsXPosCenter () const
 
eC_Value GetAbsXPosREdge () const
 
eC_Value GetAbsYPos () const
 
eC_Value GetAbsYPosBEdge () const
 
eC_Value GetAbsYPosCenter () const
 
eC_UByte GetAlpha () const
 
CGUIBehaviourDecoratorGetBehaviour ()
 
const CGUIBehaviourDecoratorGetBehaviour () const
 
GUIBitmapPlaneID_t GetBitmapID () const
 
CGUIBitmapPlaneGetBitmapPlane () const
 
CGUIRect GetCurrentAbsRect () const
 
eC_Value GetCurrentAbsXPos () const
 
eC_Value GetCurrentAbsXPosCenter () const
 
eC_Value GetCurrentAbsXPosREdge () const
 
eC_Value GetCurrentAbsYPos () const
 
eC_Value GetCurrentAbsYPosBEdge () const
 
eC_Value GetCurrentAbsYPosCenter () const
 
CDataPoolConnectorGetDataPoolConnector ()
 
eC_Value GetDistanceBottom () const
 
eC_Value GetDistanceRight () const
 
eC_Value GetHalfHeight () const
 
eC_Value GetHalfWidth () const
 
eC_Value GetHeight () const
 
ObjectHandle_t GetID () const
 
CGUILayouterGetLayouter ()
 
const CGUILayouterGetLayouter () const
 
ObjectHandle_t GetNeighborBottomID () const
 
ObjectHandle_t GetNeighborLeftID () const
 
ObjectHandle_t GetNeighborRightID () const
 
ObjectHandle_t GetNeighborTopID () const
 
CGUIObjectGetObjectByID (const ObjectHandle_t &eID, const eC_Bool &bOnlyVisible=false)
 
const CGUIObjectGetObjectByID (const ObjectHandle_t &eID, const eC_Bool &bOnlyVisible=false) const
 
CGUIRect GetOriginRect () const
 
CGUICompositeObjectGetParent ()
 
const CGUICompositeObjectGetParent () const
 
CGUIRect GetRelRect () const
 
eC_Value GetRelXPos () const
 
eC_Value GetRelXPosCenter () const
 
eC_Value GetRelXPosREdge () const
 
eC_Value GetRelYPos () const
 
eC_Value GetRelYPosBEdge () const
 
eC_Value GetRelYPosCenter () const
 
eC_Value GetWidth () const
 
void InvalidateArea ()
 
eC_Bool IsClickable () const
 
eC_Bool IsClickThrough () const
 
eC_Bool IsDescendantOf (const CGUIObject *const pAncestor) const
 
eC_Bool IsDisabled () const
 
eC_Bool IsDragable () const
 
eC_Bool IsDragged () const
 
eC_Bool IsDrawingSnapshot () const
 
eC_Bool IsFocussable () const
 
eC_Bool IsFocussed () const
 
eC_Bool IsGrayedOut () const
 
virtual eC_Bool IsHighlightable () const
 
eC_Bool IsHighlighted () const
 
eC_Bool IsInvisible () const
 
eC_Bool IsPressed () const
 
eC_Bool IsStopFocus () const
 
void NotifyValueObservers (const CGUIValue &kValue, const eC_UInt uiX=0, const eC_UInt uiY=0)
 
CGUIObjectoperator= (const CGUIObject &kSource)
 
void RemoveValueObserver (CGUIObserver *pObserver)
 
void RenderToBitmap (eC_UInt uiBitmapID, eC_Value vXOffset=eC_FromInt(0), eC_Value vYOffset=eC_FromInt(0))
 
eC_Bool RequestFocus ()
 
void SetAlpha (eC_UByte ubAlpha)
 
void SetBehaviour (CGUIBehaviourDecorator *pBehaviour)
 
void SetClickThrough (const eC_Bool &bClickThrough)
 
void SetID (const ObjectHandle_t &eID)
 
void SetLayouter (CGUILayouter *pLayouter)
 
void SetNeighborBottomID (const ObjectHandle_t eNewNeighborBottomID)
 
void SetNeighborIDs (const ObjectHandle_t eNewNeighborLeftID, const ObjectHandle_t eNewNeighborRightID, const ObjectHandle_t eNewNeighborTopID, const ObjectHandle_t eNewNeighborBottomID)
 
void SetNeighborLeftID (const ObjectHandle_t eNewNeighborLeftID)
 
void SetNeighborRightID (const ObjectHandle_t eNewNeighborRightID)
 
void SetNeighborTopID (const ObjectHandle_t eNewNeighborTopID)
 
virtual void SetParent (CGUICompositeObject *const pParent)
 
void SetRelRect (const CGUIRect &kNewRect)
 
virtual void SetRelXPos (const eC_Value &vX)
 
void SetRelXPosCenter (const eC_Value &vXCenter)
 
void SetRelXPosREdge (const eC_Value &vX)
 
virtual void SetRelYPos (const eC_Value &vY)
 
void SetRelYPosBEdge (const eC_Value &vY)
 
void SetRelYPosCenter (const eC_Value &vYCenter)
 
void SetStopFocus (const eC_Bool &bDontFocusToParent)
 
virtual eC_Bool SetValue (const CGUIValue &rkValue)
 
virtual eC_Bool SetValue (CDataPoolEntry &rkValue)
 
- Public Member Functions inherited from CGUIBehaviour
virtual void OnCreate ()
 
virtual void OnDelete ()
 
virtual void OnHide ()
 
virtual void OnShow ()
 
virtual eC_Bool DoLongClick (const eC_Value &vAbsX=eC_FromInt(-1), const eC_Value &vAbsY=eC_FromInt(-1))
 
virtual eC_Bool DoDoubleClick (const eC_Value &vAbsX=eC_FromInt(-1), const eC_Value &vAbsY=eC_FromInt(-1))
 
virtual eC_Bool DoButtonDown (const eC_Value &vAbsX=eC_FromInt(-1), const eC_Value &vAbsY=eC_FromInt(-1))
 
virtual eC_Bool DoButtonUp (const eC_Value &vAbsX=eC_FromInt(-1), const eC_Value &vAbsY=eC_FromInt(-1))
 
virtual eC_Bool DoDrag (const eC_Value &vDeltaX=eC_FromInt(-1), const eC_Value &vDeltaY=eC_FromInt(-1), const eC_Value &vAbsX=eC_FromInt(-1), const eC_Value &vAbsY=eC_FromInt(-1))
 
virtual eC_Bool DoDragEnd (const eC_Value &vAbsX=eC_FromInt(-1), const eC_Value &vAbsY=eC_FromInt(-1))
 
virtual eC_Bool DoMouseLeave (const eC_Value &vAbsX=eC_FromInt(-1), const eC_Value &vAbsY=eC_FromInt(-1))
 
virtual eC_Bool DoMouseMove (const eC_Value &vAbsX=eC_FromInt(-1), const eC_Value &vAbsY=eC_FromInt(-1))
 
virtual void LoseFocus ()
 
virtual eC_Bool Decrease ()
 
virtual eC_Bool Increase ()
 
virtual eC_Bool DoKeyUp (const GUIKeyIdentifier_t &eKeyIdentifier, const eC_UInt &uiModifiers)
 
virtual eC_Bool DoChar (const eC_UInt &uiKey, const GUIKeyIdentifier_t &eKeyIdentifier, const eC_UInt &uiModifiers)
 
virtual eC_Bool DoScrollUp (const eC_Value &vAbsX, const eC_Value &vAbsY)
 
virtual eC_Bool DoScrollDown (const eC_Value &vAbsX, const eC_Value &vAbsY)
 
virtual eC_Bool DoScrollLeft (const eC_Value &vAbsX, const eC_Value &vAbsY)
 
virtual eC_Bool DoScrollRight (const eC_Value &vAbsX, const eC_Value &vAbsY)
 
- Public Member Functions inherited from CGUIStreamableObject
const eC_String & GetXMLTag () const
 
void SetXMLTag (const eC_String &kXMLTag)
 
- Public Member Functions inherited from CGUIAnimatable
virtual ~CGUIAnimatable ()
 Destructor. Removes all existing animation callbacks.
 
virtual void DoAnimate (const eC_Value &vTimes=eC_FromInt(1))
 
virtual eC_Bool IsAnimating () const
 
virtual void StartAnimation ()
 
virtual void StopAnimation ()
 

Protected Member Functions

void CloseMenu ()
 
void OpenMenu (CGUIMenu *pMenu, CGUIMenuItem *pBarItem)
 
- Protected Member Functions inherited from CGUIMenuBase
 CGUIMenuBase (CGUICompositeObject *const pParent, const eC_Value &vX, const eC_Value &vY, const eC_Value &vWidth, const eC_Value &vHeight, const CGUILayoutHelper::RepositionAlignment_t eBasePoint, const ObjectHandle_t &eID=NO_HANDLE)
 
 CGUIMenuBase (CGUICompositeObject *const pParent, const CGUIRect &kRect, const CGUILayoutHelper::RepositionAlignment_t eBasePoint, const ObjectHandle_t &eID=NO_HANDLE)
 
 CGUIMenuBase ()
 
void Init ()
 Initialization helper.
 
void SelectMenuItem (CGUIMenuItem *pMenuItem)
 
- Protected Member Functions inherited from CGUICompositeObject
ObjectPtrListGetChildObjectsList ()
 
virtual void HandleDraw (const CGUIRect &ClipRect)
 
- Protected Member Functions inherited from CGUIObject
virtual eC_Bool CreateBitmapPlane ()
 
- Protected Member Functions inherited from CGUIStreamableObject
eC_UInt ReadStreamingHeader (const eC_UInt &uiClassVersion, const eC_UInt &uiClassMinVersion=0) const
 
void WriteStreamingFooter (const eC_Bool &bWriteClassID) const
 
void WriteStreamingHeader (const eC_Bool &bWriteClassID, const eC_Char *const pkClassIDTag, const eC_Int &iClassID, const eC_UInt &uiClassVersion) const
 

Additional Inherited Members

- Public Types inherited from CGUIObject
enum  FourWayFocus_t { FOCUS_LEFT, FOCUS_RIGHT, FOCUS_UP, FOCUS_DOWN }
 
- Static Public Attributes inherited from CGUICompositeObject
static const eC_Char XMLTAG_CHILDREN [] = "Children"
 XML comment tag to be used before writing children to a stream.
 
static const eC_Char XMLTAG_ENDCHILDREN [] = "/Children"
 XML comment tag to be used after writing children to a stream.
 
- Static Public Attributes inherited from CGUIObject
static const eC_Char XMLTAG_ALPHA [] = "Alpha"
 XML tag to be used writing alpha-value into a stream.
 
static const eC_Char XMLTAG_CLICKTHROUGH [] = "ClickThrough"
 XML tag to be used writing clickthrough-state into a stream.
 
static const eC_Char XMLTAG_CONTROLCLASSID [] = "ControlClassID"
 XML tag to be used when writing a control class ID into a stream.
 
static const eC_Char XMLTAG_DISABLED [] = "Disabled"
 XML tag to be used writing disabled-state into a stream.
 
static const eC_Char XMLTAG_FOCUSSABLE [] = "Focussable"
 XML tag to be used writing focussable-state into a stream.
 
static const eC_Char XMLTAG_GRAYEDOUT [] = "GrayedOut"
 XML tag to be used writing grayedout-state into a stream.
 
static const eC_Char XMLTAG_HEIGHT [] = "Height"
 XML tag to be used writing height into a stream.
 
static const eC_Char XMLTAG_INVISIBLE [] = "Invisible"
 XML tag to be used writing invisible-state into a stream.
 
static const eC_Char XMLTAG_OBJECTID [] = "ObjectID"
 XML tag to be used writing object id into a stream.
 
static const eC_Char XMLTAG_OVERRIDDENNEIGHBORS [] = "OverriddenNeighbors"
 XML tag to be used writing overridden neighbors into a stream.
 
static const eC_Char XMLTAG_WIDTH [] = "Width"
 XML tag to be used writing width into a stream.
 
static const eC_Char XMLTAG_XPOS [] = "XPos"
 XML tag to be used writing x-position into a stream.
 
static const eC_Char XMLTAG_YPOS [] = "YPos"
 XML tag to be used writing y-position into a stream.
 
- Static Public Attributes inherited from CGUIBehaviour
static const eC_Char XMLTAG_BEHAVIOURCLASSID [] = "BehaviourClassID"
 XML tag to be used when writing a behaviour class ID into a stream.
 
- Static Public Attributes inherited from CGUIStreamableObject
static const eC_Char XMLTAG_CLASSVERSION [] = "ClassVersion"
 
- Protected Attributes inherited from CGUIMenuBase
eC_Bool m_bIsSubmenu
 Indicate whether the menu is a submenu or not.
 
ImageResource_t m_eBgImage
 Background image for this menu.
 
eC_Int m_iSelectedIndex
 The index of the selected item in the m_kSubMenuItemList.
 
CGUIMenuAndItem::MenuAndItemList m_kMenuItemList
 The list stores the menu item pointer, item separator and corresponding submenu pointer, if available.
 
CGUIMenuBasem_pkObjOpensThisMenu
 

Detailed Description

A horizontal menu bar. It can contain several Menu-items, which can open pulldown menus.

The menu bar has a list that contains several CGUIMenuAndItem objects which contain a bar item and its corresponding menu if available. In order to add menu items and menus to the menu bar, please use the AddItem method.

If a menu item is clicked, the corresponding menu (if available) is opened and the menu bar's position, width and height are adjusted to be the same as its parent. After the menu is closed, the menu bar is changed back to be the original position, width and height.

  • Focussing CGUIMenuBar implements a specific focusing behaviour in its FourWayNext method. It intercepts FOCUS_UP and FOCUS_DOWN events and will open the currently selected menu in response to them.
  • DoClick Clicking on a menu item will open the corresponding menu (if any)
  • DoMouseEnter CGUIMenuBar overrides the DoMouseEnter slot in order to enhance usability by mouse. Moving the mouse across menu items will move the focus and selection as well, if the focus already was inside the menu.

Example:

// The following code creates a basic menubar with two menus, of which the second one has a submenu.
// The fully expanded menu will look roughly like this:
// [ BAR1 ] [ BAR2 ]
// [ ITEM1 ]
// [ SUBMENU ] [ ITEM2 ]
// [ ITEM3 ]
// Create a menu bar.
CGUIMenuBar *pkMenuBar = new CGUIMenuBar(this,
eC_FromInt(0), eC_FromInt(0),
eC_FromInt(300), eC_FromInt(20),
NO_HANDLE);
// Add first bar item and a menu.
CGUIMenuItem *pkBarItem1 = new CGUIMenuItem(NULL,
eC_FromInt(0), eC_FromInt(0),
eC_FromInt(100), eC_FromInt(20),
eC_FromInt(0), eC_FromInt(0),
eC_FromInt(50), eC_FromInt(0),
"bar1",
NULL, // Replace NULL with your command.
NO_HANDLE);
// Set text into a centered position
pkBarItem1->GetLabel()->SetRelXPos(eC_FromInt(20));
// Set menu item standard images
pkBarItem1->SetStandardImages();
// Create menu element
CGUIMenu *pkMenu1 = new CGUIMenu(NULL,
eC_FromInt(0), eC_FromInt(0),
eC_FromInt(100), eC_FromInt(0));
// Add menu element to menu bar 1
pkMenuBar->AddItem(pkBarItem1, pkMenu1);
// Create second menu bar
CGUIMenuItem *pkBarItem2 = new CGUIMenuItem(NULL,
eC_FromInt(0), eC_FromInt(0),
eC_FromInt(100), eC_FromInt(20),
eC_FromInt(0), eC_FromInt(0),
eC_FromInt(50), eC_FromInt(0),
"bar2",
NULL, // Replace NULL with your command.
NO_HANDLE);
// Set text into a centered poristion
pkBarItem2->GetLabel()->SetRelXPos(eC_FromInt(20));
// Set menu bar standard images
pkBarItem2->SetStandardImages();
// Create menu element
CGUIMenu *pkMenu2 = new CGUIMenu(NULL,
eC_FromInt(0), eC_FromInt(0),
eC_FromInt(100), eC_FromInt(0),
NO_HANDLE);
// Create first item for the menu element
CGUIMenuItem *pkMenuItem1 = new CGUIMenuItem(NULL,
eC_FromInt(0), eC_FromInt(0),
eC_FromInt(100), eC_FromInt(20),
eC_FromInt(0), eC_FromInt(0),
eC_FromInt(50), eC_FromInt(0),
"item1",
NULL, // Replace NULL with your command.
NO_HANDLE);
// Set text into a centered position
pkMenuItem1->GetLabel()->SetRelXPos(eC_FromInt(20));
// Set menu item standard images
pkMenuItem1->SetStandardImages();
// Create a menu item separator into the new menu
CGUIMenuItemSeparator* pkMenuItemSeparator = new CGUIMenuItemSeparator(NULL,
eC_FromInt(0), eC_FromInt(0),
eC_FromInt(100), eC_FromInt(0),
NO_HANDLE);
// Add two items and a separator into Menu2
pkMenu2->AddItem(pkMenuItem1, NULL, pkMenuItemSeparator);
// Add menu2 into the menu bar
pkMenuBar->AddItem(pkBarItem2, pkMenu2);
// Add third bar item and a menu.
CGUIMenuItem *pkSubMenuItem = new CGUIMenuItem(NULL,
eC_FromInt(0), eC_FromInt(0),
eC_FromInt(100), eC_FromInt(20),
eC_FromInt(0), eC_FromInt(0),
eC_FromInt(50), eC_FromInt(0),
"Submenu",
NULL, // Replace NULL with your command.
NO_HANDLE);
// Set text into a centered position
pkSubMenuItem->GetLabel()->SetRelXPos(eC_FromInt(20));
// Set menu item standard images
pkSubMenuItem->SetStandardImages();
// Create new menu element
CGUIMenu *pkMenu3 = new CGUIMenu(NULL,
eC_FromInt(0), eC_FromInt(0),
eC_FromInt(100), eC_FromInt(0),
NO_HANDLE);
// Add menu element to menu bar
pkMenu2->AddItem(pkSubMenuItem, pkMenu3);
// Create new item for the menu element
CGUIMenuItem *pkMenuItem2 = new CGUIMenuItem(NULL,
eC_FromInt(0), eC_FromInt(0),
eC_FromInt(100), eC_FromInt(20),
eC_FromInt(0), eC_FromInt(0),
eC_FromInt(50), eC_FromInt(0),
"item2",
NULL, // Replace NULL with your command.
NO_HANDLE);
// Set text into a centered position
pkMenuItem2->GetLabel()->SetRelXPos(eC_FromInt(20));
// Set menu item standard images
pkMenuItem2->SetStandardImages();
// Add menu item into menu element
pkMenu3->AddItem(pkMenuItem2, NULL);
// Create a menu item for the menu
CGUIMenuItem *pkMenuItem3 = new CGUIMenuItem(NULL,
eC_FromInt(0), eC_FromInt(0),
eC_FromInt(100), eC_FromInt(20),
eC_FromInt(0), eC_FromInt(0),
eC_FromInt(50), eC_FromInt(0),
"item3",
NULL, // Replace NULL with your command.
NO_HANDLE);
// Set text into a centered position
pkMenuItem3->GetLabel()->SetRelXPos(eC_FromInt(20));
// Set menu item standard images
pkMenuItem3->SetStandardImages();
// Add menu item into menu element
pkMenu3->AddItem(pkMenuItem3, NULL);
// Set the background image.
// Before calling this method, please add an image id to GUIImageResource.h or UserImageResource.h.
// After that call GETRESMANAGER.RegisterImageResource method to register an image for image id.
pkMenuBar->SetBgImage(IMG_MENUBAR_BACKGND);

Constructor & Destructor Documentation

◆ CGUIMenuBar() [1/3]

CGUIMenuBar::CGUIMenuBar ( CGUICompositeObject *const  pParent,
const eC_Value &  vX,
const eC_Value &  vY,
const eC_Value &  vWidth,
const eC_Value &  vHeight,
const ObjectHandle_t eID = NO_HANDLE 
)

CGUIMenuBar constructor.

Parameters
pParentPointer to the designated parent object.
vXX-position relative to its parent object
vYY-position relative to its parent object
vWidthWidth of the CGUIMenuBar object
vHeightHeight of the CGUIMenuBar object
eIDObject Identifier of this composite object (choose NO_HANDLE if none is required)

◆ CGUIMenuBar() [2/3]

CGUIMenuBar::CGUIMenuBar ( CGUICompositeObject *const  pParent,
const CGUIRect kRect,
const ObjectHandle_t eID = NO_HANDLE 
)

CGUIMenuBar constructor.

Parameters
pParentPointer to the designated parent object.
kRectBounding rectangle relative to parent.
eIDObject Identifier of this CGUIMenuBar object (choose NO_HANDLE if none is required)

◆ CGUIMenuBar() [3/3]

CGUIMenuBar::CGUIMenuBar ( )

CGUIMenuBar standard constructor.

See also
CGUIObject().

Member Function Documentation

◆ AddItem()

eC_Bool CGUIMenuBar::AddItem ( CGUIMenuItem pBarItem,
CGUIMenu pMenu 
)

Add an item

See also
CGUIMenuBase::AddItem()
Parameters
pBarItemItem to add
pMenuMenu to add to
Returns
True if successful, False otherwise

◆ CloseMenu()

void CGUIMenuBar::CloseMenu ( )
protected

Closes a main menu. The position, width and height of the control are changed back to their original values.

◆ DoClick()

eC_Bool CGUIMenuBar::DoClick ( const eC_Value &  vAbsX = eC_FromInt(-1),
const eC_Value &  vAbsY = eC_FromInt(-1) 
)
virtual

Called when the object receives a click event. A click can e.g., be the result of a mouse click, a finger press/release sequence on touchscreens, or be triggered by a GK_ACTION keyboard event.

Note
DoClick() should work on the absolute positions of this object, that were set at the time of the passed redraw, as the user expects to click on what he sees and not to click on an object in a newer and probably intermediate state that he currently does not see. Thus, to calculate the relative position (where the mouse button was pressed and released at the same position for in a certain time span, relative to the origin of this object) from the vAbsY argument you must do it like this: vMyRelYPos = vAbsY - GetAbsYPos().
Parameters
vAbsXX-position in screen coordinates where the click occurred
vAbsYY-position in screen coordinates where the click occurred
Returns
True The event has been handled.
False The event has not been handled. In this base implementation it always returns False.

Reimplemented from CGUIBehaviour.

◆ DoDraw()

eC_Bool CGUIMenuBar::DoDraw ( )
virtual

The image is always stretched to the original size of this control, regardless of the current size that might be adjusted to match an opened menu.

Returns
True if something was painted, otherwise False.

Reimplemented from CGUIMenuBase.

◆ DoMouseEnter()

eC_Bool CGUIMenuBar::DoMouseEnter ( const eC_Value &  vAbsX,
const eC_Value &  vAbsY 
)
virtual

Specific DoMouseenter implementation to enhance usability by mouse

Parameters
vAbsXX-position in screen coordinates where the mouse entered the object
vAbsYY-position in screen coordinates where the mouse entered the object
Returns
True If the event has been handled.
False Else.

Reimplemented from CGUIBehaviour.

◆ DoUserEvent()

eC_Bool CGUIMenuBar::DoUserEvent ( CGUIEvent *const  pEvent)
virtual

This reimplementation of DoUserEvent will close any currently opened menus if an event of type ET_LBUTTONDOWN on any object outside of the menubar is received Slot for handling of arbitrary user events. Override this slot to catch any incoming event before it is dealt with by standard handlers.

Be aware that DoUserEvent() will be called on the currently focused object for all incoming events! This means for instance that your focused object (and its parents) will also receive events of type ET_LBUTTONDOWN when the user is clicking somewhere else on the screen.

Note
If DoUserEvent returns true, this will prevent any further handling of this event. i.e. If your implementation returns true for ET_MOUSEMOVE events received by this object, this will prevent any calls to the framework's standard DoMouseMove(), DoMouseEnter(), DoMouseLeave() slots.
Parameters
pEventThe event to be processed.
Returns
True If the event has been handled.
false Else.

Reimplemented from CGUIBehaviour.

◆ FourWayNext()

eC_Bool CGUIMenuBar::FourWayNext ( FourWayFocus_t  eFocusDirection)
virtual

Helper function. Declared protected because you may want to add extra functionality to this function in a derived class and then call the base implementation afterwards. Called when the focus should be set to the next control that is to the given direction of the currently focused object. Please use CGUI::FourWayFocusNext() if you want to focus the next control that is in the specific direction of the currently focused object and not this function.

Returns
If true, then the algorithm breaks immediately and will have no effect. Thus, custom controls may override this function slot in order to set the focus to a specific control and afterwards force the 4-way navigation algorithm to stop. The automatism will always return False.
Parameters
eFocusDirectionThe focus direction
See also
CGUI::FourWayFocusNext()

Reimplemented from CGUICompositeObject.

◆ GetFocussedMenuAndItem()

CGUIMenuAndItem CGUIMenuBar::GetFocussedMenuAndItem ( )

Returns the menu item within the menu bar which is currently focused. If none is focused, a dummy menu item is returned: CGUIMenuAndItem kDummy(NULL, NULL)

Returns
The menu and item

◆ GetMenuBar()

virtual CGUIMenuBase* CGUIMenuBar::GetMenuBar ( )
inlinevirtual

Get menu-bar

Returns
menu-bar

Reimplemented from CGUIMenuBase.

◆ GetSelectedMenuAndItem()

CGUIMenuAndItem CGUIMenuBar::GetSelectedMenuAndItem ( )

Returns the menu item within the menu bar which is currently selected. If there is a menu open, the corresponding menu item will always be selected. If none is selected, a dummy menu item is returned: CGUIMenuAndItem kDummy(NULL, NULL)

Returns
The menu and item

◆ IsObjBarItem()

eC_Bool CGUIMenuBar::IsObjBarItem ( const CGUIObject pObj) const

Check whether the given object is a bar item.

Parameters
pObjThe given object pointer.
Returns
True, if the given object is a bar item; False otherwise.

◆ OpenMenu()

void CGUIMenuBar::OpenMenu ( CGUIMenu pMenu,
CGUIMenuItem pBarItem 
)
protected

Opens a main menu. The position, width and height of the control are changed to be the same as the parent's.

Parameters
pMenuMenu to be opened.
pBarItemItem whose bounding rectangle is used as a reference for placing the menu on screen.

◆ ReadFromStream()

void CGUIMenuBar::ReadFromStream ( )
virtual

Reads composite object attributes and children from stream. Reads attributes from the streaming file. Only for use with GUIFactoryManager.

See also
CGUIObject::ReadFromStream()
Exceptions
CGUIStreamingControlExceptionWhen catching a CGUIStreamingControlException from a child, this method adds the object from the exception, resets the object pointer to 'this', then re-throws.

Reimplemented from CGUIMenuBase.

◆ RemoveItem()

void CGUIMenuBar::RemoveItem ( CGUIMenuItem pMenuItem)

Remove a menu item

Parameters
pMenuItemItem to remove

◆ WriteToStream()

void CGUIMenuBar::WriteToStream ( const eC_Bool  bWriteClassID = false)
virtual

Writes all object attributes to the streaming file. StreamWriter has to be initialized. Only for use with GUIStreamWriter.

Parameters
bWriteClassIDThis flag is used to select if writing of ControlID, leading and trailing tags is performed. Only GUIStreamWriter and GUICompositeObject have to set this flag true.
See also
CGUIStreamWriter

Reimplemented from CGUIMenuBase.


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