![]() |
![]() |
![]() |
GTK+ Reference Manual | ![]() |
---|---|---|---|---|
#include <gtk/gtk.h> GtkToolButton; GtkToolItem* gtk_tool_button_new (GtkWidget *icon_widget, constgchar *label); GtkToolItem* gtk_tool_button_new_from_stock (constgchar *stock_id);void gtk_tool_button_set_label (GtkToolButton *button, constgchar *label); constgchar * gtk_tool_button_get_label (GtkToolButton *button);void gtk_tool_button_set_use_underline (GtkToolButton *button,gboolean use_underline);gboolean gtk_tool_button_get_use_underline (GtkToolButton *button);void gtk_tool_button_set_stock_id (GtkToolButton *button, constgchar *stock_id); constgchar * gtk_tool_button_get_stock_id (GtkToolButton *button);void gtk_tool_button_set_icon_name (GtkToolButton *button, constgchar *icon_name); constgchar * gtk_tool_button_get_icon_name (GtkToolButton *button);void gtk_tool_button_set_icon_widget (GtkToolButton *button, GtkWidget *icon_widget); GtkWidget* gtk_tool_button_get_icon_widget (GtkToolButton *button);void gtk_tool_button_set_label_widget (GtkToolButton *button, GtkWidget *label_widget); GtkWidget* gtk_tool_button_get_label_widget (GtkToolButton *button);
GObject +----GInitiallyUnowned +----GtkObject +----GtkWidget +----GtkContainer +----GtkBin +----GtkToolItem +----GtkToolButton +----GtkMenuToolButton +----GtkToggleToolButton
icon-namegchararray : Read / Write icon-widget GtkWidget : Read / Write labelgchararray : Read / Write label-widget GtkWidget : Read / Write stock-idgchararray : Read / Write use-underlinegboolean : Read / Write
GtkToolButtons are
Use gtk_tool_button_new()
to create a new GtkToolButton. Use
gtk_tool_button_new_with_stock()
The label of a GtkToolButton is determined by the properties
"label_widget", "label", and "stock_id". If "label_widget" is
non-NULL
NULL
NULL
The icon of a GtkToolButton is determined by the properties
"icon_widget" and "stock_id". If "icon_widget" is non-NULL
NULL
typedef struct _GtkToolButton GtkToolButton;
The GtkToolButton struct contains only private. It should only be accessed with the function described below.
GtkToolItem* gtk_tool_button_new (GtkWidget *icon_widget, constgchar *label);
Creates a new GtkToolButton
using icon_widget
as icon and label
as
label.
icon_widget : |
a widget that will be used as icon widget, or NULL |
label : |
a string that will be used as label, or NULL |
Returns : | A new GtkToolButton |
Since 2.4
GtkToolItem* gtk_tool_button_new_from_stock (constgchar *stock_id);
Creates a new GtkToolButton containing the image and text from a stock item. Some stock ids have preprocessor macros like GTK_STOCK_OK and GTK_STOCK_APPLY.
It is an error if stock_id
is not a name of a stock item.
stock_id : |
the name of the stock item |
Returns : | A new GtkToolButton |
Since 2.4
void gtk_tool_button_set_label (GtkToolButton *button, constgchar *label);
Sets label
as the label used for the tool button. The "label" property
only has an effect if not overridden by a non-NULL
NULL
NULL
button
will not have a label.
button : |
a GtkToolButton |
label : |
a string that will be used as label, or NULL |
Since 2.4
constgchar * gtk_tool_button_get_label (GtkToolButton *button);
Returns the label used by the tool button, or NULL
button : |
a GtkToolButton |
Returns : | The label, or NULL |
Since 2.4
void gtk_tool_button_set_use_underline (GtkToolButton *button,gboolean use_underline);
If set, an underline in the label property indicates that the next character
should be used for the mnemonic accelerator key in the overflow menu. For
example, if the label property is "_Open" and use_underline
is TRUE
Labels shown on tool buttons never have mnemonics on them; this property only affects the menu item on the overflow menu.
button : |
a GtkToolButton |
use_underline : |
whether the button label has the form "_Open" |
Since 2.4
gboolean gtk_tool_button_get_use_underline (GtkToolButton *button);
Returns whether underscores in the label property are used as mnemonics
on menu items on the overflow menu. See gtk_tool_button_set_use_underline()
.
button : |
a GtkToolButton |
Returns : | TRUE |
Since 2.4
void gtk_tool_button_set_stock_id (GtkToolButton *button, constgchar *stock_id);
Sets the name of the stock item. See gtk_tool_button_new_from_stock()
.
The stock_id property only has an effect if not
overridden by non-NULL
button : |
a GtkToolButton |
stock_id : |
a name of a stock item, or NULL |
Since 2.4
constgchar * gtk_tool_button_get_stock_id (GtkToolButton *button);
Returns the name of the stock item. See gtk_tool_button_set_stock_id()
.
The returned string is owned by GTK+ and must not be freed or modifed.
button : |
a GtkToolButton |
Returns : | the name of the stock item for button .
|
Since 2.4
void gtk_tool_button_set_icon_name (GtkToolButton *button, constgchar *icon_name);
Sets the icon for the tool button from a named themed icon.
See the docs for GtkIconTheme for more details.
The "icon_name" property only has an effect if not
overridden by non-NULL
button : |
a GtkToolButton |
icon_name : |
the name of the themed icon |
Since 2.8
constgchar * gtk_tool_button_get_icon_name (GtkToolButton *button);
Returns the name of the themed icon for the tool button,
see gtk_tool_button_set_icon_name()
.
button : |
a GtkToolButton |
Returns : | the icon name or NULL |
Since 2.8
void gtk_tool_button_set_icon_widget (GtkToolButton *button, GtkWidget *icon_widget);
Sets icon
as the widget used as icon on button
. If icon_widget
is
NULL
NULL
button
will not have an icon.
button : |
a GtkToolButton |
icon_widget : |
the widget used as icon, or NULL |
Since 2.4
GtkWidget* gtk_tool_button_get_icon_widget (GtkToolButton *button);
Return the widget used as icon widget on button
. See
gtk_tool_button_set_icon_widget()
.
button : |
a GtkToolButton |
Returns : | The widget used as icon on button , or NULL |
Since 2.4
void gtk_tool_button_set_label_widget (GtkToolButton *button, GtkWidget *label_widget);
Sets label_widget
as the widget that will be used as the label
for button
. If label_widget
is NULL
NULL
NULL
button
does not have a label.
button : |
a GtkToolButton |
label_widget : |
the widget used as label, or NULL |
Since 2.4
GtkWidget* gtk_tool_button_get_label_widget (GtkToolButton *button);
Returns the widget used as label on button
. See
gtk_tool_button_set_label_widget()
.
button : |
a GtkToolButton |
Returns : | The widget used as label on button , or NULL |
Since 2.4
icon-name
propertyicon-namegchararray : Read / Write
The name of the themed icon displayed on the item. This property only has an effect if not overridden by "label", "icon_widget" or "stock_id" properties.
Default value: NULL
Since 2.8
stock-id
propertystock-idgchararray : Read / Write
The stock icon displayed on the item.
Default value: NULL
::clicked
signalvoid user_function (GtkToolButton *toolbutton,gpointer user_data) : Run First / Action
This signal is emitted when the tool button is clicked with the mouse or activated with the keyboard.
toolbutton : |
the object that emitted the signal |
user_data : |
user data set when the signal handler was connected. |
GtkToolbar | The toolbar widget |
GtkMenuToolButton | A subclass of GtkToolButton that displays on the toolbar a button with an additional dropdown menu |
GtkToggleToolButton | A subclass of GtkToolButton that displays toggle buttons on the toolbar |
GtkRadioToolButton | A subclass of GtkToolButton that displays radio buttons on the toolbar |
GtkSeparatorToolItem | A subclass of GtkToolItem that separates groups of items on a toolbar |