Class SimpleAction

All Implemented Interfaces:
PointerInterface

public class SimpleAction extends Object
A #GSimpleAction is the obvious simple implementation of the #GAction
interface. This is the easiest way to create an action for purposes of
adding it to a #GSimpleActionGroup.

See also #GtkAction.

https://docs.gtk.org/gio/class.SimpleAction.html

  • Field Details

  • Constructor Details

    • SimpleAction

      public SimpleAction(PointerContainer pointer)
    • SimpleAction

      public SimpleAction(@Nonnull Str name, @Nullable VariantType parameter_type)
      Creates a new action.

      The created action is stateless. See g_simple_action_new_stateful() to create
      an action that has state.
      Parameters:
      name - the name of the action
      parameter_type - the type of parameter that will be passed to handlers for the #GSimpleAction::activate signal, or %NULL for no parameter
    • SimpleAction

      public SimpleAction(String name, @Nullable VariantType parameter_type)
      Creates a new action.

      The created action is stateless. See g_simple_action_new_stateful() to create
      an action that has state.
      Parameters:
      name - the name of the action
      parameter_type - the type of parameter that will be passed to handlers for the #GSimpleAction::activate signal, or %NULL for no parameter
  • Method Details

    • getClassHandler

      public static ClassHandler getClassHandler()
    • newStatefulSimpleAction

      public static SimpleAction newStatefulSimpleAction(@Nonnull Str name, @Nullable VariantType parameter_type, @Nonnull Variant state)
      Creates a new stateful action.

      All future state values must have the same #GVariantType as the initial
      @state.

      If the @state #GVariant is floating, it is consumed.
      Parameters:
      name - the name of the action
      parameter_type - the type of the parameter that will be passed to handlers for the #GSimpleAction::activate signal, or %NULL for no parameter
      state - the initial state of the action
      Returns:
      a new #GSimpleAction
    • newStatefulSimpleAction

      public static SimpleAction newStatefulSimpleAction(String name, @Nullable VariantType parameter_type, @Nonnull Variant state)
      Creates a new stateful action.

      All future state values must have the same #GVariantType as the initial
      @state.

      If the @state #GVariant is floating, it is consumed.
      Parameters:
      name - the name of the action
      parameter_type - the type of the parameter that will be passed to handlers for the #GSimpleAction::activate signal, or %NULL for no parameter
      state - the initial state of the action
      Returns:
      a new #GSimpleAction
    • setEnabled

      public void setEnabled(boolean enabled)
      Sets the action as enabled or not.

      An action must be enabled in order to be activated or in order to
      have its state changed from outside callers.

      This should only be called by the implementor of the action. Users
      of the action should not attempt to modify its enabled flag.
      Parameters:
      enabled - whether the action is enabled
    • setState

      public void setState(@Nonnull Variant value)
      Sets the state of the action.

      This directly updates the 'state' property to the given value.

      This should only be called by the implementor of the action. Users
      of the action should not attempt to directly modify the 'state'
      property. Instead, they should call g_action_change_state() to
      request the change.

      If the @value GVariant is floating, it is consumed.
      Parameters:
      value - the new #GVariant for the state
    • setStateHint

      public void setStateHint(@Nullable Variant state_hint)
      Sets the state hint for the action.

      See g_action_get_state_hint() for more information about
      action state hints.
      Parameters:
      state_hint - a #GVariant representing the state hint
    • onActivate

      public SignalHandler onActivate(SimpleAction.OnActivate signal)
      Connect to signal "activate".
      See SimpleAction.OnActivate.onActivate(ch.bailu.gtk.glib.Variant) for signal description.
      Field SIGNAL_ON_ACTIVATE contains original signal name and can be used as resource reference.
      Parameters:
      signal - callback function (lambda).
      Returns:
      SignalHandler. Can be used to disconnect signal and to release callback function.
    • onChangeState

      public SignalHandler onChangeState(SimpleAction.OnChangeState signal)
      Connect to signal "change-state".
      See SimpleAction.OnChangeState.onChangeState(ch.bailu.gtk.glib.Variant) for signal description.
      Field SIGNAL_ON_CHANGE_STATE contains original signal name and can be used as resource reference.
      Parameters:
      signal - callback function (lambda).
      Returns:
      SignalHandler. Can be used to disconnect signal and to release callback function.
    • asAction

      public Action asAction()
      Implements interface Action. Call this to get access to interface functions.
      Returns:
      Action
    • getTypeID

      public static long getTypeID()
    • getParentTypeID

      public static long getParentTypeID()
    • getTypeSize

      public static TypeSystem.TypeSize getTypeSize()
    • getParentTypeSize

      public static TypeSystem.TypeSize getParentTypeSize()
    • getInstanceSize

      public static int getInstanceSize()