ubit::UCtlmenu Class Reference
Control menu.
More...
#include <uctlmenu.hpp>
Inheritance diagram for ubit::UCtlmenu:
List of all members.
|
Public Member Functions |
| UCtlmenu (const UArgs &=UArgs::none) |
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 |
UCtlmenu & | uctlmenu (const UArgs &args=UArgs::none) |
Detailed Description
Control menu.
a control menu makes it possible to select an operation then to control one or two continous values in a single gesture. Control menus have to modes:
- novice mode: the user presses the mouse and waits for getShowDelay() msec. The menu appears and the user selects one of the menu items by dragging the mouse. When the mouse reaches this item, it is selected and the menu disappears. The user can then control one or two values (that correspond to the horizontal and vertical directions) by dragging the mouse.
- expert mode: the user performs the same gesture, but faster so that he does not wait for getShowDelay() msec. The same actions are performed except that the menu does not show up.
- See also:
- : UPiemenu class for inherited methods.
Event management:
- each menu item can have callbacks as explained in UPiemenu class
- a major difference with UPiemenus(s) is that items cannot be deselected one they have been selected by dragging the mouse inside their area
- callbacks are fired in the same way in the expert and novice mode. The only difference is that the menu does not appear in expert mode. In novice mode, the menu disappears when an item is selected.
- UCtlAction class and its subclasses can be used to make code simpler. A UCtlAction object has a mdrag() method that is called when the mouse is dragged as shown in the example below:
class Demo {
public:
void scrollMore(UMouseEvent& e);
....
};
Demo* d = new Demo();
UCtlmenu* cmenu = new UCtlmenu();
// scrollMore() is fired if item(0) has been selected and the mouse
// is being dragged (even if it is now outside of item(0))
cmenu->item(0)->addlist(" Scroll More "
+ UOn::mdrag / ucall(this, &Demo::scrollMore))
// here we use the predefined UScrollAction class (that derives from
// UCtlAction) to perform the same kind of behavior in a simpler way
UScrollAction* a = new UScrollAction(...);
cmenu->item(4)->addlist(" Scroll Less " + *a)
Member Function Documentation
UStyle * ubit::UCtlmenu::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:
- classid() : a static function that returns this UClass
- getClass() : a virtual function that returns this UClass
- See also:
- : class UClass, macro UBIT_ELEMENT_CLASS(). this function MUST be redefined by subclasses that use another UStyle.
Reimplemented from ubit::UPiemenu.
The documentation for this class was generated from the following files:
Generated on Mon Jan 29 00:20:47 2007 for Ubit by
1.4.7