![]() |
![]() |
Menus are normally placed inside a Gtk::MenuBar or another MenuItem as a sub menu. A Menu can also be popped up, for instance as a right-click context menu, by calling the popup() method. See also Gtk::OptionMenu.
Public Types | |
typedef sigc::slot< void, int&, int&, bool& > | SlotPositionCalc |
For instance, void on_popup_menu_position(int& x, int& y, bool& push_in);. | |
Public Member Functions | |
void | attach (Gtk::Widget& child, guint left_attach, guint right_attach, guint top_attach, guint bottom_attach) |
Adds a new Gtk::MenuItem to a (table) menu. | |
void | detach () |
Glib::RefPtr<const AccelGroup> | get_accel_group () const |
Glib::RefPtr<AccelGroup> | get_accel_group () |
const MenuItem* | get_active () const |
MenuItem* | get_active () |
const Widget* | get_attach_widget () const |
Widget* | get_attach_widget () |
bool | get_tearoff_state () const |
Returns whether the menu is torn off. | |
Glib::ustring | get_title () const |
Returns the title of the menu. | |
const GtkMenu* | gobj () const |
Provides access to the underlying C GtkObject. | |
GtkMenu* | gobj () |
Provides access to the underlying C GtkObject. | |
Menu () | |
void | popdown () |
void | popup (guint button, guint32 activate_time) |
Displays a menu and makes it available for selection. | |
void | popup (const SlotPositionCalc& position_calc_slot, guint button, guint32 activate_time) |
Displays a menu and makes it available for selection. | |
void | popup (MenuShell& parent_menu_shell, MenuItem& parent_menu_item, const SlotPositionCalc& slot, guint button, guint32 activate_time) |
Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_tearoff_title () const |
A title that may be displayed by the window manager when this menu is torn-off. | |
Glib::PropertyProxy<Glib::ustring> | property_tearoff_title () |
A title that may be displayed by the window manager when this menu is torn-off. | |
void | reorder_child (const MenuItem& child, int position) |
void | reposition () |
void | set_accel_group (const Glib::RefPtr<AccelGroup>& accel_group) |
void | set_accel_path (const Glib::ustring& accel_path) |
Sets an accelerator path for this menu from which accelerator paths for its immediate children, its menu items, can be constructed. | |
void | set_active (guint index) |
void | set_monitor (int monitor_num) |
Informs GTK+ on which monitor a menu should be popped up. | |
void | set_screen (const Glib::RefPtr<Gdk::Screen>& screen) |
Sets the Gdk::Screen on which the menu will be displayed. | |
void | set_tearoff_state (bool torn_off=true) |
void | set_title (const Glib::ustring& title) |
Sets the title string for the menu. | |
void | unset_accel_group () |
void | unset_title () |
virtual | ~Menu () |
Protected Types | |
typedef void(* | GtkMenuDetachFunc )(GtkWidget* attach_widget, GtkMenu* menu) |
Protected Member Functions | |
void | attach_to_widget (Widget& widget, GtkMenuDetachFunc detacher) |
Related Functions | |
(Note that these are not member functions.) | |
Gtk::Menu* | wrap (GtkMenu* object, bool take_copy=false) |
|
|
|
For instance, void on_popup_menu_position(int& x, int& y, bool& push_in);.
|
|
|
|
|
|
Adds a new Gtk::MenuItem to a (table) menu. The number of 'cells' that an item will occupy is specified by left_attach , right_attach , top_attach and bottom_attach . These each represent the leftmost, rightmost, uppermost and lower column and row numbers of the table. (Columns and rows are indexed from zero). Note that this function is not related to detach().
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Returns whether the menu is torn off. See set_tearoff_state().
|
|
Returns the title of the menu. See set_title().
|
|
Provides access to the underlying C GtkObject.
Reimplemented from Gtk::MenuShell. |
|
Provides access to the underlying C GtkObject.
Reimplemented from Gtk::MenuShell. |
|
|
|
Displays a menu and makes it available for selection. Applications can use this function to display context-sensitive menus, at the current pointer position.
|
|
Displays a menu and makes it available for selection. Applications can use this function to display context-sensitive menus. The button parameter should be the mouse button pressed to initiate the menu popup. If the menu popup was initiated by something other than a mouse button press, such as a mouse button release or a keypress, button should be 0. The activate_time parameter should be the time stamp of the event that initiated the popup. If such an event is not available, use gtk_get_current_event_time() instead.
|
|
|
|
A title that may be displayed by the window manager when this menu is torn-off. You rarely need to use properties because there are get_ and set_ methods for almost all of them.
|
|
A title that may be displayed by the window manager when this menu is torn-off. You rarely need to use properties because there are get_ and set_ methods for almost all of them.
|
|
|
|
|
|
|
|
Sets an accelerator path for this menu from which accelerator paths for its immediate children, its menu items, can be constructed.
The main purpose of this function is to spare the programmer the inconvenience of having to call Gtk::MenuItem::set_accel_path() on each menu item that should support runtime user changable accelerators. Instead, by just calling set_accel_path() on their parent, each menu item of this menu, that contains a label describing its purpose, automatically gets an accel path assigned. For example, a menu containing menu items "New" and "Exit", will, after
|
|
|
|
Informs GTK+ on which monitor a menu should be popped up. See gdk_screen_get_monitor_geometry(). This function should be called from a Gtk::MenuPositionFunc if the menu should not appear on the same monitor as the pointer. This information can't be reliably inferred from the coordinates returned by a Gtk::MenuPositionFunc, since, for very long menus, these coordinates may extend beyond the monitor boundaries or even the screen boundaries.
|
|
Sets the Gdk::Screen on which the menu will be displayed.
|
|
|
|
Sets the title string for the menu. The title is displayed when the menu is shown as a tearoff menu.
|
|
|
|
|
|
|