fltk::PopupMenu Class Reference

Inherits fltk::Menu.

List of all members.

Public Types

enum  {
  NORMAL, POPUP1, POPUP2, POPUP12,
  POPUP3, POPUP13, POPUP23, POPUP123
}

Public Member Functions

int handle (int)
int popup ()
 PopupMenu (int, int, int, int, const char *=0)

Static Public Attributes

static NamedStyledefault_style

Protected Member Functions

void draw ()


Detailed Description

This subclass pops up a menu in response to a user click. The menu is popped up positioned so that the mouse is pointing at the last-selected item, even if it in a nested submenu (To turn off this behaivor do value(-1) after each item is selected)

menu_button.gif

Normally any mouse button will pop up a menu and it is lined up above the button, or below it when there is no previous selected value as shown in the picture.

However a PopupMenu can also have type() set to POPUP1, POPUP2, POPUP12, POPUP3, POPUP13, POPUP23, or POPUP123. It then becomes invisible and ignores all mouse buttons other than the ones named in the popup type. You can then resize it to cover another widget (or many widgets) so that pressing that button pops up the menu.

The menu will also pop up in response to shortcuts indicated by the shortcut() or by putting '&x' in the label().

Typing the fltk::Widget::shortcut() of any menu items will cause it to be picked. The callback will be done but there will be no visible effect to the widget.


Member Function Documentation

int PopupMenu::popup (  ) 

Wrapper for Menu::popup(). For NORMAL PopupMenu this places the menu over the widget. For POPUP ones it uses the mouse position and sets the "title" to the label() if it is not null.

References fltk::event_x(), fltk::event_y(), fltk::Rectangle::h(), fltk::Rectangle::Rectangle(), fltk::Widget::type(), and fltk::Rectangle::w().

void PopupMenu::draw ( void   )  [protected, virtual]


Wed Jun 17 08:45:39 2009. FLTK ©2007 Bill Spitzak and others.
Permission is granted to reproduce this manual or any portion for any purpose, provided this copyright and permission notice are preserved.