org.gnome.gtk

## Class ToggleToolButton

- Object
- - org.freedesktop.bindings.Pointer
  - - org.freedesktop.bindings.Proxy
    - - org.gnome.glib.Object
      - - org.gnome.gtk.Widget
        - - org.gnome.gtk.Container
          - - org.gnome.gtk.Bin
            - - org.gnome.gtk.ToolItem
              - - org.gnome.gtk.ToolButton
                - - org.gnome.gtk.ToggleToolButton

- All Implemented Interfaces:
    Activatable
  Direct Known Subclasses:
    RadioToolButton

      public class ToggleToolButton
      extends ToolButton

  A ToggleToolButton is a ToolButton that retains its state.

  The usual usage of such kind of ToolButtons is to let users enable or disable an application feature.

  You can check the current state of the ToggleToolButton using the `getActive()` method. Additionally you can connect to the `TOGGLED` signal to respond to changes in the active state.

  Beware that ToogleToolButtons have sometimes fared poorly in usability tests. The problem is that they are an exception: most ToolItems are ToolButtons, and most of them you just press and something immediately happens. Since there is no visual distinction between a ToolButton and an inactive ToggleToolButton, users don't expect that this particular ToolItem is going to behave differently and maintain its state. It's not a huge problem (ie, if the user is paying attention they'll soon find out that the button is a toggle), but it's something that usually takes a few iterations before the user learns. Something to keep in mind.

  Since:
    4.0.4
  Author:
    Vreixo Formoso, Andrew Cowie

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static interface` | `ToggleToolButton.Toggled` Signal indicating the ToggleToolButton state has changed.

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

      `ToolButton.Clicked`

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

      `Widget.ButtonPressEvent, Widget.ButtonReleaseEvent, Widget.Destroy, Widget.Draw, Widget.EnterNotifyEvent, Widget.FocusInEvent, Widget.FocusOutEvent, Widget.Hide, Widget.KeyPressEvent, Widget.KeyReleaseEvent, Widget.LeaveNotifyEvent, Widget.MapEvent, Widget.MotionNotifyEvent, Widget.PopupMenu, Widget.QueryTooltip, Widget.ScrollEvent, Widget.SizeAllocate, Widget.UnmapEvent, Widget.VisibilityNotifyEvent`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ToggleToolButton()` Create a new ToggleToolButton.
    `ToggleToolButton(Stock stock)` Create a new ToggleToolButton based on one of the stock items.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `connect(ToggleToolButton.Toggled handler)` Connect a handler to the `ToggleToolButton.Toggled` signal.
    `boolean` | `getActive()` Is the ToggleToolButton currently activated on?
    `void` | `setActive(boolean isActive)` Set whether this ToggleToolButton is active, that is, whether it appears pressed or not.

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

      `connect, getLabel, getLabelWidget, setLabel, setLabelWidget`

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

      `getExpand, getRelatedAction, setExpand, setIsImportant, setRelatedAction`

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

      `getChild`

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

      `add, getChildren, remove, setBorderWidth`

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

      `activate, addEvents, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, destroy, getAllocatedHeight, getAllocatedWidth, getAllocation, getCanDefault, getCanFocus, getHasFocus, getName, getParent, getPreferredHeightForWidthMinimum, getPreferredHeightForWidthNatural, getPreferredHeightMinimum, getPreferredHeightNatural, getPreferredWidthForHeightMinimum, getPreferredWidthForHeightNatural, getPreferredWidthMinimum, getPreferredWidthNatural, getRequestMode, getRequisition, getSensitive, getStyleContext, getToplevel, getWindow, grabAdd, grabDefault, grabFocus, grabRemove, hide, isSensitive, overrideBackground, overrideColor, overrideFont, queueDraw, queueDrawArea, realize, setAlignHorizontal, setAlignVertical, setCanDefault, setCanFocus, setEvents, setExpandHorizontal, setExpandVertical, setName, setSensitive, setSizeRequest, setTooltipMarkup, setTooltipText, show, showAll`

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

      `toString`

    - ### Methods inherited from class Object

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

- - ### Constructor Detail

    - #### ToggleToolButton

          public ToggleToolButton()

      Create a new ToggleToolButton.
      Since:
        4.0.4

    - #### ToggleToolButton

          public ToggleToolButton(Stock stock)

      Create a new ToggleToolButton based on one of the stock items.
      Since:
        4.0.4

  - ### Method Detail

    - #### connect

          public void connect(ToggleToolButton.Toggled handler)

      Connect a handler to the `ToggleToolButton.Toggled` signal.
      Since:
        4.0.4

    - #### getActive

          public boolean getActive()

      Is the ToggleToolButton currently activated on?
      Since:
        4.0.4

    - #### setActive

          public void setActive(boolean isActive)

      Set whether this ToggleToolButton is active, that is, whether it appears pressed or not. Calling this will emit a `TOGGLED` signal.
      Since:
        4.0.4