public class ToggleAction extends Action
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.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. |
Action.Activate
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. |
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 . |
connect, createMenuItem, createToolItem, emitActivate, getSensitive, getTooltip, getVisible, isSensitive, isVisible, setAccelerator, setSensitive, setTooltip, setVisible
public ToggleAction(String name, Stock stock)
public ToggleAction(String name, Stock stock, ToggleAction.Toggled handler)
ToggleAction.Toggled
signal. Complements the
<init>(String, Stock)
constructor.public ToggleAction(String name, String label)
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.public ToggleAction(String name, String label, String tooltip, Stock stock)
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.public ToggleAction(String name, String label, String tooltip, Stock stock, ToggleAction.Toggled handler)
ToggleAction.Toggled
signal.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.public ToggleAction(String name, String label, ToggleAction.Toggled handler)
ToggleAction.Toggled
signal.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.public void connect(ToggleAction.Toggled handler)
ToggleAction.Toggled
signal.public void emitToggled()
ToggleAction.Toggled
signal.public boolean getActive()
ToggleAction
.public boolean getDrawAsRadio()
RadioAction
.public void setActive(boolean setting)
ToggleAction
.public void setDrawAsRadio(boolean setting)
RadioAction
.