ClutterScriptable

ClutterScriptable — Override the UI definition parsing

Synopsis

                    ClutterScriptable;
                    ClutterScriptableIface;
void                clutter_scriptable_set_id           (ClutterScriptable *scriptable,
                                                         const gchar *id);
const gchar*        clutter_scriptable_get_id           (ClutterScriptable *scriptable);
gboolean            clutter_scriptable_parse_custom_node
                                                        (ClutterScriptable *scriptable,
                                                         ClutterScript *script,
                                                         GValue *value,
                                                         const gchar *name,
                                                         JsonNode *node);
void                clutter_scriptable_set_custom_property
                                                        (ClutterScriptable *scriptable,
                                                         ClutterScript *script,
                                                         const gchar *name,
                                                         const GValue *value);

Description

The ClutterScriptableIface interface exposes the UI definition parsing process to external classes. By implementing this interface, a class can override the UI definition parsing and transform complex data types into GObject properties, or allow custom properties.

ClutterScriptable is available since Clutter 0.6

Details

ClutterScriptable

typedef struct _ClutterScriptable ClutterScriptable;


ClutterScriptableIface

typedef struct {
  void         (* set_id)              (ClutterScriptable *scriptable,
                                        const gchar       *name);
  const gchar *(* get_id)              (ClutterScriptable *scriptable);

  gboolean     (* parse_custom_node)   (ClutterScriptable *scriptable,
                                        ClutterScript     *script,
                                        GValue            *value,
                                        const gchar       *name,
                                        JsonNode          *node);
  void         (* set_custom_property) (ClutterScriptable *scriptable,
                                        ClutterScript     *script,
                                        const gchar       *name,
                                        const GValue      *value);
} ClutterScriptableIface;

Interface for implementing "scriptable" objects. An object implementing this interface can override the parsing and properties setting sequence when loading a UI definition data with ClutterScript

set_id ()

virtual function for setting the id of a scriptable object

get_id ()

virtual function for getting the id of a scriptable object

parse_custom_node ()

virtual function for parsing complex data containers into GObject properties

set_custom_property ()

virtual function for setting a custom property

Since 0.6


clutter_scriptable_set_id ()

void                clutter_scriptable_set_id           (ClutterScriptable *scriptable,
                                                         const gchar *id);

Sets id as the unique Clutter script it for this instance of ClutterScriptableIface.

This name can be used by user interface designer applications to define a unique name for an object constructable using the UI definition language parsed by ClutterScript.

scriptable :

a ClutterScriptable

id :

the ClutterScript id of the object

Since 0.6


clutter_scriptable_get_id ()

const gchar*        clutter_scriptable_get_id           (ClutterScriptable *scriptable);

Retrieves the id of scriptable set using clutter_scriptable_set_id().

scriptable :

a ClutterScriptable

Returns :

the id of the object. The returned string is owned by the scriptable object and should never be modified of freed

Since 0.6


clutter_scriptable_parse_custom_node ()

gboolean            clutter_scriptable_parse_custom_node
                                                        (ClutterScriptable *scriptable,
                                                         ClutterScript *script,
                                                         GValue *value,
                                                         const gchar *name,
                                                         JsonNode *node);

Parses the passed JSON node. The implementation must set the type of the passed GValue pointer using g_value_init().

scriptable :

a ClutterScriptable

script :

the ClutterScript creating the scriptable instance

value :

the generic value to be set

name :

the name of the node

node :

the JSON node to be parsed

Returns :

TRUE if the node was successfully parsed, FALSE otherwise.

Since 0.6


clutter_scriptable_set_custom_property ()

void                clutter_scriptable_set_custom_property
                                                        (ClutterScriptable *scriptable,
                                                         ClutterScript *script,
                                                         const gchar *name,
                                                         const GValue *value);

Overrides the common properties setting. The underlying virtual function should be used when implementing custom properties.

scriptable :

a ClutterScriptable

script :

the ClutterScript creating the scriptable instance

name :

the name of the property

value :

the value of the property

Since 0.6