Class: Clutter::Script

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

Overview

The Clutter::ScriptClass structure contains only private data

Instance Method Summary collapse

Constructor Details

#initializeClutter::Script

Creates a new Clutter::Script instance. #ClutterScript can be used to load objects definitions for scenegraph elements, like actors, or behavioural elements, like behaviours and timelines. The definitions must be encoded using the JavaScript Object Notation (JSON) language.

Instance Method Details

#add_search_paths(paths, n_paths) ⇒ nil

Adds paths to the list of search paths held by script.

The search paths are used by clutter_script_lookup_filename(), which can be used to define search paths for the textures source file name or other custom, file-based properties.

Parameters:

  • paths (Array<String>)

    an array of strings containing different search paths

  • n_paths (Integer)

    the length of the passed array

Returns:

  • (nil)

#add_states(name, state) ⇒ nil

Associates a Clutter::State to the #ClutterScript instance using the given name.

The Clutter::Script instance will use state to resolve target states when connecting signal handlers.

The Clutter::Script instance will take a reference on the #ClutterState passed to this function.

Parameters:

  • name (String)

    a name for the state, or nil to set the default Clutter::State

  • state (Clutter::State)

    a Clutter::State

Returns:

  • (nil)

#connect_signals(user_data) ⇒ nil

Connects all the signals defined into a UI definition file to their handlers.

This method invokes clutter_script_connect_signals_full() internally and uses #GModule's introspective features (by opening the current module's scope) to look at the application's symbol table.

Note that this function will not work if #GModule is not supported by the platform Clutter is running on.

Parameters:

  • user_data (GObject)

    data to be passed to the signal handlers, or nil

Returns:

  • (nil)

#connect_signals_full(func, user_data) ⇒ nil

Connects all the signals defined into a UI definition file to their handlers.

This function allows to control how the signal handlers are going to be connected to their respective signals. It is meant primarily for language bindings to allow resolving the function names using the native API, but it can also be used on platforms that do not support GModule.

Applications should use clutter_script_connect_signals().

Parameters:

  • func (Clutter::ScriptConnectFunc)

    signal connection function

  • user_data (GObject)

    data to be passed to the signal handlers, or nil

Returns:

  • (nil)

#ensure_objectsnil

Ensure that every object defined inside script is correctly constructed. You should rarely need to use this function.

Returns:

  • (nil)

#filenameString

The path of the currently parsed file. If Clutter::Script:filename-set is false then the value of this property is undefined.

Returns:

  • (String)

    filename

#filename=(filename) ⇒ String

The path of the currently parsed file. If Clutter::Script:filename-set is false then the value of this property is undefined.

Parameters:

  • filename (String)

Returns:

  • (String)

    filename

  • (String)

    filename

#filename_set=(filename_set) ⇒ Boolean

Whether the Clutter::Script:filename property is set. If this property is true then the currently parsed data comes from a file, and the file name is stored inside the Clutter::Script:filename property.

Parameters:

  • filename_set (Boolean)

Returns:

  • (Boolean)

    filename-set

  • (Boolean)

    filename-set

#filename_set?Boolean

Whether the Clutter::Script:filename property is set. If this property is true then the currently parsed data comes from a file, and the file name is stored inside the Clutter::Script:filename property.

Returns:

  • (Boolean)

    filename-set

#get_object(name) ⇒ GObject::Object

Retrieves the object bound to name. This function does not increment the reference count of the returned object.

Parameters:

  • name (String)

    the name of the object to retrieve

Returns:

  • (GObject::Object)

    the named object, or nil if no object with the given name was available

#get_objects(first_name, array) ⇒ Integer

Retrieves a list of objects for the given names. After script, object names/return location pairs should be listed, with a nil pointer ending the list, like:

|[ GObject *my_label, *a_button, *main_timeline;

clutter_script_get_objects (script, "my-label", &my_label, "a-button", &a_button, "main-timeline", &main_timeline, NULL); ]|

Note: This function does not increment the reference count of the returned objects.

Parameters:

  • first_name (String)

    the name of the first object to retrieve

  • array (Array)

    return location for a #GObject, then additional names, ending with nil

Returns:

  • (Integer)

    the number of objects returned.

#get_states(name) ⇒ Clutter::State

Retrieves the Clutter::State for the given state_name.

If name is nil, this function will return the default Clutter::State instance.

Parameters:

  • name (String)

    the name of the Clutter::State, or nil

Returns:

  • (Clutter::State)

    a pointer to the Clutter::State for the given name. The Clutter::State is owned by the #ClutterScript instance and it should not be unreferenced

#get_type_from_name(type_name) ⇒ GLib::Type

Looks up a type by name, using the virtual function that Clutter::Script has for that purpose. This function should rarely be used.

Parameters:

  • type_name (String)

    name of the type to look up

Returns:

  • (GLib::Type)

    the type for the requested type name, or %G_TYPE_INVALID if not corresponding type was found.

#list_objectsGLib::List<GObject::Object>

Retrieves all the objects created by script.

Note: this function does not increment the reference count of the objects it returns.

Returns:

  • (GLib::List<GObject::Object>)

    a list of #GObjects, or nil. The objects are owned by the Clutter::Script instance. Use g_list_free() on the returned list when done.

#load_from_data(data, length) ⇒ Integer

Loads the definitions from data into script and merges with the currently loaded ones, if any.

Parameters:

  • data (String)

    a buffer containing the definitions

  • length (Clutter::gssize)

    the length of the buffer, or -1 if data is a NUL-terminated buffer

Returns:

  • (Integer)

    on error, zero is returned and error is set accordingly. On success, the merge id for the UI definitions is returned. You can use the merge id with clutter_script_unmerge_objects().

#load_from_file(filename) ⇒ Integer

Loads the definitions from filename into script and merges with the currently loaded ones, if any.

Parameters:

  • filename (String)

    the full path to the definition file

Returns:

  • (Integer)

    on error, zero is returned and error is set accordingly. On success, the merge id for the UI definitions is returned. You can use the merge id with clutter_script_unmerge_objects().

#load_from_resource(resource_path) ⇒ Integer

Loads the definitions from a resource file into script and merges with the currently loaded ones, if any.

Parameters:

  • resource_path (String)

    the resource path of the file to parse

Returns:

  • (Integer)

    on error, zero is returned and error is set accordingly. On success, the merge id for the UI definitions is returned. You can use the merge id with clutter_script_unmerge_objects().

#lookup_filename(filename) ⇒ String

Looks up filename inside the search paths of script. If filename is found, its full path will be returned .

Parameters:

  • filename (String)

    the name of the file to lookup

Returns:

  • (String)

    the full path of filename or nil if no path was found.

#translation_domainString

The translation domain, used to localize strings marked as translatable inside a UI definition.

If Clutter::Script:translation-domain is set to nil, #ClutterScript will use gettext(), otherwise g_dgettext() will be used.

Returns:

  • (String)

    translation-domain

#translation_domain=(translation_domain) ⇒ String

The translation domain, used to localize strings marked as translatable inside a UI definition.

If Clutter::Script:translation-domain is set to nil, #ClutterScript will use gettext(), otherwise g_dgettext() will be used.

Parameters:

  • translation_domain (String)

Returns:

  • (String)

    translation-domain

  • (String)

    translation-domain

#unmerge_objects(merge_id) ⇒ nil

Unmerges the objects identified by merge_id.

Parameters:

  • merge_id (Integer)

    merge id returned when loading a UI definition

Returns:

  • (nil)