ubit::UPiemenu Class Reference

Pie menu. More...

#include <upiemenu.hpp>

Inheritance diagram for ubit::UPiemenu:

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

Public Types

 CONCENTRIC
 COMPOUND
 MULTISTROKE
enum  MenuStyle { CONCENTRIC, COMPOUND, MULTISTROKE }

Public Member Functions

 UPiemenu (const UArgs &=UArgs::none)
virtual UBoxitem (int n)
 gets or creates the Nth item in the menu.
virtual UBoxgetItem (int n) const
 gets the Nth item in the menu.
virtual UBoxgetSelectedItem () const
 returns the item that is currently selected (null if none).
virtual int getSelectedIndex () const
 returns the index of item that is currently selected (-1 if none).
virtual UBoxcreateItem ()
 called internally to create a new pie item (can be redefined).
virtual void open (UMouseEvent &e)
 non-overloaded synonym for show(UMouseEvent&,x,y).
virtual void show (bool state, UDisp *)
virtual void show (bool state=true)
 shows/hides the menu immediately (
virtual void show (UMouseEvent &e, float x=0, float y=0)
 moves the menu to the event location then shows it after a delay (if expert mode is allowed).
virtual void show (UMouseEvent &, float x, float y, UTime delay)
 moves the menu to the event location then shows after the delay is given as an argument.
UTime getShowDelay () const
 returns the delay before the menu is opened (default = 300 ms)
void setShowDelay (UTime d)
 changes the delay before the menu is opened (default = 300 ms)
void setMenuStyle (int)
virtual void addSubMenu (int N, UPiemenu *submenu)
 adds a submenu to this menu.
void setPieAlpha (UAlpha &a)
void setPieColor (UColor &c)
void setPieBorderColor (UColor &c)
void setSliceColor (UColor &c)
void setCenterColor (UColor &c)
void setCenterBorderColor (UColor &c)
 note that these fonctions do NOT copy their argument (which must NOT be freed).
int getCenterRadius () const
 returns the radius of the rest area.
void setCenterRadius (int d)
 changes the radius of the rest area.
int getItemRadius () const
 returns the radius of the items from the center.
void setItemRadius (int d)
 changes the radius of the items from the center.
UWingetContainingWin (UDisp *=null) const
 returns the window where the menu is currently opened.
UPoint getCenterInContainingWin (UDisp *=null) const
 returns the location of the menu center from the origin of getContainingWin().
const UPoint & getLastDrag () const
 returns the location of the last DRAG event from the location of the ARM event.
UScalegetScale ()
float getScaleValue ()
virtual void pressCB (UMouseEvent &)
 [impl] called when the mouse is pressed.
virtual void releaseCB (UMouseEvent &)
 [impl] called when the mouse is released.
virtual void motionCB (UMouseEvent &)
 [impl] called when the mouse is dragged.
virtual void hideCB (UEvent &)
 [impl] called when the mouse is hidden.
virtual void paintCB (UPaintEvent &)
 [impl] called when the menu is repainted.
virtual void resizeCB (UEvent &)
 [impl] called when the menu is resized.
virtual void armItemCB (UMouseEvent &e, UPiemenu *submenu)
 [impl] called when an item is armed.
virtual void disarmItemCB (UMouseEvent &e, UPiemenu *submenu)
 [impl] called when an item is disarmed.
virtual float getCentredCoords (UMouseEvent &e, UPoint &p, bool &must_forward)
 [impl] tranforms events coords to centred coords.
virtual void reset (UMouseEvent *)
 [impl] called when the menu is reset by show().
virtual void startNoviceMode ()
 [impl] starts the novide mode: called by show().
virtual void forwardToMenu (UPiemenu *submenu)
 [impl]
virtual void receiveFromMenu (UPiemenu *supermenu)
 [impl]
virtual void unlinkFromAndToMenus ()
 [impl].
virtual void closeMenus (UMouseEvent &e, bool)
 [impl] tsts lavamenu.

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

UPiemenuupiemenu (const UArgs &a=UArgs::none)

Detailed Description

Pie menu.

Pie menus can have up to 8 items that are counted from 0 to 7 in anticlockwise order, starting from the right direction of the x axis. Pie menus can be nested by using the addSubMenu() method.

See also:
: show() methods and UPopmenu class to see how to open menus

also: UCtlmenu subclass for creating control menus.

Event management: each menu item can have callbacks that are fired on these conditions:

Item callbacks can have a UMouseEvent argument.

Example:

   class Demo {
   public:
       void cut();
       void copy();
       void paste();
       ....
   };

   Demo* d = new Demo();
   UPiemenu* pmenu = new UPiemenu();

   pmenu->item(0)->addlist("Cut" + UOn::action / ucall(d, &Demo::cut))
   pmenu->item(1)->addlist("Copy" + UOn::action / ucall(d, &Demo::copy))
   pmenu->item(2)->addlist("Paste" + UOn::action / ucall(d, &Demo::paste))
 
See also:
also: UCall


Member Function Documentation

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

Reimplemented in ubit::UCtlmenu.

UBox * ubit::UPiemenu::getItem ( int  n  )  const [virtual]

gets the Nth item in the menu.

N must be a valid value (

See also:
UPiemenu), null is returned otherwise. The item is NOT created if it does not exist.

also: item(int n);

UBox * ubit::UPiemenu::item ( int  n  )  [virtual]

gets or creates the Nth item in the menu.

N must be a valid value (

See also:
UPiemenu), null is returned otherwise. The item is created implicitely if it does not exist.

also: getItem(int n);

void ubit::UPiemenu::setCenterBorderColor ( UColor c  ) 

note that these fonctions do NOT copy their argument (which must NOT be freed).

as a consquence, changing the args value will also change the menu appearance. args can be null in which case the style default is used.

void ubit::UPiemenu::setCenterRadius ( int  d  ) 

changes the radius of the rest area.

items are armed when the cursor crosses the rest zone border.

void ubit::UPiemenu::show ( UMouseEvent ,
float  x,
float  y,
UTime  delay 
) [virtual]

moves the menu to the event location then shows after the delay is given as an argument.

the menu is shown immediately if delay = 0.

See also:
: show(UMouseEvent&, float x, float y), UMenu::show(bool state).

virtual void ubit::UPiemenu::show ( UMouseEvent e,
float  x = 0,
float  y = 0 
) [virtual]

moves the menu to the event location then shows it after a delay (if expert mode is allowed).

the delay can be changed by setShowDelay().

See also:
: show(UMouseEvent, UTime delay), UMenu::show(bool state).

Reimplemented from ubit::UMenu.

virtual void ubit::UPiemenu::show ( bool  state = true  )  [virtual]

shows/hides the menu immediately (

See also:
: UMenu::show(bool state)).

Reimplemented from ubit::UMenu.


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