#include <umenu.hpp>
Inheritance diagram for ubit::UMenu:
Public Member Functions | |
UMenu (const UArgs &a=UArgs::none) | |
creates a new pulldown (or cascaded) Menu. | |
virtual class UMenu * | menuCast () |
dynamic cast. | |
virtual void | show (bool state, UDisp *) |
virtual void | show (bool state=true) |
shows/hides the menu. | |
virtual void | show (UMouseEvent &, float x=0, float y=0) |
moves the menu to the event location then shows it ( show(bool state)). | |
virtual void | open (UMouseEvent &e) |
non-overloaded synonym for show(UMouseEvent&,x,y). | |
virtual void | setPlacement (const UPlacement &) |
specifies automatic placement rules (see UPlacement). | |
virtual bool | realize () |
[impl] initializes the window and its children. | |
Static Public Member Functions | |
static UStyle * | createStyle () |
< important: all subclasses MUST contain this declaration. static function that returns the UStyle of this class (see details!). | |
Friends | |
UMenu & | umenu (const UArgs &args=UArgs::none) |
shortcut that returns *new UMenu(args). |
use subclass UPopmenu to create contextual menus.
A UMenu is automatically opened when the mouse is pressed in one of its parents. This rule does not apply to UPopmenu instances: they must be opened by calling one of their show() methods.
Note that most methods are inherited from UWin and that a UMenu must have at least one realized parent (as for other Ubit widgets).
umenubar( ubutton("Menu 1" + umenu( ubutton("aaa") + ubutton("bbb") )) + ubutton("Menu 2" + umenu( ulabel("xxx") + ucheckbox("ccc") )) )
UStyle * ubit::UMenu::createStyle | ( | ) | [static] |
< important: all subclasses MUST contain this declaration. static function that returns the UStyle of this class (see details!).
this macro defines the UClass that corresponds to this class and:
Reimplemented from ubit::UWin.
Reimplemented in ubit::UCtlmenu, ubit::UPopmenu, and ubit::UPiemenu.
bool ubit::UMenu::realize | ( | ) | [virtual] |
[impl] initializes the window and its children.
this function called when the window is shown for the first time
Reimplemented from ubit::UWin.
void ubit::UMenu::setPlacement | ( | const UPlacement & | ) | [virtual] |
specifies automatic placement rules (see UPlacement).
update() must be called to enforce new rules
virtual void ubit::UMenu::show | ( | bool | state = true |
) | [virtual] |
shows/hides the menu.
Note that:
Note: show(true) grabs the mouse. The application can be launched with option --no-grab to disable this behavior (this is mostly useful for debugging)
Reimplemented from ubit::UWin.
Reimplemented in ubit::UPiemenu.