gtkutil::PopupMenu Class Reference

#include <PopupMenu.h>

Data Structures

struct  MenuItem

Public Types

typedef bool(* SensitivityTest )(void)

Public Member Functions

 PopupMenu (GtkWidget *widget=NULL)
 ~PopupMenu ()
void addItem (GtkWidget *widget, GFunc callback, gpointer userData, SensitivityTest test=_alwaysVisible)
void show ()

Private Types

typedef std::list< MenuItemMenuItemList

Static Private Member Functions

static bool _alwaysVisible ()
static void _onActivate (GtkMenuItem *item, MenuItem *menuItem)
static gboolean _onClick (GtkWidget *w, GdkEventButton *e, PopupMenu *self)

Private Attributes

GtkWidget_menu
MenuItemList _menuItems

Detailed Description

A free pop-up menu populated with items and displayed on demand. Useful for right-click context menus.

Definition at line 15 of file PopupMenu.h.


Member Typedef Documentation

typedef std::list<MenuItem> gtkutil::PopupMenu::MenuItemList [private]

Definition at line 41 of file PopupMenu.h.

typedef bool(* gtkutil::PopupMenu::SensitivityTest)(void)

Definition at line 19 of file PopupMenu.h.


Constructor & Destructor Documentation

gtkutil::PopupMenu::PopupMenu ( GtkWidget widget = NULL  ) 

Default constructor.

Parameters:
widget Optional widget for which this menu should be a right-click popup menu. If not set to NULL, the PopupMenu will connect to the button-release-event on this widget and automatically display itself when a right-click is detected.
gtkutil::PopupMenu::~PopupMenu (  )  [inline]

Destructor.

Definition at line 83 of file PopupMenu.h.

References _menu.


Member Function Documentation

static bool gtkutil::PopupMenu::_alwaysVisible (  )  [inline, static, private]

Definition at line 51 of file PopupMenu.h.

static void gtkutil::PopupMenu::_onActivate ( GtkMenuItem item,
MenuItem menuItem 
) [inline, static, private]
static gboolean gtkutil::PopupMenu::_onClick ( GtkWidget w,
GdkEventButton *  e,
PopupMenu self 
) [static, private]
void gtkutil::PopupMenu::addItem ( GtkWidget widget,
GFunc  callback,
gpointer  userData,
SensitivityTest  test = _alwaysVisible 
)

Add an item to this menu using a widget and callback function.

Parameters:
widget The GtkWidget containing the displayed menu elements (i.e. icon and text).
callback A callback function to be invoked when this menu item is activated.
userData pointer to user data
test SensitivityTest function object to determine whether this menu item is currently visible.
void gtkutil::PopupMenu::show (  ) 

Show this menu. Each menu item's SensitivityTest will be invoked to determine whether it should be enabled or not, then the menu will be displayed.


Field Documentation

Definition at line 24 of file PopupMenu.h.

Referenced by ~PopupMenu().

Definition at line 42 of file PopupMenu.h.


The documentation for this class was generated from the following file:

Generated by  doxygen 1.6.2