GTK+ Reference Manual | |||
---|---|---|---|
<<< Previous Page | Home | Up | Next Page >>> |
GObject +----GtkObject +----GtkWidget +----GtkContainer +----GtkBin +----GtkItem +----GtkMenuItem |
"activate" void user_function (GtkMenuItem *menuitem, gpointer user_data); "activate-item" void user_function (GtkMenuItem *menuitem, gpointer user_data); "toggle-size-allocate" void user_function (GtkMenuItem *menuitem, gint arg1, gpointer user_data); "toggle-size-request" void user_function (GtkMenuItem *menuitem, gpointer arg1, gpointer user_data); |
The GtkMenuItem widget and the derived widgets are the only valid childs for menus. Their function is to correctly handle highlighting, alignment, events and submenus.
As it derives from GtkBin it can hold any valid child widget, altough only a few are really useful.
GtkWidget* gtk_menu_item_new (void); |
Creates a new GtkMenuItem.
Returns : | the newly created GtkMenuItem |
GtkWidget* gtk_menu_item_new_with_label (const gchar *label); |
Creates a new GtkMenuItem whose child is a GtkLabel.
label : | the text for the label |
Returns : | the newly created GtkMenuItem |
GtkWidget* gtk_menu_item_new_with_mnemonic (const gchar *label); |
Creates a new GtkMenuItem containing a label. The label will be created using gtk_label_new_with_mnemonic(), so underscores in label indicate the mnemonic for the menu item.
label : | The text of the button, with an underscore in front of the mnemonic character |
Returns : | a new GtkMenuItem |
void gtk_menu_item_set_right_justified (GtkMenuItem *menu_item, gboolean right_justified); |
Sets whether the menu item appears justified at the right side of a menu bar. This was traditionally done for "Help" menu items, but is now considered a bad idea. (If the widget layout is reversed for a right-to-left language like Hebrew or Arabic, right-justified-menu-items appear at the left.)
menu_item : | a GtkMenuItem. |
right_justified : | if TRUE the menu item will appear at the far right if added to a menu bar. |
void gtk_menu_item_set_submenu (GtkMenuItem *menu_item, GtkWidget *submenu); |
Sets the widget submenu, or changes it.
void gtk_menu_item_set_accel_path (GtkMenuItem *menu_item, const gchar *accel_path); |
Set the accelerator path on menu_item, through which runtime changes of the menu item's accelerator caused by the user can be identified and saved to persistant storage (see gtk_accel_map_save() on this). To setup a default accelerator for this menu item, call gtk_accel_map_add_entry() with the same accel_path. See also gtk_accel_map_add_entry() on the specifics of accelerator paths, and gtk_menu_set_accel_path() for a more convenient variant of this function.
This function is basically a convenience wrapper that handles calling gtk_widget_set_accel_path() with the appropriate accelerator group for the menu item.
menu_item : | a valid GtkMenuItem |
accel_path : | accelerator path, corresponding to this menu item's functionality |
void gtk_menu_item_remove_submenu (GtkMenuItem *menu_item); |
Removes the widget's submenu.
void gtk_menu_item_select (GtkMenuItem *menu_item); |
Emits the "select" signal on the given item. Behaves exactly like gtk_item_select.
void gtk_menu_item_deselect (GtkMenuItem *menu_item); |
Emits the "deselect" signal on the given item. Behaves exactly like gtk_item_deselect.
void gtk_menu_item_activate (GtkMenuItem *menu_item); |
Emits the "activate" signal on the given item
void gtk_menu_item_toggle_size_request (GtkMenuItem *menu_item, gint *requisition); |
Emits the "toggle_size_request" signal on the given item.
void gtk_menu_item_toggle_size_allocate (GtkMenuItem *menu_item, gint allocation); |
Emits the "toggle_size_allocate" signal on the given item.
#define gtk_menu_item_right_justify(menu_item) gtk_menu_item_set_right_justified ((menu_item), TRUE) |
Warning |
gtk_menu_item_right_justify is deprecated and should not be used in newly-written code. |
Sets the menu item to be right-justified. Only useful for menu bars.
gboolean gtk_menu_item_get_right_justified (GtkMenuItem *menu_item); |
Gets whether the menu item appears justified at the right side of the menu bar.
menu_item : | a GtkMenuItem |
Returns : | TRUE if the menu item will appear at the far right if added to a menu bar. |
GtkWidget* gtk_menu_item_get_submenu (GtkMenuItem *menu_item); |
Gets the submenu underneath this menu item, if any. See gtk_menu_item_set_submenu().
menu_item : | a GtkMenuItem |
Returns : | submenu for this menu item, or NULL if none. |
void user_function (GtkMenuItem *menuitem, gpointer user_data); |
Emitted when the item is activated.
void user_function (GtkMenuItem *menuitem, gpointer user_data); |
Emitted when the item is activated, but also if the menu item has a submenu. For normal applications, the relevant signal is "activate".
void user_function (GtkMenuItem *menuitem, gint arg1, gpointer user_data); |
void user_function (GtkMenuItem *menuitem, gpointer arg1, gpointer user_data); |
for how to handle the child.
is the abstract class for all sorts of items.
is always the parent of GtkMenuItem.