Description
The GtkButton widget is generally used to attach a function to that
is called when the button is pressed. The various signals and how to use
them are outlined below.
The GtkButton widget can hold any valid child widget. That is it can
hold most any other standard GtkWidget. The most commonly used child is
the GtkLabel.
Details
struct GtkButton
This should not be accessed directly. Use the accessor functions below.
gtk_button_new ()
Creates a new GtkButton widget.
gtk_button_new_with_label ()
GtkWidget* gtk_button_new_with_label (const gchar *label); |
Creates a GtkButton widget with a GtkLabel child containing the given
text.
gtk_button_new_with_mnemonic ()
GtkWidget* gtk_button_new_with_mnemonic (const gchar *label); |
Creates a new GtkButton containing a label.
If characters in label are preceded by an underscore, they are underlined.
If you need a literal underscore character in a label, use '__' (two
underscores). The first underlined character represents a keyboard
accelerator called a mnemonic.
Pressing Alt and that key activates the button.
gtk_button_set_relief ()
Sets the relief style of the edges of the given GtkButton widget.
Three styles exist, GTK_RELIEF_NORMAL, GTK_RELIEF_HALF, GTK_RELIEF_NONE.
The default style is, as one can guess, GTK_RELIEF_NORMAL.
gtk_button_get_relief ()
Returns the current relief style of the given GtkButton.
gtk_button_get_label ()
G_CONST_RETURN gchar* gtk_button_get_label (GtkButton *button); |
Fetches the text from the label of the button, as set by
gtk_button_set_label(). This string is owned by the widget
and must not be modified or freed. If the label text has not
been set the return value will be NULL. This will be the
case if you create an empty button with gtk_button_new() to
use as a container.
gtk_button_set_label ()
void gtk_button_set_label (GtkButton *button,
const gchar *label); |
Sets the text of the label of the button to str. This text is
also used to select the stock item if gtk_button_set_use_stock()
is used.
This will also clear any previously set labels.
gtk_button_get_use_stock ()
gboolean gtk_button_get_use_stock (GtkButton *button); |
Returns whether the button label is a stock item.
gtk_button_set_use_stock ()
void gtk_button_set_use_stock (GtkButton *button,
gboolean use_stock); |
If true, the label set on the button is used as a
stock id to select the stock item for the button.
gtk_button_get_use_underline ()
gboolean gtk_button_get_use_underline (GtkButton *button); |
Returns whether an embedded underline in the button label indicates a
mnemonic. See gtk_button_set_use_underline().
gtk_button_set_use_underline ()
void gtk_button_set_use_underline (GtkButton *button,
gboolean use_underline); |
If true, an underline in the text of the button label indicates
the next character should be used for the mnemonic accelerator key.
Signals
The "activate" signal
void user_function (GtkButton *button,
gpointer user_data); |
The "clicked" signal
void user_function (GtkButton *button,
gpointer user_data); |
Emitted when a button clicked on by the mouse and the cursor stays on the
button. If the cursor is not on the button when the mouse button is released,
the signal is not emitted.
The "enter" signal
void user_function (GtkButton *button,
gpointer user_data); |
Emitted when the mouse cursor enters the region of the button.
The "leave" signal
void user_function (GtkButton *button,
gpointer user_data); |
Emitted when the mouse cursor leaves the region of the button.
The "pressed" signal
void user_function (GtkButton *button,
gpointer user_data); |
Emitted when the button is initially pressed.
The "released" signal
void user_function (GtkButton *button,
gpointer user_data); |
Emitted when a button which is pressed is released, no matter where the
mouse cursor is.