GtkButton

Name

GtkButton -- A widget that creates a signal when clicked on.

Synopsis


#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);

Object Hierarchy


  GtkObject
   +----GtkWidget
         +----GtkContainer
               +----GtkBin
                     +----GtkButton

Args


  "label"                gchar*               : Read / Write
  "relief"               GtkReliefStyle       : Read / Write

Signal Prototypes


"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);

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

struct GtkButton;

This should not be accessed directly. Use the accessor functions below.


gtk_button_new ()

GtkWidget*  gtk_button_new                  (void);

Creates a new GtkButton widget.

Returns :The newly created 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.

label :The text you want the GtkLabel to hold.
Returns :The newly created GtkButton widget.


gtk_button_pressed ()

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.


gtk_button_released ()

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.


gtk_button_clicked ()

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.


gtk_button_enter ()

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.


gtk_button_leave ()

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.


gtk_button_set_relief ()

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.


gtk_button_get_relief ()

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

Args

"label" (gchar* : Read / Write)

The text within the child GtkLabel of the GtkButton. Only useful if there is actually a GtkLabel inside of the GtkButton.

"relief" (GtkReliefStyle : Read / Write)

The GtkReliefStyle as outlined in gtk_button_set_relief().

Signals

The "pressed" signal

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.


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.

button :the object which received the signal.
user_data :user data set when the signal handler was connected.


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.

button :the object which received the signal.
user_data :user data set when the signal handler was connected.


The "enter" signal

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.


The "leave" signal

void        user_function                  (GtkButton *button,
                                            gpointer user_data);

Emitted when the mouse cursor leaves the region of the button.

button :the object which received the signal.
user_data :user data set when the signal handler was connected.