CtkToggleAction: CTK+ 3 Reference Manual

## CtkToggleAction CtkToggleAction — An action which can be toggled between two states |

## Functions

CtkToggleAction * | ctk_toggle_action_new ()
void | ctk_toggle_action_toggled ()
void | ctk_toggle_action_set_active ()
gboolean | ctk_toggle_action_get_active ()
void | ctk_toggle_action_set_draw_as_radio ()
gboolean | ctk_toggle_action_get_draw_as_radio ()

## Properties

gboolean | active | Read / Write
gboolean | draw-as-radio | Read / Write

## Signals

void | toggled | Run First

## Types and Values

struct | CtkToggleAction

## Object Hierarchy

        GObject
        ╰── CtkAction
            ╰── CtkToggleAction
                ╰── CtkRadioAction

## Implemented Interfaces

CtkToggleAction implements CtkBuildable.

## Includes

    #include <ctk/ctk.h>

## Description

A CtkToggleAction corresponds roughly to a CtkCheckMenuItem. It has an “active” state specifying whether the action has been checked or not.

## Functions

### ctk_toggle_action_new ()

    CtkToggleAction *
    ctk_toggle_action_new (const gchar *name,
                           const gchar *label,
                           const gchar *tooltip,
                           const gchar *stock_id);

Creates a new CtkToggleAction object. To add the action to a CtkActionGroup and set the accelerator for the action, call `ctk_action_group_add_action_with_accel()`.

#### Parameters

name | A unique name for the action |
label | The label displayed in menu items and on buttons, or `NULL`. | [allow-none]
tooltip | A tooltip for the action, or `NULL`. | [allow-none]
stock_id | The stock icon to display in widgets representing the action, or `NULL`. | [allow-none]

#### Returns

a new CtkToggleAction

Since: 2.4

### ctk_toggle_action_toggled ()

    void
    ctk_toggle_action_toggled (CtkToggleAction *action);

Emits the “toggled” signal on the toggle action.

#### Parameters

action | the action object |

Since: 2.4

### ctk_toggle_action_set_active ()

    void
    ctk_toggle_action_set_active (CtkToggleAction *action,
                                  gboolean is_active);

Sets the checked state on the toggle action.

#### Parameters

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

Since: 2.4

### ctk_toggle_action_get_active ()

    gboolean
    ctk_toggle_action_get_active (CtkToggleAction *action);

Returns the checked state of the toggle action.

#### Parameters

action | the action object |

#### Returns

the checked state of the toggle action

Since: 2.4

### ctk_toggle_action_set_draw_as_radio ()

    void
    ctk_toggle_action_set_draw_as_radio (CtkToggleAction *action,
                                         gboolean draw_as_radio);

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

#### Parameters

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

Since: 2.4

### ctk_toggle_action_get_draw_as_radio ()

    gboolean
    ctk_toggle_action_get_draw_as_radio (CtkToggleAction *action);

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

#### Parameters

action | the action object |

#### Returns

whether the action should have proxies like a radio action.

Since: 2.4

## Types and Values

### struct CtkToggleAction

    struct CtkToggleAction;

## Property Details

### The `“active”` property

      “active”                   gboolean

Whether the toggle action should be active.

Owner: CtkToggleAction

Flags: Read / Write

Default value: FALSE

Since: 2.10

### The `“draw-as-radio”` property

      “draw-as-radio”            gboolean

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

This is an appearance property and thus only applies if “use-action-appearance” is `TRUE`.

Owner: CtkToggleAction

Flags: Read / Write

Default value: FALSE

## Signal Details

### The `“toggled”` signal

    void
    user_function (CtkToggleAction *toggleaction,
                   gpointer         user_data)

Should be connected if you wish to perform an action whenever the CtkToggleAction state is changed.

#### Parameters

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

Flags: Run First