GTK+ Reference Manual | |||
---|---|---|---|
<<< Previous Page | Home | Up | Next Page >>> |
#include <gtk/gtk.h> struct GtkButton; GtkWidget* gtk_button_new (void); GtkWidget* gtk_button_new_with_label (const gchar *label); void gtk_button_pressed (GtkButton *button); void gtk_button_released (GtkButton *button); void gtk_button_clicked (GtkButton *button); void gtk_button_enter (GtkButton *button); void gtk_button_leave (GtkButton *button); void gtk_button_set_relief (GtkButton *button, GtkReliefStyle newstyle); GtkReliefStyle gtk_button_get_relief (GtkButton *button); |
"pressed" void user_function (GtkButton *button, gpointer user_data); "released" void user_function (GtkButton *button, gpointer user_data); "clicked" void user_function (GtkButton *button, gpointer user_data); "enter" void user_function (GtkButton *button, gpointer user_data); "leave" void user_function (GtkButton *button, gpointer user_data); |
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.
struct GtkButton; |
This should not be accessed directly. Use the accessor functions below.
GtkWidget* gtk_button_new (void); |
Creates a new GtkButton widget.
Returns : | The newly created GtkButton widget. |
GtkWidget* gtk_button_new_with_label (const gchar *label); |
Creates a GtkButton widget with a GtkLabel child containing the given text.
void gtk_button_pressed (GtkButton *button); |
Emits a GtkButton::pressed signal to the given GtkButton.
button : | The GtkButton you want to send the signal to. |
void gtk_button_released (GtkButton *button); |
Emits a GtkButton::released signal to the given GtkButton.
button : | The GtkButton you want to send the signal to. |
void gtk_button_clicked (GtkButton *button); |
Emits a GtkButton::clicked signal to the given GtkButton.
button : | The GtkButton you want to send the signal to. |
void gtk_button_enter (GtkButton *button); |
Emits a GtkButton::enter signal to the given GtkButton.
button : | The GtkButton you want to send the signal to. |
void gtk_button_leave (GtkButton *button); |
Emits a GtkButton::leave signal to the given GtkButton.
button : | The GtkButton you want to send the signal to. |
void gtk_button_set_relief (GtkButton *button, GtkReliefStyle newstyle); |
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.
button : | The GtkButton you want to set relief styles of. |
newstyle : | The GtkReliefStyle as described above. |
GtkReliefStyle gtk_button_get_relief (GtkButton *button); |
Returns the current relief style of the given GtkButton.
button : | The GtkButton you want the GtkReliefStyle from. |
Returns : | The current GtkReliefStyle |
The text within the child GtkLabel of the GtkButton. Only useful if there is actually a GtkLabel inside of the GtkButton.
The GtkReliefStyle as outlined in gtk_button_set_relief().
void user_function (GtkButton *button, gpointer user_data); |
Emitted when the button is initially pressed.
button : | the object which received the signal. |
user_data : | user data set when the signal handler was connected. |
void user_function (GtkButton *button, gpointer user_data); |
Emitted when a button which is pressed is released, no matter where the mouse cursor is.
button : | the object which received the signal. |
user_data : | user data set when the signal handler was connected. |
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.
button : | the object which received the signal. |
user_data : | user data set when the signal handler was connected. |
void user_function (GtkButton *button, gpointer user_data); |
Emitted when the mouse cursor enters the region of the button.
button : | the object which received the signal. |
user_data : | user data set when the signal handler was connected. |