Class: Clutter::BindingPool

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Clutter::BindingPool

Creates a new Clutter::BindingPool that can be used to store key bindings for an actor. The name must be a unique identifier for the binding pool, so that clutter_binding_pool_find() will be able to return the correct binding pool.

Parameters:

  • name (String)

    the name of the binding pool

Class Method Details

.find(name) ⇒ Clutter::BindingPool

Finds the Clutter::BindingPool with name.

Parameters:

  • name (String)

    the name of the binding pool to find

Returns:

.get_for_class(klass) ⇒ Clutter::BindingPool

Retrieves the Clutter::BindingPool for the given #GObject class and, eventually, creates it. This function is a wrapper around clutter_binding_pool_new() and uses the class type name as the unique name for the binding pool.

Calling this function multiple times will return the same Clutter::BindingPool.

A binding pool for a class can also be retrieved using clutter_binding_pool_find() with the class type name:

|[ pool = clutter_binding_pool_find (G_OBJECT_TYPE_NAME (instance)); ]|

Parameters:

  • klass (GObject)

    a GObject::Class pointer

Returns:

  • (Clutter::BindingPool)

    the binding pool for the given class. The returned Clutter::BindingPool is owned by Clutter and should not be freed directly

Instance Method Details

#activate(key_val, modifiers, gobject) ⇒ Boolean

Activates the callback associated to the action that is bound to the key_val and modifiers pair.

The callback has the following signature:

|[ void (* callback) (GObject *gobject, const gchar *action_name, guint key_val, ClutterModifierType modifiers, gpointer user_data); ]|

Where the #GObject instance is gobject and the user data is the one passed when installing the action with clutter_binding_pool_install_action().

If the action bound to the key_val, modifiers pair has been blocked using clutter_binding_pool_block_action(), the callback will not be invoked, and this function will return false.

Parameters:

  • key_val (Integer)

    the key symbol

  • modifiers (Clutter::ModifierType)

    bitmask for the modifiers

  • gobject (GObject::Object)

    a #GObject

Returns:

  • (Boolean)

    true if an action was found and was activated

#block_action(action_name) ⇒ nil

Blocks all the actions with name action_name inside pool.

Parameters:

  • action_name (String)

    an action name

Returns:

  • (nil)

#find_action(key_val, modifiers) ⇒ String

Retrieves the name of the action matching the given key symbol and modifiers bitmask.

Parameters:

Returns:

  • (String)

    the name of the action, if found, or nil. The returned string is owned by the binding pool and should never be modified or freed

#install_action(action_name, key_val, modifiers, callback, data, notify) ⇒ nil

Installs a new action inside a Clutter::BindingPool. The action is bound to key_val and modifiers.

The same action name can be used for multiple key_val, modifiers pairs.

When an action has been activated using clutter_binding_pool_activate() the passed callback will be invoked (with data).

Actions can be blocked with clutter_binding_pool_block_action() and then unblocked using clutter_binding_pool_unblock_action().

Parameters:

  • action_name (String)

    the name of the action

  • key_val (Integer)

    key symbol

  • modifiers (Clutter::ModifierType)

    bitmask of modifiers

  • callback (Clutter::BindingActionFunc)

    function to be called when the action is activated

  • data (GObject)

    data to be passed to callback

  • notify (GLib::DestroyNotify)

    function to be called when the action is removed from the pool

Returns:

  • (nil)

#install_closure(action_name, key_val, modifiers, closure) ⇒ nil

A #GClosure variant of clutter_binding_pool_install_action().

Installs a new action inside a Clutter::BindingPool. The action is bound to key_val and modifiers.

The same action name can be used for multiple key_val, modifiers pairs.

When an action has been activated using clutter_binding_pool_activate() the passed closure will be invoked.

Actions can be blocked with clutter_binding_pool_block_action() and then unblocked using clutter_binding_pool_unblock_action().

Parameters:

  • action_name (String)

    the name of the action

  • key_val (Integer)

    key symbol

  • modifiers (Clutter::ModifierType)

    bitmask of modifiers

  • closure (GObject::Closure)

    a #GClosure

Returns:

  • (nil)

#nameString

The unique name of the Clutter::BindingPool.

Returns:

  • (String)

    name

#name=(name) ⇒ String

The unique name of the Clutter::BindingPool.

Parameters:

  • name (String)

Returns:

  • (String)

    name

  • (String)

    name

#override_action(key_val, modifiers, callback, data, notify) ⇒ nil

Allows overriding the action for key_val and modifiers inside a Clutter::BindingPool. See clutter_binding_pool_install_action().

When an action has been activated using clutter_binding_pool_activate() the passed callback will be invoked (with data).

Actions can be blocked with clutter_binding_pool_block_action() and then unblocked using clutter_binding_pool_unblock_action().

Parameters:

  • key_val (Integer)

    key symbol

  • modifiers (Clutter::ModifierType)

    bitmask of modifiers

  • callback (Clutter::BindingActionFunc)

    function to be called when the action is activated

  • data (GObject)

    data to be passed to callback

  • notify (GLib::DestroyNotify)

    function to be called when the action is removed from the pool

Returns:

  • (nil)

#override_closure(key_val, modifiers, closure) ⇒ nil

A #GClosure variant of clutter_binding_pool_override_action().

Allows overriding the action for key_val and modifiers inside a Clutter::BindingPool. See clutter_binding_pool_install_closure().

When an action has been activated using clutter_binding_pool_activate() the passed callback will be invoked (with data).

Actions can be blocked with clutter_binding_pool_block_action() and then unblocked using clutter_binding_pool_unblock_action().

Parameters:

  • key_val (Integer)

    key symbol

  • modifiers (Clutter::ModifierType)

    bitmask of modifiers

  • closure (GObject::Closure)

    a #GClosure

Returns:

  • (nil)

#remove_action(key_val, modifiers) ⇒ nil

Removes the action matching the given key_val, modifiers pair, if any exists.

Parameters:

Returns:

  • (nil)

#unblock_action(action_name) ⇒ nil

Unblockes all the actions with name action_name inside pool.

Unblocking an action does not cause the callback bound to it to be invoked in case clutter_binding_pool_activate() was called on an action previously blocked with clutter_binding_pool_block_action().

Parameters:

  • action_name (String)

    an action name

Returns:

  • (nil)