2007-11-28 Emmanuele Bassi <ebassi@openedhand.com>

* clutter/clutter-effect.[ch]: Add clutter_effect_template_construct()
	function, for language bindings that need to set the alpha function
	but cannot call the clutter_effect_template_new() ctor themselves.
This commit is contained in:
Emmanuele Bassi 2007-11-28 10:27:33 +00:00
parent 55d53acc8f
commit 04afb1066c
5 changed files with 74 additions and 122 deletions

View File

@ -1,4 +1,11 @@
2007-11-28 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-effect.[ch]: Add clutter_effect_template_construct()
function, for language bindings that need to set the alpha function
but cannot call the clutter_effect_template_new() ctor themselves.
2007-11-27 Tomas Frydrych <tf@openedhand.com>
* clutter/clutter-behaviour-ellipse.c:
* clutter/clutter-behaviour-ellipse.h:
(clutter_behaviour_ellipse_get_angle_startx):

View File

@ -82,7 +82,9 @@ G_DEFINE_TYPE (ClutterEffectTemplate, clutter_effect_template, G_TYPE_OBJECT);
struct _ClutterEffectTemplatePrivate
{
ClutterTimeline *timeline;
gboolean do_clone;
guint do_clone : 1;
guint dirty : 1;
ClutterAlphaFunc alpha_func;
gpointer alpha_data;
@ -93,7 +95,6 @@ enum
{
PROP_0,
PROP_ALPHA_FUNC,
PROP_TIMELINE,
PROP_DO_CLONE
};
@ -148,12 +149,8 @@ clutter_effect_template_set_property (GObject *object,
switch (prop_id)
{
case PROP_ALPHA_FUNC:
priv->alpha_func = g_value_get_pointer (value);
break;
case PROP_TIMELINE:
priv->timeline = g_value_get_object (value);
g_object_ref(priv->timeline);
priv->timeline = g_value_dup_object (value);
break;
case PROP_DO_CLONE:
clutter_effect_template_set_timeline_clone (template,
@ -179,9 +176,6 @@ clutter_effect_template_get_property (GObject *object,
switch (prop_id)
{
case PROP_ALPHA_FUNC:
g_value_set_pointer (value, priv->alpha_func);
break;
case PROP_TIMELINE:
g_value_set_object (value, priv->timeline);
break;
@ -206,21 +200,6 @@ clutter_effect_template_class_init (ClutterEffectTemplateClass *klass)
object_class->set_property = clutter_effect_template_set_property;
object_class->get_property = clutter_effect_template_get_property;
/**
* ClutterEffectTemplate:alpha-func:
*
* #ClutterAlphaFunc to be used by the template
*
* Since: 0.4
*/
g_object_class_install_property
(object_class,
PROP_ALPHA_FUNC,
g_param_spec_pointer ("alpha-func",
"Alpha-Function",
"Alpha reference Function",
G_PARAM_CONSTRUCT_ONLY |
CLUTTER_PARAM_READWRITE));
/**
* ClutterEffectTemplate:timeline:
*
@ -260,7 +239,9 @@ static void
clutter_effect_template_init (ClutterEffectTemplate *self)
{
self->priv = EFFECT_TEMPLATE_PRIVATE (self);
self->priv->do_clone = TRUE;
self->priv->dirty = TRUE;
}
static void
@ -282,6 +263,8 @@ clutter_effect_template_set_alpha_func (ClutterEffectTemplate *self,
priv->alpha_data = alpha_data;
priv->alpha_notify = alpha_notify;
priv->alpha_func = alpha_func;
priv->dirty = FALSE;
}
/**
@ -405,7 +388,9 @@ clutter_effect_template_new_full (ClutterTimeline *timeline,
"timeline", timeline,
NULL);
clutter_effect_template_set_alpha_func (retval, alpha_func, user_data, notify);
clutter_effect_template_set_alpha_func (retval,
alpha_func,
user_data, notify);
return retval;
}
@ -452,6 +437,49 @@ clutter_effect_template_new_for_duration (guint msecs,
return retval;
}
/**
* clutter_effect_template_construct:
* @template_: a #ClutterEffectTemplate
* @timeline: a #ClutterTimeline
* @alpha_func: an alpha function to use for the template
* @user_data: data to be passed to the alpha function, or %NULL
* @notify: function to be called when disposing the alpha function's use
* data, or %NULL
*
* Constructs a #ClutterEffectTemplate, to be used with the effects API.
*
* This function can only be called once after the creation of @template_
* and is only useful for language bindings.
*
* Since: 0.6
*/
void
clutter_effect_template_construct (ClutterEffectTemplate *template_,
ClutterTimeline *timeline,
ClutterAlphaFunc alpha_func,
gpointer user_data,
GDestroyNotify notify)
{
ClutterEffectTemplatePrivate *priv;
g_return_if_fail (CLUTTER_IS_EFFECT_TEMPLATE (template_));
g_return_if_fail (CLUTTER_IS_TIMELINE (timeline));
g_return_if_fail (alpha_func != NULL);
if (!template_->priv->dirty)
return;
priv = template_->priv;
if (priv->timeline)
g_object_unref (priv->timeline);
priv->timeline = g_object_ref (timeline);
clutter_effect_template_set_alpha_func (template_,
alpha_func,
user_data, notify);
}
static void
clutter_effect_closure_destroy (ClutterEffectClosure *c)
{

View File

@ -102,6 +102,11 @@ ClutterEffectTemplate *clutter_effect_template_new_full (ClutterTimeli
GDestroyNotify notify);
ClutterEffectTemplate *clutter_effect_template_new_for_duration (guint msecs,
ClutterAlphaFunc alpha_func);
void clutter_effect_template_construct (ClutterEffectTemplate *template_,
ClutterTimeline *timeline,
ClutterAlphaFunc alpha_func,
gpointer user_data,
GDestroyNotify notify);
void clutter_effect_template_set_timeline_clone (ClutterEffectTemplate *template_,
gboolean setting);
gboolean clutter_effect_template_get_timeline_clone (ClutterEffectTemplate *template_);

View File

@ -1,3 +1,8 @@
2007-11-28 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-sections.txt: Add the new ClutterEffectTemplate::construct
method.
2007-11-23 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-docs.sgml: Shuffle around non-actor classes.

View File

@ -235,31 +235,6 @@ CLUTTER_CONTAINER_GET_IFACE
clutter_container_get_type
</SECTION>
<SECTION>
<FILE>clutter-layout</FILE>
<TITLE>ClutterLayout</TITLE>
ClutterLayout
ClutterLayoutIface
ClutterLayoutFlags
CLUTTER_LAYOUT_HAS
CLUTTER_LAYOUT_HAS_HEIGHT_FOR_WIDTH
CLUTTER_LAYOUT_HAS_NATURAL_SIZE
CLUTTER_LAYOUT_HAS_TUNABLE_SIZE
CLUTTER_LAYOUT_HAS_WIDTH_FOR_HEIGHT
clutter_layout_get_layout_flags
clutter_layout_height_for_width
clutter_layout_natural_request
clutter_layout_tune_request
clutter_layout_width_for_height
<SUBSECTION Standard>
CLUTTER_TYPE_LAYOUT
CLUTTER_LAYOUT
CLUTTER_IS_LAYOUT
CLUTTER_LAYOUT_GET_IFACE
<SUBSECTION Private>
clutter_layout_get_type
</SECTION>
<SECTION>
<FILE>clutter-rectangle</FILE>
<TITLE>ClutterRectangle</TITLE>
@ -1020,41 +995,6 @@ ClutterEntryPrivate
clutter_entry_get_type
</SECTION>
<SECTION>
<FILE>clutter-box</FILE>
<TITLE>ClutterBox</TITLE>
ClutterBox
ClutterBoxClass
ClutterPackType
clutter_box_set_color
clutter_box_get_color
ClutterPadding
clutter_box_pack
clutter_box_set_default_padding
clutter_box_get_default_padding
clutter_box_pack_defaults
clutter_box_remove_all
ClutterMargin
clutter_box_set_margin
clutter_box_get_margin
ClutterBoxChild
clutter_box_query_child
clutter_box_query_nth_child
<SUBSECTION Standard>
CLUTTER_TYPE_BOX
CLUTTER_BOX
CLUTTER_IS_BOX
CLUTTER_BOX_CLASS
CLUTTER_IS_BOX_CLASS
CLUTTER_BOX_GET_CLASS
CLUTTER_TYPE_MARGIN
CLUTTER_TYPE_PADDING
<SUBSECTION Private>
clutter_box_get_type
clutter_margin_get_type
clutter_padding_get_type
</SECTION>
<SECTION>
<FILE>clutter-effect</FILE>
<TITLE>Clutter Effects</TITLE>
@ -1063,6 +1003,7 @@ ClutterEffectTemplateClass
clutter_effect_template_new
clutter_effect_template_new_full
clutter_effect_template_new_for_duration
clutter_effect_template_construct
clutter_effect_template_get_timeline_clone
clutter_effect_template_set_timeline_clone
@ -1087,40 +1028,6 @@ ClutterEffectTemplatePrivate
clutter_effect_template_get_type
</SECTION>
<SECTION>
<FILE>clutter-hbox</FILE>
<TITLE>ClutterHBox</TITLE>
ClutterHBox
ClutterHBoxClass
clutter_hbox_new
<SUBSECTION Standard>
CLUTTER_TYPE_HBOX
CLUTTER_HBOX
CLUTTER_IS_HBOX
CLUTTER_HBOX_CLASS
CLUTTER_IS_HBOX_CLASS
CLUTTER_HBOX_GET_CLASS
<SUBSECTION Private>
clutter_hbox_get_type
</SECTION>
<SECTION>
<FILE>clutter-vbox</FILE>
<TITLE>ClutterVBox</TITLE>
ClutterVBox
ClutterVBoxClass
clutter_vbox_new
<SUBSECTION Standard>
CLUTTER_TYPE_VBOX
CLUTTER_VBOX
CLUTTER_IS_VBOX
CLUTTER_VBOX_CLASS
CLUTTER_IS_VBOX_CLASS
CLUTTER_VBOX_GET_CLASS
<SUBSECTION Private>
clutter_vbox_get_type
</SECTION>
<SECTION>
<FILE>clutter-behaviour-depth</FILE>
<TITLE>ClutterBehaviourDepth</TITLE>