ClutterContent

ClutterContent — Delegate for painting the content of an actor

Signals

void attached Run First
void detached Run First

Types and Values

Object Hierarchy

    GInterface
    ╰── ClutterContent

Prerequisites

ClutterContent requires GObject.

Known Implementations

ClutterContent is implemented by ClutterCanvas and ClutterImage.

Description

ClutterContent is an interface to implement types responsible for painting the content of a ClutterActor.

Multiple actors can use the same ClutterContent instance, in order to share the resources associated with painting the same content.

ClutterContent is available since Clutter 1.10.

Functions

clutter_content_get_preferred_size ()

gboolean
clutter_content_get_preferred_size (ClutterContent *content,
                                    gfloat *width,
                                    gfloat *height);

Retrieves the natural size of the content , if any.

The natural size of a ClutterContent is defined as the size the content would have regardless of the allocation of the actor that is painting it, for instance the size of an image data.

Parameters

content

a ClutterContent

 

width

return location for the natural width of the content.

[out]

height

return location for the natural height of the content.

[out]

Returns

TRUE if the content has a preferred size, and FALSE otherwise

Since: 1.10


clutter_content_invalidate ()

void
clutter_content_invalidate (ClutterContent *content);

Invalidates a ClutterContent.

This function should be called by ClutterContent implementations when they change the way a the content should be painted regardless of the actor state.

Parameters

content

a ClutterContent

 

Since: 1.10

Types and Values

ClutterContent

typedef struct _ClutterContent ClutterContent;

The ClutterContent structure is an opaque type whose members cannot be acccessed directly.

Since: 1.10


struct ClutterContentIface

struct ClutterContentIface {
  gboolean      (* get_preferred_size)  (ClutterContent   *content,
                                         gfloat           *width,
                                         gfloat           *height);
  void          (* paint_content)       (ClutterContent   *content,
                                         ClutterActor     *actor,
                                         ClutterPaintNode *node);

  void          (* attached)            (ClutterContent   *content,
                                         ClutterActor     *actor);
  void          (* detached)            (ClutterContent   *content,
                                         ClutterActor     *actor);

  void          (* invalidate)          (ClutterContent   *content);
};

The ClutterContentIface structure contains only private data.

Members

get_preferred_size ()

virtual function; should be overridden by subclasses of ClutterContent that have a natural size

 

paint_content ()

virtual function; called each time the content needs to paint itself

 

attached ()

virtual function; called each time a ClutterContent is attached to a ClutterActor.

 

detached ()

virtual function; called each time a ClutterContent is detached from a ClutterActor.

 

invalidate ()

virtual function; called each time a ClutterContent state is changed.

 

Since: 1.10

Signal Details

The “attached” signal

void
user_function (ClutterContent *content,
               ClutterActor   *actor,
               gpointer        user_data)

This signal is emitted each time a ClutterContent implementation is assigned to a ClutterActor.

Parameters

content

the object that emitted the signal

 

actor

a ClutterActor

 

user_data

user data set when the signal handler was connected.

 

Flags: Run First

Since: 1.10


The “detached” signal

void
user_function (ClutterContent *content,
               ClutterActor   *actor,
               gpointer        user_data)

This signal is emitted each time a ClutterContent implementation is removed from a ClutterActor.

Parameters

content

the object that emitted the signal

 

actor

a ClutterActor

 

user_data

user data set when the signal handler was connected.

 

Flags: Run First

Since: 1.10