## org.gnu.gtk
Class Action

    java.lang.Object
      org.gnu.glib.GObject
          org.gnu.gtk.Action

Direct Known Subclasses:
  ToggleAction

public class Action
extends GObject

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.

Field Summary

Fields inherited from class org.gnu.glib.GObject
`eventsInitialized`

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` `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.
`protected static void` `gtk_action_activate(Handle action)`
`protected static void` `gtk_action_connect_accelerator(Handle action)`
`protected static void` `gtk_action_connect_proxy(Handle action, Handle proxy)`
`protected static Handle` `gtk_action_create_icon(Handle action, int iconSize)`
`protected static Handle` `gtk_action_create_menu_item(Handle action)`
`protected static Handle` `gtk_action_create_tool_item(Handle action)`
`protected static void` `gtk_action_disconnect_accelerator(Handle action)`
`protected static void` `gtk_action_disconnect_proxy(Handle action, Handle proxy)`
`protected static java.lang.String` `gtk_action_get_accel_path(Handle action)`
`protected static java.lang.String` `gtk_action_get_name(Handle action)`
`protected static Handle[]` `gtk_action_get_proxies(Handle action)`
`protected static boolean` `gtk_action_get_sensitive(Handle action)`
`protected static int` `gtk_action_get_type()`
`protected static boolean` `gtk_action_get_visible(Handle action)`
`protected static boolean` `gtk_action_is_sensitive(Handle action)`
`protected static boolean` `gtk_action_is_visible(Handle action)`
`protected static Handle` `gtk_action_new(java.lang.String name, java.lang.String label, java.lang.String tooltip, java.lang.String stockId)`
`protected static void` `gtk_action_set_sensitive(Handle action, boolean sensitive)`
`protected static void` `gtk_action_set_visible(Handle action, boolean visible)`
`boolean` `isSensitive()`
`boolean` `isVisible()`
`void` `setSensitive(boolean sensitive)`
`void` `setVisible(boolean visible)`

Methods inherited from class org.gnu.glib.GObject

`addEventHandler, addEventHandler, addEventHandler, addEventHandler, addEventHandler, addEventHandler, addListener, equals, freezeNotify, getBooleanProperty, getData, getData, getDoubleProperty, getEventListenerClass, getEventType, getFloatProperty, getGObjectFromHandle, getHandle, getIntFromHandle, getIntProperty, getJavaObjectProperty, getLongProperty, getNullHandle, getPixbufProperty, getProperty, getStringFromHandle, getStringProperty, hashCode, hasProperty, instantiateJGObjectFromGType, notify, removeEventHandler, removeListener, retrieveGObject, setBooleanProperty, setData, setData, setDoubleProperty, setFloatProperty, setHandle, setIntProperty, setJavaObjectProperty, setLongProperty, setPixbufProperty, setProperty, setStringProperty, thawNotify`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Action

    public Action(java.lang.String name,
                  java.lang.String label,
                  java.lang.String tooltip,
                  java.lang.String stockId)

  Construct a new Action object.

Method Detail

### getName

    public java.lang.String getName()

  Returns the name of the action.

  Returns:
    the name of the action

### activate

    public void activate()

  Emits the "activate" signal on the specified action, if it isn't insensitive. This gets called by the proxy widgets when they get activated. It can also be used to manually activate an action.

### createIcon

    public Widget createIcon(IconSize iconSize)

  This function is intended for use by action implementations to create icons displayed in the proxy widgets.

  Parameters:
    `iconSize` - the size of the icon that should be created
  Returns:
    a widget that displays the icon for this action

### createMenuItem

    public Widget createMenuItem()

  Creates a menu item widget that proxies for the given action.

  Returns:
    a menu item connected to the action

### createToolItem

    public Widget createToolItem()

  Creates a toolbar item widget that proxies for the given action.

  Returns:
    a toolbar item connected to the action

### connectProxy

    public void connectProxy(Widget proxy)

  Connects a widget to an action object as a proxy. Synchronises various properties of the action with the widget (such as label text, icon, tooltip, etc), and attaches a callback so that the action gets activated when the proxy widget does. If the widget is already connected to an action, it is disconnected first.

  Parameters:
    `proxy` - the proxy widget

### disconnectProxy

    public void disconnectProxy(Widget proxy)

  Disconnects a proxy widget from an action. Does not destroy the widget, however.

  Parameters:
    `proxy` - the proxy widget

### getProxies

    public java.util.List getProxies()

  Returns the proxy widgets for an action.

  Returns:
    a List of proxy widgets

### connectAccelerator

    public void connectAccelerator()

  Installs the accelerator for action if action has an accel path and group. Since multiple proxies may independently trigger the installation of the accelerator, the action counts the number of times this function has been called and doesn't remove the accelerator until `disconnectAccelerator()` has been called as many times.

### disconnectAccelerator

    public void disconnectAccelerator()

  Undoes the effect of one call to `connectAccelerator()`.

### getAcceleratorPath

    public java.lang.String getAcceleratorPath()

### isSensitive

    public boolean isSensitive()

### setSensitive

    public void setSensitive(boolean sensitive)

### isVisible

    public boolean isVisible()

### setVisible

    public void setVisible(boolean visible)

### getType

    public static Type getType()

  Retrieve the runtime type used by the GLib library.

### gtk_action_get_type

    protected static final int gtk_action_get_type()

### gtk_action_new

    protected static final Handle gtk_action_new(java.lang.String name,
                                                 java.lang.String label,
                                                 java.lang.String tooltip,
                                                 java.lang.String stockId)

### gtk_action_get_name

    protected static final java.lang.String gtk_action_get_name(Handle action)

### gtk_action_activate

    protected static final void gtk_action_activate(Handle action)

### gtk_action_create_icon

    protected static final Handle gtk_action_create_icon(Handle action,
                                                         int iconSize)

### gtk_action_create_menu_item

    protected static final Handle gtk_action_create_menu_item(Handle action)

### gtk_action_create_tool_item

    protected static final Handle gtk_action_create_tool_item(Handle action)

### gtk_action_connect_proxy

    protected static final void gtk_action_connect_proxy(Handle action,
                                                         Handle proxy)

### gtk_action_disconnect_proxy

    protected static final void gtk_action_disconnect_proxy(Handle action,
                                                            Handle proxy)

### gtk_action_get_proxies

    protected static final Handle[] gtk_action_get_proxies(Handle action)

### gtk_action_connect_accelerator

    protected static final void gtk_action_connect_accelerator(Handle action)

### gtk_action_disconnect_accelerator

    protected static final void gtk_action_disconnect_accelerator(Handle action)

### gtk_action_get_accel_path

    protected static final java.lang.String gtk_action_get_accel_path(Handle action)

### gtk_action_is_sensitive

    protected static final boolean gtk_action_is_sensitive(Handle action)

### gtk_action_get_sensitive

    protected static final boolean gtk_action_get_sensitive(Handle action)

### gtk_action_set_sensitive

    protected static final void gtk_action_set_sensitive(Handle action,
                                                         boolean sensitive)

### gtk_action_is_visible

    protected static final boolean gtk_action_is_visible(Handle action)

### gtk_action_get_visible

    protected static final boolean gtk_action_get_visible(Handle action)

### gtk_action_set_visible

    protected static final void gtk_action_set_visible(Handle action,
                                                       boolean visible)