public class ToggleToolButton extends ToolButton
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.
Modifier and Type | Class and Description |
---|---|
static interface |
ToggleToolButton.Toggled
Signal indicating the ToggleToolButton state has changed.
|
ToolButton.Clicked
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 and Description |
---|
ToggleToolButton()
Create a new ToggleToolButton.
|
ToggleToolButton(Stock stock)
Create a new ToggleToolButton based on one of the stock items.
|
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.
|
connect, getLabel, getLabelWidget, setLabel, setLabelWidget
getExpand, getRelatedAction, setExpand, setIsImportant, setRelatedAction
add, getChildren, remove, setBorderWidth
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
public ToggleToolButton()
public ToggleToolButton(Stock stock)
public void connect(ToggleToolButton.Toggled handler)
ToggleToolButton.Toggled
signal.public boolean getActive()
public void setActive(boolean isActive)
TOGGLED
signal.