Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site













SourceForge.net Logo

Bar

 

class Bar : public Ctrl

The abstract base class for MenuBar and ToolBar, also providing means to read keyboard accelerator keys from the Bar routines.

 

Derived from Ctrl

 

 

Public Member List

 

virtual bool IsEmpty() const = 0

Returns true if Bar is empty.

 


 

virtual void Separator() = 0

Adds a visual separator to the Bar.

 


 

static Item& NilItem()

Returns a reference to dummy item - all method calls on this item are ignored.

 


 

static bool Scan(Callback1<Bar&> proc, dword key)

Scans bar routines hierarchy testing for key accelerator. If any Item has this accelerator, associated action Callback of item is invoked and method returns true.

 


 

void Break()

This method breaks current bar line (or column) and starts a new one.

 


 

void Gap(int size = 8)

Adds a visual gap of size pixels to the Bar.

 


 

void GapRight()

Adds a gap that aligns the rest of items of the Bar line to the right size.

 


 

void Add(Ctrl& ctrl)

void Add(Ctrl& ctrl, Size sz)

void Add(Ctrl& ctrl, int cx, int cy = 0)

void Add(bool en, Ctrl& ctrl)

void Add(bool en, Ctrl& ctrl, Size sz)

void Add(bool en, Ctrl& ctrl, int cx, int cy = 0)

Adds a ctrl widget to the bar.

 

