Status & Roadmap
Authors & License
Funding Ultimate++
Search on this site

SourceForge.net Logo



class MenuBar : public BarCtrl



This class provides the menu hierarchy. It can be used either as Frame or as regular Ctrl (in that case it represents top-level menu), or be pop-up as local menu (PopUp or Execute).



Public Method List


static int GetStdHeight(Font font = StdFont())

The height of top-level menu using the font.



void CloseMenu()

Forces closing any open sub-menus.



void Set(Callback1<Bar&> menu)

Sets the top-level menu. Use for top-level menu bars only.



void Post(Callback1<Bar&> bar)

Deprecated - do not use.



void PopUp(Ctrl *owner, Point p, Size rsz = Size(0, 0))

Pop-ups the menu at p in the owner view area. sz is the size of menu, if zero, needed size is computed. Menu can be defined by issuing individual Add methods before calling PopUp.



void PopUp(Point p)

Same as PopUp(GetActiveWindow(), p).



void PopUp()

Same as previous method, with p set to the current mouse position.



void Execute(Ctrl *owner, Point p)

Pop-ups the menu at p in the owner view area and performs the modal loop for it.



void Execute(Point p)

Same as Execute(GetActiveWindow(), p).



void Execute()

Same as previous method, with p set to the current mouse position.



static void Execute(Ctrl *owner, Callback1<Bar&> proc, Point p)

Pop-ups the menu based on proc.



static void Execute(Callback1<Bar&> proc, Point p)

Same as previous method, using GetActiveWindow() as owner.



static void Execute(Callback1<Bar&> proc)

Same as previous method, using current mouse position.



bool IsEmpty()

Returns true if MenuBar has no items.



virtual void Clear()

Removes all items from MenuBar.



MenuBar& LeftGap(int cx)

Minimum size reserved on the left side of menu items for icons in pixels. Default value is 16. Returns *this.



MenuBar& SetFont(Font f)

Sets the font to be used in MenuBar. Default is standard GUI font. Returns *this.



Font GetFont() const

Returns the font used in MenuBar.



MenuBar& MaxIconSize(Size sz)

Sets the maximum size of an iconn displaye inside a menu item to sz.



Size GetMaxIconSize() const

Returns the maximum icons size.



Last edit by cxl on 09/17/2012. Do you want to contribute?. T++