org.gnome.gtk
Class ToggleToolButton
Object
org.freedesktop.bindings.Pointer
org.freedesktop.bindings.Proxy
org.gnome.glib.Object
org.gnome.gtk.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 |
static interface |
ToggleToolButton.Toggled
Signal indicating the ToggleToolButton state has changed. |
Nested classes/interfaces inherited from class org.gnome.gtk.Widget |
Widget.ButtonPressEvent, Widget.ButtonReleaseEvent, Widget.EnterNotifyEvent, Widget.ExposeEvent, Widget.FocusInEvent, Widget.FocusOutEvent, Widget.Hide, Widget.KeyPressEvent, Widget.KeyReleaseEvent, Widget.LeaveNotifyEvent, Widget.MapEvent, Widget.MotionNotifyEvent, Widget.PopupMenu, Widget.ScrollEvent, Widget.UnmapEvent, Widget.VisibilityNotifyEvent |
Method Summary |
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.Bin |
getChild |
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, getAllocation, getCanDefault, getCanFocus, getHasFocus, getName, getParent, getRequisition, getSensitive, getToplevel, getWindow, grabAdd, grabDefault, grabFocus, grabRemove, hide, isSensitive, modifyBackground, modifyBase, modifyFont, modifyText, queueDraw, queueDrawArea, realize, setCanDefault, setCanFocus, setColormap, setEvents, 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 |
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
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