If the ctrl has defined horizontal/vertical logical position using LeftPos/TopPos, the non-zero size of logical position is used to define the size of widget in the Bar.  (in other words, you can set the size by calling SetRect(0, 0, width, height).

 

If either horizontal or vertical size of logical position is empty, non-zero cx cy method parameters are used.

 

If even any of them is zero (or not present in method declaration), GetMinSize() for ctrl is used. Enable(en) is called for the widget to enable or disable it.

 


 

Item& Add(bool enable, const char *text, const Upp::Image& image, const Callback& callback)

Item& Add(bool enable, KeyInfo& (*key)(), const Upp::Image& image, const Callback& callback)

Item& Add(const char *text, const Upp::Image& image, const Callback& callback)

Item& Add(KeyInfo& (*key)(), const Upp::Image& image, const Callback& callback)

Item& Add(bool enable, const char *text, const Callback& callback)

Item& Add(bool enable, KeyInfo& (*key)(), const Callback& callback)

Item& Add(const char *text, const Callback& callback)

Item& Add(KeyInfo& (*key)(), const Callback& callback)

Item& Add(bool enable, const char *text, const Upp::Image& image, const Function<void ()>& fn)

Item& Add(bool enable, KeyInfo& (*key)(), const Upp::Image& image, const Function<void ()>& fn)

Item& Add(const char *text, const Upp::Image& image, const Function<void ()>& fn)

Item& Add(KeyInfo& (*key)(), const Upp::Image& image, const Function<void ()>& fn)

Item& Add(bool enable, const char *text, const Function<void ()>& fn)

Item& Add(bool enable, KeyInfo& (*key)(), const Function<void ()>& fn)

Item& Add(const char *text, const Function<void ()>& fn)

Item& Add(KeyInfo& (*key)(), const Function<void ()>& fn)

Adds an item to menu or toolbar. If text is present, item is added to menu; if image is present, it is added to toolbar. If both are present, image is used as icon in menu too and text is used as toolbar button tooltip. When menu item is selected or toolbar button pushed, callback or fn is invoked. enable sets the item status and key is an accelerator key or adjustable accelerator info. All variants return a reference to Item which can be used to further adjust the item.

 


 

Item& Add(bool enable, const char *text, const Event<Bar&>& proc)

Item& Add(const char *text, const Event<Bar&>& proc)

Item& Add(bool enable, const char *text, const Upp::Image& image, const Event<Bar&>& proc)

Item& Add(const char *text, const Upp::Image& image, const Event<Bar&>& proc)

Item& Sub(bool enable, const char *text, const Function<void (Bar&)>& submenu)

Item& Sub(const char *text, const Function<void (Bar&)>& submenu)

Item& Sub(bool enable, const char *text, const Upp::Image& image, const Function<void (Bar&)>& submenu)

Item& Sub(const char *text, const Upp::Image& image, const Function<void (Bar&)>& submenu)

Adds a submenu. For toolbar, simply adds all items of submenu. enable sets the item status. Note that lambda variants (with Function) have to be named differently because of overloading issues.

 


 

void MenuSeparator()

void MenuBreak()

void MenuGap(int size = 8)

void MenuGapRight()

void AddMenu(Ctrl& ctrl)

void AddMenu(Ctrl& ctrl, Size sz)

void AddMenu(Ctrl& ctrl, int cx, int cy = 0)

Item& AddMenu(bool enable, const char *text, const Upp::Image& image, const Callback& callback)

Item& AddMenu(bool enable, KeyInfo& (*key)(), const Upp::Image& image, const Callback& callback)

Item& AddMenu(const char *text, const Upp::Image& image, const Callback& callback)

Item& AddMenu(const String& t, const Upp::Image& m, const Callback& c)

Item& AddMenu(KeyInfo& (*key)(), const Upp::Image& m, const Callback& c)

Item& AddMenu(bool enable, const char *text, const Upp::Image& image, const Function<void ()>& fn)

Item& AddMenu(bool enable, KeyInfo& (*key)(), const Upp::Image& image, const Function<void ()>& fn)

Item& AddMenu(const char *text, const Upp::Image& image, const Function<void ()>& fn)

Item& AddMenu(const String& t, const Upp::Image& m, const Function<void ()>& fn)

Item& AddMenu(KeyInfo& (*key)(), const Upp::Image& m, const Function<void ()>& fn)

These methods are equivalents to methods without Menu in the name, but perform respective operations only if Bar is menu.

 


 

void ToolSeparator()

void ToolBreak()

void ToolGap(int size = 8)

void ToolGapRight()

void AddTool(Ctrl& ctrl)

void AddTool(Ctrl& ctrl, Size sz)

void AddTool(Ctrl& ctrl, int cx, int cy = 0)

These methods are equivalents to methods without Tool in the name, but perform respective operations only if Bar is toolbar.

 


 

virtual void AddKey(dword key, Callback cb)

void AddKey(KeyInfo& (*key)(), Callback cb)

These variants do not add items to neither menu or toolbar, but do add accelerator keys.

 


 

virtual bool IsMenuBar() const

Returns true if Bar is menubar.

 


 

virtual bool IsToolBar() const

Returns true if Bar is toolbar.

 


 

virtual bool IsScanKeys() const

Returns true if Bar is only scanning the accelerator keys.

 

 

 

 

Bar::Item

 

struct Item

This structure is used to describe additional properties of individual bar items. Methods return *this to allow chaining of calls.

 

 

Public Member List

 

Bar::Item& Image(const UPP::Image& img)

Sets the image used with the item.

 


 

virtual Item& Text(const char *text)

virtual Item& Text(const String& text)

Sets the text of item.

 


 

virtual Item& Key(dword key)

Sets the accelerator key. Items can have more than single accelerator key (only the last one is displayed but all are active).

 


 

virtual Item& Repeat(bool repeat = true)

In repeat mode, action from ToolBar buttons is called repeatedly when mouse is hold down over them.

 


 

virtual Item& Check(bool check)

Makes the item "checked". Use with on/off option buttons or menu items.

 


 

virtual Item& Radio(bool check)

Makes the item "choosen". Similar to check, with visual style resembling Switch.

 


 

virtual Item& Enable(bool _enable = true)

Enables the item (default is enabled).

 


 

virtual Item& Bold(bool bold = true)

Sets bold text to menu item bold.

 


 

virtual Item& Tip(const char *tip)

Adds a tooltip to the ToolBar item.

 


 

virtual Item& Help(const char *help)

Adds a help line to the the item.

 


 

Item& Key(KeyInfo& (*key)())

Adds all keys from configurable accelerator info.

 

 

Last edit by cxl on 06/15/2016. Do you want to contribute?. T++