org.gnome.gtk

## Class ToggleAction

- Object
- - org.freedesktop.bindings.Pointer
  - - org.freedesktop.bindings.Proxy
    - - org.gnome.glib.Object
      - - org.gnome.gtk.Action
        - - org.gnome.gtk.ToggleAction

- Direct Known Subclasses:
    RadioAction

      public class ToggleAction
      extends Action

  A `ToggleAction` is an equivalent of a `Action` but used in general to create `CheckMenuItem`. It has an "active" state which indicates whether the action has been checked or not.
  Since:
    4.0.15
  Author:
    Guillaume Mazoyer

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static interface` | `ToggleAction.Toggled` Signal emitted when the `ToggleAction` is toggled A `ToggleAction` is activated when the user clicks a ToolButton proxy, when (s)he activates an associated MenuItem or when `toggled()` is called.

    - ### Nested classes/interfaces inherited from class org.gnome.gtk.Action

      `Action.Activate`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ToggleAction(String name, Stock stock)` Create a new ToggleAction from a Stock item.
    `ToggleAction(String name, Stock stock, ToggleAction.Toggled handler)` Create a new ToggleAction based on a Stock item, and connect a handler to its `ToggleAction.Toggled` signal.
    `ToggleAction(String name, String label)` Create a new ToggleAction.
    `ToggleAction(String name, String label, String tooltip, Stock stock)` Create a new ToggleAction.
    `ToggleAction(String name, String label, String tooltip, Stock stock, ToggleAction.Toggled handler)` Create a new ToggleAction, and connect a handler to its `ToggleAction.Toggled` signal.
    `ToggleAction(String name, String label, ToggleAction.Toggled handler)` Create a new ToggleAction, and connect a handler to its `ToggleAction.Toggled` signal.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `connect(ToggleAction.Toggled handler)` Connect a handler to the `ToggleAction.Toggled` signal.
    `void` | `emitToggled()` Emit the `ToggleAction.Toggled` signal.
    `boolean` | `getActive()` Return the checked state of the `ToggleAction`.
    `boolean` | `getDrawAsRadio()` Return whether the action may have proxies like a `RadioAction`.
    `void` | `setActive(boolean setting)` Set the checked state of the `ToggleAction`.
    `void` | `setDrawAsRadio(boolean setting)` Set whether the action may have proxies like a `RadioAction`.

    - ### Methods inherited from class org.gnome.gtk.Action

      `connect, createMenuItem, createToolItem, emitActivate, getSensitive, getTooltip, getVisible, isSensitive, isVisible, setAccelerator, setSensitive, setTooltip, setVisible`

    - ### Methods inherited from class org.freedesktop.bindings.Pointer

      `toString`

    - ### Methods inherited from class Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### ToggleAction

          public ToggleAction(String name,
                      Stock stock)

      Create a new ToggleAction from a Stock item. The message and tooltip will be supplied by GTK automatically.
      Since:
        4.0.15

    - #### ToggleAction

          public ToggleAction(String name,
                      Stock stock,
                      ToggleAction.Toggled handler)

      Create a new ToggleAction based on a Stock item, and connect a handler to its `ToggleAction.Toggled` signal. Complements the `<init>(String, Stock)` constructor.
      Since:
        4.0.15

    - #### ToggleAction

          public ToggleAction(String name,
                      String label)

      Create a new ToggleAction.
      Parameters:
        `name` - A unique name for the ToggleAction.
        `label` - The text that will be displayed in the proxy Widgets. You usually will want to localize it to the user language.
      Since:
        4.0.15

    - #### ToggleAction

          public ToggleAction(String name,
                      String label,
                      String tooltip,
                      Stock stock)

      Create a new ToggleAction.
      Parameters:
        `name` - A unique name for the ToggleAction.
        `label` - The text that will be displayed in the proxy Widgets. You usually will want to localize it to the user language.
        `tooltip` - A Tooltip or little help message for the ToggleAction. Also localized.
        `stock` - The Stock icon to display in proxy Widgets.
      Since:
        4.0.15

    - #### ToggleAction

          public ToggleAction(String name,
                      String label,
                      String tooltip,
                      Stock stock,
                      ToggleAction.Toggled handler)

      Create a new ToggleAction, and connect a handler to its `ToggleAction.Toggled` signal.
      Parameters:
        `name` - A unique name for the ToggleAction.
        `label` - The text that will be displayed in the proxy Widgets. You usually will want to localize it to the user language.
        `tooltip` - A Tooltip or little help message for the ToggleAction. Also localized.
        `stock` - The stock icon to display in proxy Widgets.
        `handler` - A handler to connect to the `ToggleAction.Toggled` signal. Typically this will be used to actually start the operation related to this ToggleAction.
      Since:
        4.0.15

    - #### ToggleAction

          public ToggleAction(String name,
                      String label,
                      ToggleAction.Toggled handler)

      Create a new ToggleAction, and connect a handler to its `ToggleAction.Toggled` signal.
      Parameters:
        `name` - A unique name for the ToggleAction.
        `label` - The label that will be displayed in the proxy Widgets. You usually will want to localize it to the user language.
        `handler` - A handler to connect to the `ToggleAction.Toggled` signal. Usually will will start from here the operation related to the Action.
      Since:
        4.0.15

  - ### Method Detail

    - #### connect

          public void connect(ToggleAction.Toggled handler)

      Connect a handler to the `ToggleAction.Toggled` signal.
      Since:
        4.0.15

    - #### emitToggled

          public void emitToggled()

      Emit the `ToggleAction.Toggled` signal.
      Since:
        4.0.19

    - #### getActive

          public boolean getActive()

      Return the checked state of the `ToggleAction`.
      Since:
        4.0.15

    - #### getDrawAsRadio

          public boolean getDrawAsRadio()

      Return whether the action may have proxies like a `RadioAction`.
      Since:
        4.0.15

    - #### setActive

          public void setActive(boolean setting)

      Set the checked state of the `ToggleAction`.
      Since:
        4.0.15

    - #### setDrawAsRadio

          public void setDrawAsRadio(boolean setting)

      Set whether the action may have proxies like a `RadioAction`.
      Since:
        4.0.15