Synopsis#include <gtk/gtk.h> GtkToolbar; enum GtkToolbarChildType; enum GtkToolbarSpaceStyle; GtkToolbarChild; GtkWidget* gtk_toolbar_new (void); void gtk_toolbar_insert (GtkToolbar *toolbar, GtkToolItem *item, gint pos); gint gtk_toolbar_get_item_index (GtkToolbar *toolbar, GtkToolItem *item); gint gtk_toolbar_get_n_items (GtkToolbar *toolbar); GtkToolItem* gtk_toolbar_get_nth_item (GtkToolbar *toolbar, gint n); gint gtk_toolbar_get_drop_index (GtkToolbar *toolbar, gint x, gint y); void gtk_toolbar_set_drop_highlight_item (GtkToolbar *toolbar, GtkToolItem *tool_item, gint index_); void gtk_toolbar_set_show_arrow (GtkToolbar *toolbar, gboolean show_arrow); void gtk_toolbar_set_orientation (GtkToolbar *toolbar, GtkOrientation orientation); void gtk_toolbar_set_tooltips (GtkToolbar *toolbar, gboolean enable); void gtk_toolbar_unset_icon_size (GtkToolbar *toolbar); gboolean gtk_toolbar_get_show_arrow (GtkToolbar *toolbar); GtkOrientation gtk_toolbar_get_orientation (GtkToolbar *toolbar); GtkToolbarStyle gtk_toolbar_get_style (GtkToolbar *toolbar); GtkIconSize gtk_toolbar_get_icon_size (GtkToolbar *toolbar); gboolean gtk_toolbar_get_tooltips (GtkToolbar *toolbar); GtkReliefStyle gtk_toolbar_get_relief_style (GtkToolbar *toolbar); GtkWidget* gtk_toolbar_append_item (GtkToolbar *toolbar, const char *text, const char *tooltip_text, const char *tooltip_private_text, GtkWidget *icon, GtkSignalFunc callback, gpointer user_data); GtkWidget* gtk_toolbar_prepend_item (GtkToolbar *toolbar, const char *text, const char *tooltip_text, const char *tooltip_private_text, GtkWidget *icon, GtkSignalFunc callback, gpointer user_data); GtkWidget* gtk_toolbar_insert_item (GtkToolbar *toolbar, const char *text, const char *tooltip_text, const char *tooltip_private_text, GtkWidget *icon, GtkSignalFunc callback, gpointer user_data, gint position); void gtk_toolbar_append_space (GtkToolbar *toolbar); void gtk_toolbar_prepend_space (GtkToolbar *toolbar); void gtk_toolbar_insert_space (GtkToolbar *toolbar, gint position); GtkWidget* gtk_toolbar_append_element (GtkToolbar *toolbar, GtkToolbarChildType type, GtkWidget *widget, const char *text, const char *tooltip_text, const char *tooltip_private_text, GtkWidget *icon, GtkSignalFunc callback, gpointer user_data); GtkWidget* gtk_toolbar_prepend_element (GtkToolbar *toolbar, GtkToolbarChildType type, GtkWidget *widget, const char *text, const char *tooltip_text, const char *tooltip_private_text, GtkWidget *icon, GtkSignalFunc callback, gpointer user_data); GtkWidget* gtk_toolbar_insert_element (GtkToolbar *toolbar, GtkToolbarChildType type, GtkWidget *widget, const char *text, const char *tooltip_text, const char *tooltip_private_text, GtkWidget *icon, GtkSignalFunc callback, gpointer user_data, gint position); void gtk_toolbar_append_widget (GtkToolbar *toolbar, GtkWidget *widget, const char *tooltip_text, const char *tooltip_private_text); void gtk_toolbar_prepend_widget (GtkToolbar *toolbar, GtkWidget *widget, const char *tooltip_text, const char *tooltip_private_text); void gtk_toolbar_insert_widget (GtkToolbar *toolbar, GtkWidget *widget, const char *tooltip_text, const char *tooltip_private_text, gint position); void gtk_toolbar_set_style (GtkToolbar *toolbar, GtkToolbarStyle style); GtkWidget* gtk_toolbar_insert_stock (GtkToolbar *toolbar, const gchar *stock_id, const char *tooltip_text, const char *tooltip_private_text, GtkSignalFunc callback, gpointer user_data, gint position); void gtk_toolbar_set_icon_size (GtkToolbar *toolbar, GtkIconSize icon_size); void gtk_toolbar_remove_space (GtkToolbar *toolbar, gint position); void gtk_toolbar_unset_style (GtkToolbar *toolbar); Object HierarchyGObject +----GInitiallyUnowned +----GtkObject +----GtkWidget +----GtkContainer +----GtkToolbar Properties"icon-size" GtkIconSize : Read / Write "icon-size-set" gboolean : Read / Write "orientation" GtkOrientation : Read / Write "show-arrow" gboolean : Read / Write "toolbar-style" GtkToolbarStyle : Read / Write "tooltips" gboolean : Read / Write Style Properties"button-relief" GtkReliefStyle : Read "internal-padding" gint : Read "max-child-expand" gint : Read "shadow-type" GtkShadowType : Read "space-size" gint : Read "space-style" GtkToolbarSpaceStyle : Read Signals"focus-home-or-end" : Run Last / Action "orientation-changed" : Run First "popup-context-menu" : Run Last "style-changed" : Run First Description
A toolbar is created with a call to
A toolbar can contain instances of a subclass of GtkToolItem. To add
a GtkToolItem to the a toolbar, use Toolbar items can be visually grouped by adding instances of GtkSeparatorToolItem to the toolbar. If a GtkSeparatorToolItem has the "expand" property set to TRUE and the "draw" property set to FALSE the effect is to force all following items to the end of the toolbar. Creating a context menu for the toolbar can be done by connecting to the "popup-context-menu" signal. DetailsGtkToolbartypedef struct { gint GSEAL (num_children); GList *GSEAL (children); GtkOrientation GSEAL (orientation); GtkToolbarStyle GSEAL (style); GtkIconSize GSEAL (icon_size); #ifndef GTK_DISABLE_DEPRECATED GtkTooltips *GSEAL (tooltips); #else gpointer GSEAL (_tooltips); #endif } GtkToolbar; The GtkToolbar struct only contains private data and should only be accessed through the function described below. enum GtkToolbarChildTypetypedef enum { GTK_TOOLBAR_CHILD_SPACE, GTK_TOOLBAR_CHILD_BUTTON, GTK_TOOLBAR_CHILD_TOGGLEBUTTON, GTK_TOOLBAR_CHILD_RADIOBUTTON, GTK_TOOLBAR_CHILD_WIDGET } GtkToolbarChildType; Warning
GtkToolbarChildType is used to set the type of new elements that are added to a GtkToolbar.
enum GtkToolbarSpaceStyletypedef enum { GTK_TOOLBAR_SPACE_EMPTY, GTK_TOOLBAR_SPACE_LINE } GtkToolbarSpaceStyle;
GtkToolbarChildtypedef struct { GtkToolbarChildType type; GtkWidget *widget; GtkWidget *icon; GtkWidget *label; } GtkToolbarChild; Warning
gtk_toolbar_new ()GtkWidget* gtk_toolbar_new (void); Creates a new toolbar.
gtk_toolbar_insert ()void gtk_toolbar_insert (GtkToolbar *toolbar, GtkToolItem *item, gint pos);
Insert a GtkToolItem into the toolbar at position
Since 2.4 gtk_toolbar_get_item_index ()gint gtk_toolbar_get_item_index (GtkToolbar *toolbar, GtkToolItem *item);
Returns the position of
Since 2.4 gtk_toolbar_get_n_items ()gint gtk_toolbar_get_n_items (GtkToolbar *toolbar); Returns the number of items on the toolbar.
Since 2.4 gtk_toolbar_get_nth_item ()GtkToolItem* gtk_toolbar_get_nth_item (GtkToolbar *toolbar, gint n);
Returns the
Since 2.4 gtk_toolbar_get_drop_index ()gint gtk_toolbar_get_drop_index (GtkToolbar *toolbar, gint x, gint y);
Returns the position corresponding to the indicated point on
Since 2.4 gtk_toolbar_set_drop_highlight_item ()void gtk_toolbar_set_drop_highlight_item (GtkToolbar *toolbar, GtkToolItem *tool_item, gint index_);
Highlights
The
Since 2.4 gtk_toolbar_set_show_arrow ()void gtk_toolbar_set_show_arrow (GtkToolbar *toolbar, gboolean show_arrow);
Sets whether to show an overflow menu when
Since 2.4 gtk_toolbar_set_orientation ()void gtk_toolbar_set_orientation (GtkToolbar *toolbar, GtkOrientation orientation); Sets whether a toolbar should appear horizontally or vertically.
gtk_toolbar_set_tooltips ()void gtk_toolbar_set_tooltips (GtkToolbar *toolbar, gboolean enable); Warning
Sets if the tooltips of a toolbar should be active or not.
gtk_toolbar_unset_icon_size ()void gtk_toolbar_unset_icon_size (GtkToolbar *toolbar);
Unsets toolbar icon size set with
gtk_toolbar_get_show_arrow ()gboolean gtk_toolbar_get_show_arrow (GtkToolbar *toolbar);
Returns whether the toolbar has an overflow menu.
See
Since 2.4 gtk_toolbar_get_orientation ()GtkOrientation gtk_toolbar_get_orientation (GtkToolbar *toolbar);
Retrieves the current orientation of the toolbar. See
gtk_toolbar_get_style ()GtkToolbarStyle gtk_toolbar_get_style (GtkToolbar *toolbar);
Retrieves whether the toolbar has text, icons, or both . See
gtk_toolbar_get_icon_size ()GtkIconSize gtk_toolbar_get_icon_size (GtkToolbar *toolbar);
Retrieves the icon size for the toolbar. See
gtk_toolbar_get_tooltips ()gboolean gtk_toolbar_get_tooltips (GtkToolbar *toolbar); Warning
Retrieves whether tooltips are enabled. See
gtk_toolbar_get_relief_style ()GtkReliefStyle gtk_toolbar_get_relief_style (GtkToolbar *toolbar);
Returns the relief style of buttons on
Since 2.4 gtk_toolbar_append_item ()GtkWidget* gtk_toolbar_append_item (GtkToolbar *toolbar, const char *text, const char *tooltip_text, const char *tooltip_private_text, GtkWidget *icon, GtkSignalFunc callback, gpointer user_data); Warning
Inserts a new item into the toolbar. You must specify the position in the toolbar where it will be inserted.
gtk_toolbar_prepend_item ()GtkWidget* gtk_toolbar_prepend_item (GtkToolbar *toolbar, const char *text, const char *tooltip_text, const char *tooltip_private_text, GtkWidget *icon, GtkSignalFunc callback, gpointer user_data); Warning
Adds a new button to the beginning (top or left edges) of the given toolbar.
gtk_toolbar_insert_item ()GtkWidget* gtk_toolbar_insert_item (GtkToolbar *toolbar, const char *text, const char *tooltip_text, const char *tooltip_private_text, GtkWidget *icon, GtkSignalFunc callback, gpointer user_data, gint position); Warning
Inserts a new item into the toolbar. You must specify the position in the toolbar where it will be inserted.
gtk_toolbar_append_space ()void gtk_toolbar_append_space (GtkToolbar *toolbar); Warning
Adds a new space to the end of the toolbar.
gtk_toolbar_prepend_space ()void gtk_toolbar_prepend_space (GtkToolbar *toolbar); Warning
Adds a new space to the beginning of the toolbar.
gtk_toolbar_insert_space ()void gtk_toolbar_insert_space (GtkToolbar *toolbar, gint position); Warning
Inserts a new space in the toolbar at the specified position.
gtk_toolbar_append_element ()GtkWidget* gtk_toolbar_append_element (GtkToolbar *toolbar, GtkToolbarChildType type, GtkWidget *widget, const char *text, const char *tooltip_text, const char *tooltip_private_text, GtkWidget *icon, GtkSignalFunc callback, gpointer user_data); Warning
Adds a new element to the end of a toolbar.
If
gtk_toolbar_prepend_element ()GtkWidget* gtk_toolbar_prepend_element (GtkToolbar *toolbar, GtkToolbarChildType type, GtkWidget *widget, const char *text, const char *tooltip_text, const char *tooltip_private_text, GtkWidget *icon, GtkSignalFunc callback, gpointer user_data); Warning
Adds a new element to the beginning of a toolbar.
If
gtk_toolbar_insert_element ()GtkWidget* gtk_toolbar_insert_element (GtkToolbar *toolbar, GtkToolbarChildType type, GtkWidget *widget, const char *text, const char *tooltip_text, const char *tooltip_private_text, GtkWidget *icon, GtkSignalFunc callback, gpointer user_data, gint position); Warning
Inserts a new element in the toolbar at the given position.
If
gtk_toolbar_append_widget ()void gtk_toolbar_append_widget (GtkToolbar *toolbar, GtkWidget *widget, const char *tooltip_text, const char *tooltip_private_text); Warning
Adds a widget to the end of the given toolbar.
gtk_toolbar_prepend_widget ()void gtk_toolbar_prepend_widget (GtkToolbar *toolbar, GtkWidget *widget, const char *tooltip_text, const char *tooltip_private_text); Warning
Adds a widget to the beginning of the given toolbar.
gtk_toolbar_insert_widget ()void gtk_toolbar_insert_widget (GtkToolbar *toolbar, GtkWidget *widget, const char *tooltip_text, const char *tooltip_private_text, gint position); Warning
Inserts a widget in the toolbar at the given position.
gtk_toolbar_set_style ()void gtk_toolbar_set_style (GtkToolbar *toolbar, GtkToolbarStyle style);
Alters the view of
gtk_toolbar_insert_stock ()GtkWidget* gtk_toolbar_insert_stock (GtkToolbar *toolbar, const gchar *stock_id, const char *tooltip_text, const char *tooltip_private_text, GtkSignalFunc callback, gpointer user_data, gint position); Warning
Inserts a stock item at the specified position of the toolbar. If
gtk_toolbar_set_icon_size ()void gtk_toolbar_set_icon_size (GtkToolbar *toolbar, GtkIconSize icon_size); This function sets the size of stock icons in the toolbar. You can call it both before you add the icons and after they've been added. The size you set will override user preferences for the default icon size. This should only be used for special-purpose toolbars, normal application toolbars should respect the user preferences for the size of icons.
gtk_toolbar_remove_space ()void gtk_toolbar_remove_space (GtkToolbar *toolbar, gint position); Warning
Removes a space from the specified position.
gtk_toolbar_unset_style ()void gtk_toolbar_unset_style (GtkToolbar *toolbar);
Unsets a toolbar style set with
Property DetailsThe
|
|
the GtkToolbar which emitted the signal |
|
TRUE if the first item should be focused
|
|
user data set when the signal handler was connected. |
Returns : |
TRUE if the signal was handled, FALSE if not
|
"orientation-changed"
signalvoid user_function (GtkToolbar *toolbar, GtkOrientation orientation, gpointer user_data) : Run First
Emitted when the orientation of the toolbar changes.
|
the object which emitted the signal |
|
the new GtkOrientation of the toolbar |
|
user data set when the signal handler was connected. |
"popup-context-menu"
signalgboolean user_function (GtkToolbar *toolbar, gint x, gint y, gint button, gpointer user_data) : Run Last
Emitted when the user right-clicks the toolbar or uses the keybinding to display a popup menu.
Application developers should handle this signal if they want
to display a context menu on the toolbar. The context-menu should
appear at the coordinates given by x
and y
. The mouse button
number is given by the button
parameter. If the menu was popped
up using the keybaord, button
is -1.
|
the GtkToolbar which emitted the signal |
|
the x coordinate of the point where the menu should appear |
|
the y coordinate of the point where the menu should appear |
|
the mouse button the user pressed, or -1 |
|
user data set when the signal handler was connected. |
Returns : |
return TRUE if the signal was handled, FALSE if not
|
"style-changed"
signalvoid user_function (GtkToolbar *toolbar, GtkToolbarStyle style, gpointer user_data) : Run First
Emitted when the style of the toolbar changes.
|
The GtkToolbar which emitted the signal |
|
the new GtkToolbarStyle of the toolbar |
|
user data set when the signal handler was connected. |