![]() |
![]() |
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::Slot3< void, int&, int&, bool& > | SlotPositionCalc |
void on_menu_position(int&, int&, bool& push_in); | |
Public Member Functions | |
virtual | ~Menu () |
GtkMenu* | gobj () |
Provides access to the underlying C GtkObject. | |
const GtkMenu* | gobj () const |
Provides access to the underlying C GtkObject. | |
Menu () | |
void | popup (MenuShell& parent_menu_shell, MenuItem& parent_menu_item, GtkMenuPositionFunc func, gpointer data, 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 (guint button, guint32 activate_time) |
Displays a menu and makes it available for selection. | |
void | reposition () |
void | popdown () |
MenuItem* | get_active () |
const MenuItem* | get_active () const |
void | set_active (guint index) |
void | set_accel_group (const Glib::RefPtr<AccelGroup>& accel_group) |
void | unset_accel_group () |
Glib::RefPtr<AccelGroup> | get_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 | detach () |
Widget* | get_attach_widget () |
const Widget* | get_attach_widget () const |
void | set_tearoff_state (bool torn_off=true) |
bool | get_tearoff_state () const |
Returns whether the menu is torn off. | |
void | set_title (const Glib::ustring& title) |
Sets the title string for the menu. | |
void | unset_title () |
Glib::ustring | get_title () const |
Returns the title of the menu. | |
void | set_screen (const Glib::RefPtr<Gdk::Screen>& screen) |
Sets the Gdk::Screen on which the menu will be displayed. | |
void | reorder_child (const MenuItem& child, int position) |
Glib::PropertyProxy<Glib::ustring> | property_tearoff_title () |
You rarely need to use properties because there are get_ and set_ methods for almost all of them. | |
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) |
|
void on_menu_position(int&, int&, bool& push_in);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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. The default menu positioning function will position the menu at the current pointer position.
|
|
Displays a menu and makes it available for selection.
|
|
Displays a menu and makes it available for selection.
Applications can use this function to display context-sensitive menus, and will typically supply 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.
|
|
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
|
|
|
|
Sets the Gdk::Screen on which the menu will be displayed. Since: 2.2
|
|
|
|
Sets the title string for the menu. The title is displayed when the menu is shown as a tearoff menu.
|
|
|
|
|
|
|