HildonCheckButton

HildonCheckButton — Button with a check box inside

Synopsis

                    HildonCheckButton;
GtkWidget*          hildon_check_button_new             (HildonSizeType size);
void                hildon_check_button_set_active      (HildonCheckButton *button,
                                                         gboolean is_active);
gboolean            hildon_check_button_get_active      (HildonCheckButton *button);
void                hildon_check_button_toggled         (HildonCheckButton *button);

Object Hierarchy

  GObject
   +----GInitiallyUnowned
         +----GtkObject
               +----GtkWidget
                     +----GtkContainer
                           +----GtkBin
                                 +----GtkButton
                                       +----HildonCheckButton

Implemented Interfaces

HildonCheckButton implements AtkImplementorIface and GtkBuildable.

Properties

  "size"                     HildonSizeType        : Write

Style Properties

  "checkbox-size"            guint                 : Read

Signals

  "toggled"                                        : Run First

Description

HildonCheckButton is a button containing a label and a check box which will remain 'pressed-in' when clicked. Clicking again will make the check box toggle its state.

HildonCheckButton is similar to the GtkCheckButton widget, but with a different appearance that combines a standard button and a check box.

The state of a HildonCheckButton can be set using hildon_check_button_set_active(), and retrieved using hildon_check_button_get_active(). The label can be set using gtk_button_set_label() and retrieved using gtk_button_get_label().

Note

HildonCheckButton does NOT support an image, so don't use gtk_button_set_image().

Example 6. Using a Hildon check button

void
button_toggled (HildonCheckButton *button, gpointer user_data)
{
    gboolean active;

    active = hildon_check_button_get_active (button);
    if (active)
       g_debug ("Button is active");
    else
       g_debug ("Button is not active");
}

GtkWidget *
create_button (void)
{
    GtkWidget *button;

    button = hildon_check_button_new (HILDON_SIZE_AUTO);
    gtk_button_set_label (GTK_BUTTON (button), "Click me");

    g_signal_connect (button, "toggled", G_CALLBACK (button_toggled), NULL);

    return button;
}


Details

HildonCheckButton

typedef struct _HildonCheckButton HildonCheckButton;


hildon_check_button_new ()

GtkWidget*          hildon_check_button_new             (HildonSizeType size);

Creates a new HildonCheckButton.

size : Flags indicating the size of the new button
Returns : A newly created HildonCheckButton

Since 2.2


hildon_check_button_set_active ()

void                hildon_check_button_set_active      (HildonCheckButton *button,
                                                         gboolean is_active);

Sets the status of a HildonCheckButton. Set to TRUE if you want button to be 'pressed-in', and FALSE to raise it. This action causes the "toggled" signal to be emitted.

button : A HildonCheckButton
is_active : new state for the button

Since 2.2


hildon_check_button_get_active ()

gboolean            hildon_check_button_get_active      (HildonCheckButton *button);

Gets the current state of button.

button : A HildonCheckButton
Returns : TRUE if button is active, FALSE otherwise.

Since 2.2


hildon_check_button_toggled ()

void                hildon_check_button_toggled         (HildonCheckButton *button);

Emits the "toggled" signal on the HildonCheckButton. There is no good reason for an application ever to call this function.

button : A HildonCheckButton

Since 2.2

Property Details

The "size" property

  "size"                     HildonSizeType        : Write

Size request for the button.

Style Property Details

The "checkbox-size" style property

  "checkbox-size"            guint                 : Read

Size of the check box.

Default value: 26

Signal Details

The "toggled" signal

void                user_function                      (HildonCheckButton *arg0,
                                                        gpointer           user_data)      : Run First

Emitted when the HildonCheckButton's state is changed.

user_data : user data set when the signal handler was connected.

Since 2.2