Class: Gtk::ActionGroup

Inherits:
Object
  • Object
show all
Defined in:
(unknown)

Instance Method Summary collapse

Instance Method Details

#accel_groupGtk::AccelGroup

The accelerator group the actions of this group should use.

Returns:

#accel_group=(accel_group) ⇒ Gtk::AccelGroup

The accelerator group the actions of this group should use.

Parameters:

Returns:

#add_action(action) ⇒ nil

Adds an action object to the action group. Note that this function does not set up the accel path of the action, which can lead to problems if a user tries to modify the accelerator of a menuitem associated with the action. Therefore you must either set the accel path yourself with gtk_action_set_accel_path(), or use ‘gtk_action_group_add_action_with_accel (…, NULL)`.

Parameters:

Returns:

  • (nil)

#add_action_with_accel(action, accelerator) ⇒ nil

Adds an action object to the action group and sets up the accelerator.

If accelerator is nil, attempts to use the accelerator associated with the stock_id of the action.

Accel paths are set to ‘<Actions>/group-name/action-name`.

Parameters:

  • action (Gtk::Action)

    the action to add

  • accelerator (String)

    the accelerator for the action, in the format understood by gtk_accelerator_parse(), or “” for no accelerator, or nil to use the stock accelerator

Returns:

  • (nil)

#add_actions(entries, n_entries, user_data) ⇒ nil

This is a convenience function to create a number of actions and add them to the action group.

The “activate” signals of the actions are connected to the callbacks and their accel paths are set to ‘<Actions>/group-name/action-name`.

Parameters:

  • entries (Array<Gtk::ActionEntry>)

    an array of action descriptions

  • n_entries (Integer)

    the number of entries

  • user_data (GObject)

    data to pass to the action callbacks

Returns:

  • (nil)

#add_actions_full(entries, n_entries, user_data, destroy) ⇒ nil

This variant of gtk_action_group_add_actions() adds a GDestroy::Notify callback for user_data.

Parameters:

  • entries (Array<Gtk::ActionEntry>)

    an array of action descriptions

  • n_entries (Integer)

    the number of entries

  • user_data (GObject)

    data to pass to the action callbacks

  • destroy (GLib::DestroyNotify)

    destroy notification callback for user_data

Returns:

  • (nil)

#add_radio_actions(entries, n_entries, value, on_change, user_data) ⇒ nil

This is a convenience routine to create a group of radio actions and add them to the action group.

The “changed” signal of the first radio action is connected to the on_change callback and the accel paths of the actions are set to ‘<Actions>/group-name/action-name`.

Parameters:

  • entries (Array<Gtk::RadioActionEntry>)

    an array of radio action descriptions

  • n_entries (Integer)

    the number of entries

  • value (Integer)

    the value of the action to activate initially, or -1 if no action should be activated

  • on_change (GObject::Callback)

    the callback to connect to the changed signal

  • user_data (GObject)

    data to pass to the action callbacks

Returns:

  • (nil)

#add_radio_actions_full(entries, n_entries, value, on_change, user_data, destroy) ⇒ nil

This variant of gtk_action_group_add_radio_actions() adds a GDestroy::Notify callback for user_data.

Parameters:

  • entries (Array<Gtk::RadioActionEntry>)

    an array of radio action descriptions

  • n_entries (Integer)

    the number of entries

  • value (Integer)

    the value of the action to activate initially, or -1 if no action should be activated

  • on_change (GObject::Callback)

    the callback to connect to the changed signal

  • user_data (GObject)

    data to pass to the action callbacks

  • destroy (GLib::DestroyNotify)

    destroy notification callback for user_data

Returns:

  • (nil)

#add_toggle_actions(entries, n_entries, user_data) ⇒ nil

This is a convenience function to create a number of toggle actions and add them to the action group.

