|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.gnu.glib.Struct
org.gnu.glib.GObject
org.gnu.gtk.Action
public class Action
An action which can be triggered by a menu or toolbar item.
Actions represent operations that the user can be perform, along with some information how it should be presented in the interface. Each action provides methods to create icons, menu items and toolbar items representing itself.
As well as the callback that is called when the action gets activated, the following also gets associated with the action:
a name (not translated, for path lookup)
a label (translated, for display)
an accelerator
whether label indicates a stock id
a tooltip (optional, translated)
a toolbar label (optional, shorter than label)
The action will also have some state information:
visible (shown/hidden)
sensitive (enabled/disabled)
Apart from regular actions, there are ToggleAction
, which can be
toggled between two states and RadioAction
, of which only one in a
group can be in the "active" state. Other actions can be implemented as
Action
subclasses.
Each action can have one or more proxy menu item, toolbar button or other proxy widgets. Proxies mirror the state of the action (text label, tooltip, icon, visible, sensitive, etc), and should change when the action's state changes. When the proxy is activated, it should activate its action.
Constructor Summary | |
---|---|
Action(java.lang.String name,
java.lang.String label,
java.lang.String tooltip,
java.lang.String stockId)
Construct a new Action object. |
Method Summary | |
---|---|
void |
activate()
Emits the "activate" signal on the specified action, if it isn't insensitive. |
void |
addListener(ActionListener listener)
Register an object to receive action activation event notification. |
void |
connectAccelerator()
Installs the accelerator for action if action has an accel path and group. |
void |
connectProxy(Widget proxy)
Connects a widget to an action object as a proxy. |
Widget |
createIcon(IconSize iconSize)
This function is intended for use by action implementations to create icons displayed in the proxy widgets. |
Widget |
createMenuItem()
Creates a menu item widget that proxies for the given action. |
Widget |
createToolItem()
Creates a toolbar item widget that proxies for the given action. |
void |
disconnectAccelerator()
Undoes the effect of one call to connectAccelerator() . |
void |
disconnectProxy(Widget proxy)
Disconnects a proxy widget from an action. |
java.lang.String |
getAcceleratorPath()
|
java.lang.String |
getName()
Returns the name of the action. |
java.util.List |
getProxies()
Returns the proxy widgets for an action. |
static Type |
getType()
Retrieve the runtime type used by the GLib library. |
boolean |
isSensitive()
|
boolean |
isVisible()
|
void |
removeListener(ActionListener listener)
Unregister an object that was receiving focus event notification. |
void |
setAccelGroup(AccelGroup group)
Sets the AccelGroup in which the accelerator for this
action will be installed. |
void |
setAccelPath(java.lang.String path)
Sets the accel path for this action. |
void |
setSensitive(boolean sensitive)
|
void |
setVisible(boolean visible)
|
Methods inherited from class org.gnu.glib.Struct |
---|
equals, getHandle, getNullHandle, hashCode |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Action(java.lang.String name, java.lang.String label, java.lang.String tooltip, java.lang.String stockId)
Method Detail |
---|
public java.lang.String getName()
public void activate()
public Widget createIcon(IconSize iconSize)
iconSize
- the size of the icon that should be created
public Widget createMenuItem()
public Widget createToolItem()
public void connectProxy(Widget proxy)
proxy
- the proxy widgetpublic void disconnectProxy(Widget proxy)
proxy
- the proxy widgetpublic java.util.List getProxies()
public void connectAccelerator()
disconnectAccelerator()
has been called as many times.
public void disconnectAccelerator()
connectAccelerator()
.
public java.lang.String getAcceleratorPath()
public boolean isSensitive()
public void setSensitive(boolean sensitive)
public boolean isVisible()
public void setVisible(boolean visible)
public static Type getType()
public void setAccelPath(java.lang.String path)
path
- The accelerator pathpublic void setAccelGroup(AccelGroup group)
AccelGroup
in which the accelerator for this
action will be installed.
group
- an AccelGroup or nullpublic void addListener(ActionListener listener)
listener
- The object that has implemented the ActionListener interface
that is to receive the activation events.public void removeListener(ActionListener listener)
listener
- The object that is to no longer receive focus events.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |