<< Back to man.ChinaUnix.net

<< Back to man.ChinaUnix.net

GtkToggleAction

GtkToggleAction — An action which can be toggled between two states

Synopsis


#include <gtk/gtk.h>


            GtkToggleAction;
GtkToggleAction* gtk_toggle_action_new      (const gchar *name,
                                             const gchar *label,
                                             const gchar *tooltip,
                                             const gchar *stock_id);
void        gtk_toggle_action_toggled       (GtkToggleAction *action);
void        gtk_toggle_action_set_active    (GtkToggleAction *action,
                                             gboolean is_active);
gboolean    gtk_toggle_action_get_active    (GtkToggleAction *action);
void        gtk_toggle_action_set_draw_as_radio
                                            (GtkToggleAction *action,
                                             gboolean draw_as_radio);
gboolean    gtk_toggle_action_get_draw_as_radio
                                            (GtkToggleAction *action);


Object Hierarchy


  GObject
   +----GtkAction
         +----GtkToggleAction
               +----GtkRadioAction

Properties


  "draw-as-radio"        gboolean              : Read / Write

Signal Prototypes


"toggled"   void        user_function      (GtkToggleAction *toggleaction,
                                            gpointer user_data);

Description

A GtkToggleAction corresponds roughly to a GtkCheckMenuItem. It has an "active" state specifying whether the action has been checked or not.

Details

GtkToggleAction

typedef struct _GtkToggleAction GtkToggleAction;

The GtkToggleAction struct contains only private members and should not be accessed directly.


gtk_toggle_action_new ()

GtkToggleAction* gtk_toggle_action_new      (const gchar *name,
                                             const gchar *label,
                                             const gchar *tooltip,
                                             const gchar *stock_id);

Creates a new GtkToggleAction object. To add the action to a GtkActionGroup and set the accelerator for the action, call gtk_action_group_add_action_with_accel().

name : A unique name for the action
label : The label displayed in menu items and on buttons
tooltip : A tooltip for the action
stock_id : The stock icon to display in widgets representing the action
Returns : a new GtkToggleAction

Since 2.4


gtk_toggle_action_toggled ()

void        gtk_toggle_action_toggled       (GtkToggleAction *action);

Emits the "toggled" signal on the toggle action.

action : the action object

Since 2.4


gtk_toggle_action_set_active ()

void        gtk_toggle_action_set_active    (GtkToggleAction *action,
                                             gboolean is_active);

Sets the checked state on the toggle action.

action : the action object
is_active : whether the action should be checked or not

Since 2.4


gtk_toggle_action_get_active ()

gboolean    gtk_toggle_action_get_active    (GtkToggleAction *action);

Returns the checked state of the toggle action.

action : the action object
Returns : the checked state of the toggle action

Since 2.4


gtk_toggle_action_set_draw_as_radio ()

void        gtk_toggle_action_set_draw_as_radio
                                            (GtkToggleAction *action,
                                             gboolean draw_as_radio);

Sets whether the action should have proxies like a radio action.

action : the action object
draw_as_radio : whether the action should have proxies like a radio action

Since 2.4


gtk_toggle_action_get_draw_as_radio ()

gboolean    gtk_toggle_action_get_draw_as_radio
                                            (GtkToggleAction *action);

Returns whether the action should have proxies like a radio action.

action : the action object
Returns : whether the action should have proxies like a radio action.

Since 2.4

Properties

The "draw-as-radio" property

  "draw-as-radio"        gboolean              : Read / Write

Whether the proxies for this action look like radio action proxies.

Default value: FALSE

Signals

The "toggled" signal

void        user_function                  (GtkToggleAction *toggleaction,
                                            gpointer user_data);

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