The “activate” signals of the actions are connected to the callbacks and their accel paths are set to ‘<Actions>/group-name/action-name`.

Parameters:

  • entries (Array<Gtk::ToggleActionEntry>)

    an array of toggle action descriptions

  • n_entries (Integer)

    the number of entries

  • user_data (GObject)

    data to pass to the action callbacks

Returns:

  • (nil)

#add_toggle_actions_full(entries, n_entries, user_data, destroy) ⇒ nil

This variant of gtk_action_group_add_toggle_actions() adds a GDestroy::Notify callback for user_data.

Parameters:

  • entries (Array<Gtk::ToggleActionEntry>)

    an array of toggle action descriptions

  • n_entries (Integer)

    the number of entries

  • user_data (GObject)

    data to pass to the action callbacks

  • destroy (GLib::DestroyNotify)

    destroy notification callback for user_data

Returns:

  • (nil)

#get_action(action_name) ⇒ Gtk::Action

Looks up an action in the action group by name.

Parameters:

  • action_name (String)

    the name of the action

Returns:

  • (Gtk::Action)

    the action, or nil if no action by that name exists

#list_actionsGLib::List

Lists the actions in the action group.

Returns:

  • (GLib::List)

    an allocated list of the action objects in the action group

#nameString

A name for the action.

Returns:

  • (String)

    name

#name=(name) ⇒ String

A name for the action.

Parameters:

  • name (String)

Returns:

  • (String)

    name

  • (String)

    name

#new(name) ⇒ Gtk::ActionGroup

Creates a new Gtk::ActionGroup object. The name of the action group is used when associating [keybindings] with the actions.

Parameters:

  • name (String)

    the name of the action group.

Returns:

#remove_action(action) ⇒ nil

Removes an action object from the action group.

Parameters:

Returns:

  • (nil)

#sensitiveTrueClass

Returns true if the group is sensitive. The constituent actions can only be logically sensitive (see gtk_action_is_sensitive()) if they are sensitive (see gtk_action_get_sensitive()) and their group is sensitive.

Returns:

  • (TrueClass)

    true if the group is sensitive.

#sensitive=(sensitive) ⇒ TrueClass

Whether the action group is enabled.

Parameters:

  • sensitive (TrueClass)

Returns:

  • (TrueClass)

    sensitive

  • (TrueClass)

    sensitive

#sensitive?TrueClass

Whether the action group is enabled.

Returns:

  • (TrueClass)

    sensitive

#set_translate_func(func, data, notify) ⇒ nil

Sets a function to be used for translating the label and tooltip of Gtk::ActionEntrys added by gtk_action_group_add_actions().

If you’re using gettext(), it is enough to set the translation domain with gtk_action_group_set_translation_domain().

Parameters:

  • func (Gtk::TranslateFunc)

    a Gtk::TranslateFunc

  • data (GObject)

    data to be passed to func and notify

  • notify (GLib::DestroyNotify)

    a GDestroy::Notify function to be called when action_group is destroyed and when the translation function is changed again

Returns:

  • (nil)

#translate_string(string) ⇒ String

Translates a string using the function set with gtk_action_group_set_translate_func(). This is mainly intended for language bindings.

Parameters:

  • string (String)

    a string

Returns:

  • (String)

    the translation of string

#translation_domain=(domain) ⇒ nil

Sets the translation domain and uses g_dgettext() for translating the label and tooltip of Gtk::ActionEntrys added by gtk_action_group_add_actions().

If you’re not using gettext() for localization, see gtk_action_group_set_translate_func(). calls, or nil to use the domain set with textdomain()

Parameters:

  • domain (String)

    the translation domain to use for g_dgettext()

Returns:

  • (nil)

#visibleTrueClass

Returns true if the group is visible. The constituent actions can only be logically visible (see gtk_action_is_visible()) if they are visible (see gtk_action_get_visible()) and their group is visible.

Returns:

  • (TrueClass)

    true if the group is visible.

#visible=(visible) ⇒ TrueClass

Whether the action group is visible.

Parameters:

  • visible (TrueClass)

Returns:

  • (TrueClass)

    visible

  • (TrueClass)

    visible

#visible?TrueClass

Whether the action group is visible.

Returns:

  • (TrueClass)

    visible