CtkToggleToolButton: CTK+ 3 Reference Manual

## CtkToggleToolButton CtkToggleToolButton — A CtkToolItem containing a toggle button |

## Functions

CtkToolItem * | ctk_toggle_tool_button_new ()
CtkToolItem * | ctk_toggle_tool_button_new_from_stock ()
void | ctk_toggle_tool_button_set_active ()
gboolean | ctk_toggle_tool_button_get_active ()

## Properties

gboolean | active | Read / Write

## Signals

void | toggled | Run First

## Types and Values

struct | CtkToggleToolButton
struct | CtkToggleToolButtonClass

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── CtkWidget
                ╰── CtkContainer
                    ╰── CtkBin
                        ╰── CtkToolItem
                            ╰── CtkToolButton
                                ╰── CtkToggleToolButton
                                    ╰── CtkRadioToolButton

## Implemented Interfaces

CtkToggleToolButton implements AtkImplementorIface, CtkBuildable, CtkActivatable and CtkActionable.

## Includes

    #include <ctk/ctk.h>

## Description

A CtkToggleToolButton is a CtkToolItem that contains a toggle button.

Use `ctk_toggle_tool_button_new()` to create a new CtkToggleToolButton.

### CSS nodes

CtkToggleToolButton has a single CSS node with name togglebutton.

## Functions

### ctk_toggle_tool_button_new ()

    CtkToolItem *
    ctk_toggle_tool_button_new (void);

Returns a new CtkToggleToolButton

#### Returns

a newly created CtkToggleToolButton

Since: 2.4

### ctk_toggle_tool_button_new_from_stock ()

    CtkToolItem *
    ctk_toggle_tool_button_new_from_stock (const gchar *stock_id);

`ctk_toggle_tool_button_new_from_stock` has been deprecated since version 3.10 and should not be used in newly-written code.

Use `ctk_toggle_tool_button_new()` instead.

Creates a new CtkToggleToolButton containing the image and text from a stock item. Some stock ids have preprocessor macros like CTK_STOCK_OK and CTK_STOCK_APPLY.

It is an error if `stock_id` is not a name of a stock item.

#### Parameters

stock_id | the name of the stock item |

#### Returns

A new CtkToggleToolButton

Since: 2.4

### ctk_toggle_tool_button_set_active ()

    void
    ctk_toggle_tool_button_set_active (CtkToggleToolButton *button,
                                       gboolean is_active);

Sets the status of the toggle tool button. Set to `TRUE` if you want the CtkToggleButton to be “pressed in”, and `FALSE` to raise it. This action causes the toggled signal to be emitted.

#### Parameters

button | a CtkToggleToolButton |
is_active | whether `button` should be active |

Since: 2.4

### ctk_toggle_tool_button_get_active ()

    gboolean
    ctk_toggle_tool_button_get_active (CtkToggleToolButton *button);

Queries a CtkToggleToolButton and returns its current state. Returns `TRUE` if the toggle button is pressed in and `FALSE` if it is raised.

#### Parameters

button | a CtkToggleToolButton |

#### Returns

`TRUE` if the toggle tool button is pressed in, `FALSE` if not

Since: 2.4

## Types and Values

### struct CtkToggleToolButton

    struct CtkToggleToolButton;

### struct CtkToggleToolButtonClass

    struct CtkToggleToolButtonClass {
      CtkToolButtonClass parent_class;

      /* signal */
      void (* toggled) (CtkToggleToolButton *button);
    };

#### Members

`toggled` () | Signal emitted whenever the toggle tool button changes state. |

## Property Details

### The `“active”` property

      “active”                   gboolean

If the toggle tool button should be pressed in.

Owner: CtkToggleToolButton

Flags: Read / Write

Default value: FALSE

Since: 2.8

## Signal Details

### The `“toggled”` signal

    void
    user_function (CtkToggleToolButton *toggle_tool_button,
                   gpointer             user_data)

Emitted whenever the toggle tool button changes state.

#### Parameters

toggle_tool_button | the object that emitted the signal |
user_data | user data set when the signal handler was connected. |

Flags: Run First

## See Also

CtkToolbar, CtkToolButton, CtkSeparatorToolItem