ubit::UPopmenu Class Reference

UPopmenu: Contextual Menu. More...

#include <umenu.hpp>

Inheritance diagram for ubit::UPopmenu:

ubit::UMenu ubit::UWin ubit::UBox ubit::UGroup ubit::UControl ubit::UBrick ubit::UObject ubit::UPiemenu ubit::UCtlmenu ubit::UCtlmenu3d List of all members.

Public Member Functions

 UPopmenu (const UArgs &a=UArgs::none)
 create a new Contextual menu.

Static Public Member Functions

static UStylecreateStyle ()
 < important: all subclasses MUST contain this declaration. static function that returns the UStyle of this class (see details!).

Friends

UPopmenuupopmenu (const UArgs &a=UArgs::none)
 shortcut that returns *new UPopmenu(a).

Detailed Description

UPopmenu: Contextual Menu.

In contrast with superclass UMenu, UPopmenu instances are not automatically opened when the mouse is pressed in one of their parents. Instead, one of their show() methods must be called explicitely as in the example below:

   UPopmenu& menu =                // a popup menu with 3 buttons
      upopmenu(ubutton(...) + ubutton(...) + ubutton(...));

   UBox& box = ubox(...);          // a widget that will open the menu
   UBox* btn = new UButton(...)    // another widget that will open the menu
   box.add(menu);                  // a menu MUST have at least one realized parent

   // the menu is opened when the mouse is pressed on the button
   btn->add(UOn::mpress / ucall(&menu, &UMenu::open));

   // the menu is opened when the mouse is pressed on the box by using
   // Button3 or Button1 with the Control modifier pressed
   box.add(UOn::mpress / ucall(&menu, openMenuCB));

   void openMenuCB(UMouseEvent& e, UPopmenu* m) {
     if (e.getButton() == e.RightButton
           || (e.getButton() == e.LeftButton && e.isControlDown()))
       m->open(e);
   }
 
Note: as other Ubit objects, popmenus MUST HAVE at least one parent.
See also:
also: UMenu, UWin.


Member Function Documentation

UStyle * ubit::UPopmenu::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::UMenu.

Reimplemented in ubit::UCtlmenu, and ubit::UPiemenu.


The documentation for this class was generated from the following files:
Generated on Mon Jan 29 00:20:52 2007 for Ubit by  doxygen 1.4.7