mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
2008-11-17 Emmanuele Bassi <ebassi@linux.intel.com>
* clutter/clutter-entry.c: * clutter/clutter-label.c: * clutter/clutter-rectangle.c: * clutter/clutter-script.c: * clutter/clutter-stage.c: Use the ParamSpecColor and GValue API for ClutterColor-based properties.
This commit is contained in:
parent
3e6993ad43
commit
87a43f3375
@ -1,3 +1,12 @@
|
|||||||
|
2008-11-17 Emmanuele Bassi <ebassi@linux.intel.com>
|
||||||
|
|
||||||
|
* clutter/clutter-entry.c:
|
||||||
|
* clutter/clutter-label.c:
|
||||||
|
* clutter/clutter-rectangle.c:
|
||||||
|
* clutter/clutter-script.c:
|
||||||
|
* clutter/clutter-stage.c: Use the ParamSpecColor and GValue
|
||||||
|
API for ClutterColor-based properties.
|
||||||
|
|
||||||
2008-11-14 Robert Bragg <ebassi@linux.intel.com>
|
2008-11-14 Robert Bragg <ebassi@linux.intel.com>
|
||||||
|
|
||||||
* tests/interactive/Makefile.am
|
* tests/interactive/Makefile.am
|
||||||
|
@ -61,6 +61,8 @@ G_DEFINE_TYPE (ClutterEntry, clutter_entry, CLUTTER_TYPE_ACTOR);
|
|||||||
/* Probably move into main */
|
/* Probably move into main */
|
||||||
static PangoContext *_context = NULL;
|
static PangoContext *_context = NULL;
|
||||||
|
|
||||||
|
static const ClutterColor default_text_color = { 0, 0, 0, 255 };
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
PROP_0,
|
PROP_0,
|
||||||
@ -170,7 +172,7 @@ clutter_entry_set_property (GObject *object,
|
|||||||
clutter_entry_set_text (entry, g_value_get_string (value));
|
clutter_entry_set_text (entry, g_value_get_string (value));
|
||||||
break;
|
break;
|
||||||
case PROP_COLOR:
|
case PROP_COLOR:
|
||||||
clutter_entry_set_color (entry, g_value_get_boxed (value));
|
clutter_entry_set_color (entry, clutter_value_get_color (value));
|
||||||
break;
|
break;
|
||||||
case PROP_ALIGNMENT:
|
case PROP_ALIGNMENT:
|
||||||
clutter_entry_set_alignment (entry, g_value_get_enum (value));
|
clutter_entry_set_alignment (entry, g_value_get_enum (value));
|
||||||
@ -208,7 +210,6 @@ clutter_entry_get_property (GObject *object,
|
|||||||
{
|
{
|
||||||
ClutterEntry *entry;
|
ClutterEntry *entry;
|
||||||
ClutterEntryPrivate *priv;
|
ClutterEntryPrivate *priv;
|
||||||
ClutterColor color;
|
|
||||||
|
|
||||||
entry = CLUTTER_ENTRY(object);
|
entry = CLUTTER_ENTRY(object);
|
||||||
priv = entry->priv;
|
priv = entry->priv;
|
||||||
@ -222,8 +223,7 @@ clutter_entry_get_property (GObject *object,
|
|||||||
g_value_set_string (value, priv->text);
|
g_value_set_string (value, priv->text);
|
||||||
break;
|
break;
|
||||||
case PROP_COLOR:
|
case PROP_COLOR:
|
||||||
clutter_entry_get_color (entry, &color);
|
clutter_value_set_color (value, &priv->fgcol);
|
||||||
g_value_set_boxed (value, &color);
|
|
||||||
break;
|
break;
|
||||||
case PROP_ALIGNMENT:
|
case PROP_ALIGNMENT:
|
||||||
g_value_set_enum (value, priv->alignment);
|
g_value_set_enum (value, priv->alignment);
|
||||||
@ -671,6 +671,7 @@ clutter_entry_class_init (ClutterEntryClass *klass)
|
|||||||
{
|
{
|
||||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||||
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
|
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
|
||||||
|
GParamSpec *pspec;
|
||||||
|
|
||||||
klass->paint_cursor = clutter_entry_paint_cursor;
|
klass->paint_cursor = clutter_entry_paint_cursor;
|
||||||
|
|
||||||
@ -719,13 +720,12 @@ clutter_entry_class_init (ClutterEntryClass *klass)
|
|||||||
*
|
*
|
||||||
* Since: 0.4
|
* Since: 0.4
|
||||||
*/
|
*/
|
||||||
g_object_class_install_property
|
pspec = clutter_param_spec_color ("color",
|
||||||
(gobject_class, PROP_COLOR,
|
"Color",
|
||||||
g_param_spec_boxed ("color",
|
"The color of the text",
|
||||||
"Font Colour",
|
&default_text_color,
|
||||||
"Font Colour",
|
CLUTTER_PARAM_READWRITE);
|
||||||
CLUTTER_TYPE_COLOR,
|
g_object_class_install_property (gobject_class, PROP_COLOR, pspec);
|
||||||
CLUTTER_PARAM_READWRITE));
|
|
||||||
/**
|
/**
|
||||||
* ClutterEntry:alignment:
|
* ClutterEntry:alignment:
|
||||||
*
|
*
|
||||||
@ -923,10 +923,7 @@ clutter_entry_init (ClutterEntry *self)
|
|||||||
priv->entry_padding = ENTRY_PADDING;
|
priv->entry_padding = ENTRY_PADDING;
|
||||||
priv->x_align = 0.0;
|
priv->x_align = 0.0;
|
||||||
|
|
||||||
priv->fgcol.red = 0;
|
priv->fgcol = default_text_color;
|
||||||
priv->fgcol.green = 0;
|
|
||||||
priv->fgcol.blue = 0;
|
|
||||||
priv->fgcol.alpha = 255;
|
|
||||||
|
|
||||||
priv->font_name = g_strdup (DEFAULT_FONT_NAME);
|
priv->font_name = g_strdup (DEFAULT_FONT_NAME);
|
||||||
priv->desc = pango_font_description_from_string (priv->font_name);
|
priv->desc = pango_font_description_from_string (priv->font_name);
|
||||||
|
@ -50,6 +50,8 @@ G_DEFINE_TYPE (ClutterLabel, clutter_label, CLUTTER_TYPE_ACTOR)
|
|||||||
/* Probably move into main */
|
/* Probably move into main */
|
||||||
static PangoContext *_context = NULL;
|
static PangoContext *_context = NULL;
|
||||||
|
|
||||||
|
static const ClutterColor default_text_color = { 0, 0, 0, 255 };
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
PROP_0,
|
PROP_0,
|
||||||
@ -98,6 +100,12 @@ struct _ClutterLabelPrivate
|
|||||||
|
|
||||||
gchar *text;
|
gchar *text;
|
||||||
gchar *font_name;
|
gchar *font_name;
|
||||||
|
|
||||||
|
PangoAttrList *attrs;
|
||||||
|
PangoAttrList *effective_attrs;
|
||||||
|
|
||||||
|
ClutterLabelCachedLayout cached_layouts[CLUTTER_LABEL_N_CACHED_LAYOUTS];
|
||||||
|
guint cache_age;
|
||||||
|
|
||||||
guint alignment : 2;
|
guint alignment : 2;
|
||||||
guint wrap : 1;
|
guint wrap : 1;
|
||||||
@ -107,12 +115,6 @@ struct _ClutterLabelPrivate
|
|||||||
guint single_line_mode : 1;
|
guint single_line_mode : 1;
|
||||||
guint wrap_mode : 3;
|
guint wrap_mode : 3;
|
||||||
guint justify : 1;
|
guint justify : 1;
|
||||||
|
|
||||||
PangoAttrList *attrs;
|
|
||||||
PangoAttrList *effective_attrs;
|
|
||||||
|
|
||||||
ClutterLabelCachedLayout cached_layouts[CLUTTER_LABEL_N_CACHED_LAYOUTS];
|
|
||||||
guint cache_age;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -441,7 +443,7 @@ clutter_label_set_property (GObject *object,
|
|||||||
clutter_label_set_text (label, g_value_get_string (value));
|
clutter_label_set_text (label, g_value_get_string (value));
|
||||||
break;
|
break;
|
||||||
case PROP_COLOR:
|
case PROP_COLOR:
|
||||||
clutter_label_set_color (label, g_value_get_boxed (value));
|
clutter_label_set_color (label, clutter_value_get_color (value));
|
||||||
break;
|
break;
|
||||||
case PROP_ATTRIBUTES:
|
case PROP_ATTRIBUTES:
|
||||||
clutter_label_set_attributes (label, g_value_get_boxed (value));
|
clutter_label_set_attributes (label, g_value_get_boxed (value));
|
||||||
@ -478,7 +480,6 @@ clutter_label_get_property (GObject *object,
|
|||||||
{
|
{
|
||||||
ClutterLabel *label;
|
ClutterLabel *label;
|
||||||
ClutterLabelPrivate *priv;
|
ClutterLabelPrivate *priv;
|
||||||
ClutterColor color;
|
|
||||||
|
|
||||||
label = CLUTTER_LABEL (object);
|
label = CLUTTER_LABEL (object);
|
||||||
priv = label->priv;
|
priv = label->priv;
|
||||||
@ -492,8 +493,7 @@ clutter_label_get_property (GObject *object,
|
|||||||
g_value_set_string (value, priv->text);
|
g_value_set_string (value, priv->text);
|
||||||
break;
|
break;
|
||||||
case PROP_COLOR:
|
case PROP_COLOR:
|
||||||
clutter_label_get_color (label, &color);
|
clutter_value_set_color (value, &priv->fgcol);
|
||||||
g_value_set_boxed (value, &color);
|
|
||||||
break;
|
break;
|
||||||
case PROP_ATTRIBUTES:
|
case PROP_ATTRIBUTES:
|
||||||
g_value_set_boxed (value, priv->attrs);
|
g_value_set_boxed (value, priv->attrs);
|
||||||
@ -527,6 +527,7 @@ clutter_label_class_init (ClutterLabelClass *klass)
|
|||||||
{
|
{
|
||||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||||
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
|
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
|
||||||
|
GParamSpec *pspec;
|
||||||
|
|
||||||
actor_class->paint = clutter_label_paint;
|
actor_class->paint = clutter_label_paint;
|
||||||
actor_class->get_preferred_width = clutter_label_get_preferred_width;
|
actor_class->get_preferred_width = clutter_label_get_preferred_width;
|
||||||
@ -538,76 +539,119 @@ clutter_label_class_init (ClutterLabelClass *klass)
|
|||||||
gobject_class->set_property = clutter_label_set_property;
|
gobject_class->set_property = clutter_label_set_property;
|
||||||
gobject_class->get_property = clutter_label_get_property;
|
gobject_class->get_property = clutter_label_get_property;
|
||||||
|
|
||||||
g_object_class_install_property
|
/**
|
||||||
(gobject_class, PROP_FONT_NAME,
|
* ClutterLabel:font-name:
|
||||||
g_param_spec_string ("font-name",
|
*
|
||||||
"Font Name",
|
* The font to be used by the #ClutterLabel, as a string
|
||||||
"Pango font description",
|
* that can be parsed by pango_font_description_from_string().
|
||||||
NULL,
|
*
|
||||||
CLUTTER_PARAM_READWRITE));
|
* Since: 0.2
|
||||||
g_object_class_install_property
|
*/
|
||||||
(gobject_class, PROP_TEXT,
|
pspec = g_param_spec_string ("font-name",
|
||||||
g_param_spec_string ("text",
|
"Font Name",
|
||||||
"Text",
|
"The font to be used by the label",
|
||||||
"Text to render",
|
NULL,
|
||||||
NULL,
|
CLUTTER_PARAM_READWRITE);
|
||||||
CLUTTER_PARAM_READWRITE));
|
g_object_class_install_property (gobject_class, PROP_FONT_NAME, pspec);
|
||||||
g_object_class_install_property
|
|
||||||
(gobject_class, PROP_COLOR,
|
pspec = g_param_spec_string ("text",
|
||||||
g_param_spec_boxed ("color",
|
"Text",
|
||||||
"Font Colour",
|
"The text to render",
|
||||||
"Font Colour",
|
NULL,
|
||||||
CLUTTER_TYPE_COLOR,
|
CLUTTER_PARAM_READWRITE);
|
||||||
CLUTTER_PARAM_READWRITE));
|
g_object_class_install_property (gobject_class, PROP_TEXT, pspec);
|
||||||
g_object_class_install_property
|
|
||||||
(gobject_class, PROP_ATTRIBUTES,
|
pspec = clutter_param_spec_color ("color",
|
||||||
g_param_spec_boxed ("attributes",
|
"Font Color",
|
||||||
"Attributes",
|
"Color of the font used by the label",
|
||||||
"A list of style attributes to apply to the "
|
&default_text_color,
|
||||||
"text of the label",
|
CLUTTER_PARAM_READWRITE);
|
||||||
PANGO_TYPE_ATTR_LIST,
|
g_object_class_install_property (gobject_class, PROP_COLOR, pspec);
|
||||||
CLUTTER_PARAM_READWRITE));
|
|
||||||
g_object_class_install_property
|
pspec = g_param_spec_boxed ("attributes",
|
||||||
(gobject_class, PROP_USE_MARKUP,
|
"Attributes",
|
||||||
g_param_spec_boolean ("use-markup",
|
"A list of style attributes to apply to "
|
||||||
"Use markup",
|
"the text of the label",
|
||||||
"The text of the label includes XML markup. "
|
PANGO_TYPE_ATTR_LIST,
|
||||||
"See pango_parse_markup()",
|
CLUTTER_PARAM_READWRITE);
|
||||||
FALSE,
|
g_object_class_install_property (gobject_class, PROP_ATTRIBUTES, pspec);
|
||||||
CLUTTER_PARAM_READWRITE));
|
|
||||||
g_object_class_install_property
|
/**
|
||||||
(gobject_class, PROP_WRAP,
|
* ClutterLabel:use-markup:
|
||||||
g_param_spec_boolean ("wrap",
|
*
|
||||||
"Line wrap",
|
* Whether the text of the label includes Pango markup. See
|
||||||
"If set, wrap lines if the text becomes too wide",
|
* pango_layout_set_markup() in the Pango documentation.
|
||||||
FALSE,
|
*
|
||||||
CLUTTER_PARAM_READWRITE));
|
* Since: 0.2
|
||||||
g_object_class_install_property
|
*/
|
||||||
(gobject_class, PROP_WRAP_MODE,
|
pspec = g_param_spec_boolean ("use-markup",
|
||||||
g_param_spec_enum ("wrap-mode",
|
"Use markup",
|
||||||
"Line wrap mode",
|
"Whether or not the text of the label "
|
||||||
"If wrap is set, controls how line-wrapping is done",
|
"includes Pango markup",
|
||||||
PANGO_TYPE_WRAP_MODE,
|
FALSE,
|
||||||
PANGO_WRAP_WORD,
|
CLUTTER_PARAM_READWRITE);
|
||||||
CLUTTER_PARAM_READWRITE));
|
g_object_class_install_property (gobject_class, PROP_USE_MARKUP, pspec);
|
||||||
g_object_class_install_property
|
|
||||||
(gobject_class, PROP_ELLIPSIZE,
|
/**
|
||||||
g_param_spec_enum ( "ellipsize",
|
* ClutterLabel:wrap:
|
||||||
"Ellipsize",
|
*
|
||||||
"The preferred place to ellipsize the string, "
|
* Whether to wrap the lines of #ClutterLabel:text if the contents
|
||||||
"if the label does not have enough room to "
|
* exceed the available allocation. The wrapping strategy is
|
||||||
"display the entire string",
|
* controlled by the #ClutterLabel:wrap-mode property.
|
||||||
PANGO_TYPE_ELLIPSIZE_MODE,
|
*
|
||||||
PANGO_ELLIPSIZE_NONE,
|
* Since: 0.2
|
||||||
CLUTTER_PARAM_READWRITE));
|
*/
|
||||||
g_object_class_install_property
|
pspec = g_param_spec_boolean ("wrap",
|
||||||
(gobject_class, PROP_ALIGNMENT,
|
"Line wrap",
|
||||||
g_param_spec_enum ( "alignment",
|
"If set, wrap the lines if the text "
|
||||||
"Alignment",
|
"becomes too wide",
|
||||||
"The preferred alignment for the string",
|
FALSE,
|
||||||
PANGO_TYPE_ALIGNMENT,
|
CLUTTER_PARAM_READWRITE);
|
||||||
PANGO_ALIGN_LEFT,
|
g_object_class_install_property (gobject_class, PROP_WRAP, pspec);
|
||||||
CLUTTER_PARAM_READWRITE));
|
|
||||||
|
/**
|
||||||
|
* ClutterLabel:wrap-mode:
|
||||||
|
*
|
||||||
|
* If #ClutterLabel:wrap is set to %TRUE, this property will
|
||||||
|
* control how the text is wrapped.
|
||||||
|
*
|
||||||
|
* Since: 0.2
|
||||||
|
*/
|
||||||
|
pspec = g_param_spec_enum ("wrap-mode",
|
||||||
|
"Line wrap mode",
|
||||||
|
"Control how line-wrapping is done",
|
||||||
|
PANGO_TYPE_WRAP_MODE,
|
||||||
|
PANGO_WRAP_WORD,
|
||||||
|
CLUTTER_PARAM_READWRITE);
|
||||||
|
g_object_class_install_property (gobject_class, PROP_WRAP_MODE, pspec);
|
||||||
|
|
||||||
|
pspec = g_param_spec_enum ("ellipsize",
|
||||||
|
"Ellipsize",
|
||||||
|
"The preferred place to ellipsize the string, "
|
||||||
|
"if the label does not have enough room to "
|
||||||
|
"display the entire string",
|
||||||
|
PANGO_TYPE_ELLIPSIZE_MODE,
|
||||||
|
PANGO_ELLIPSIZE_NONE,
|
||||||
|
CLUTTER_PARAM_READWRITE);
|
||||||
|
g_object_class_install_property (gobject_class, PROP_ELLIPSIZE, pspec);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ClutterLabel:alignment:
|
||||||
|
*
|
||||||
|
* The preferred alignment for the text. This property controls
|
||||||
|
* the alignment of multi-line paragraphs.
|
||||||
|
*
|
||||||
|
* Since: 0.2
|
||||||
|
*/
|
||||||
|
pspec = g_param_spec_enum ("alignment",
|
||||||
|
"Alignment",
|
||||||
|
"The preferred alignment for the string, "
|
||||||
|
"for multi-line text",
|
||||||
|
PANGO_TYPE_ALIGNMENT,
|
||||||
|
PANGO_ALIGN_LEFT,
|
||||||
|
CLUTTER_PARAM_READWRITE);
|
||||||
|
g_object_class_install_property (gobject_class, PROP_ALIGNMENT, pspec);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClutterLabel:justify:
|
* ClutterLabel:justify:
|
||||||
*
|
*
|
||||||
@ -616,13 +660,13 @@ clutter_label_class_init (ClutterLabelClass *klass)
|
|||||||
*
|
*
|
||||||
* Since: 0.6
|
* Since: 0.6
|
||||||
*/
|
*/
|
||||||
g_object_class_install_property (gobject_class,
|
pspec = g_param_spec_boolean ("justify",
|
||||||
PROP_JUSTIFY,
|
"Justify",
|
||||||
g_param_spec_boolean ("justify",
|
"Whether the contents of the label "
|
||||||
"Justify",
|
"should be justified",
|
||||||
"Whether the contents of the label should be justified",
|
FALSE,
|
||||||
FALSE,
|
CLUTTER_PARAM_READWRITE);
|
||||||
CLUTTER_PARAM_READWRITE));
|
g_object_class_install_property (gobject_class, PROP_JUSTIFY, pspec);
|
||||||
|
|
||||||
g_type_class_add_private (gobject_class, sizeof (ClutterLabelPrivate));
|
g_type_class_add_private (gobject_class, sizeof (ClutterLabelPrivate));
|
||||||
}
|
}
|
||||||
@ -652,10 +696,7 @@ clutter_label_init (ClutterLabel *self)
|
|||||||
priv->text = NULL;
|
priv->text = NULL;
|
||||||
priv->attrs = NULL;
|
priv->attrs = NULL;
|
||||||
|
|
||||||
priv->fgcol.red = 0;
|
priv->fgcol = default_text_color;
|
||||||
priv->fgcol.green = 0;
|
|
||||||
priv->fgcol.blue = 0;
|
|
||||||
priv->fgcol.alpha = 255;
|
|
||||||
|
|
||||||
priv->font_name = g_strdup (DEFAULT_FONT_NAME);
|
priv->font_name = g_strdup (DEFAULT_FONT_NAME);
|
||||||
priv->font_desc = pango_font_description_from_string (priv->font_name);
|
priv->font_desc = pango_font_description_from_string (priv->font_name);
|
||||||
|
@ -33,10 +33,11 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "clutter-rectangle.h"
|
#include "clutter-color.h"
|
||||||
|
#include "clutter-debug.h"
|
||||||
#include "clutter-main.h"
|
#include "clutter-main.h"
|
||||||
#include "clutter-private.h"
|
#include "clutter-private.h"
|
||||||
#include "clutter-debug.h"
|
#include "clutter-rectangle.h"
|
||||||
|
|
||||||
#include "cogl/cogl.h"
|
#include "cogl/cogl.h"
|
||||||
|
|
||||||
@ -67,6 +68,9 @@ struct _ClutterRectanglePrivate
|
|||||||
guint has_border : 1;
|
guint has_border : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const ClutterColor default_color = { 255, 255, 255, 255 };
|
||||||
|
static const ClutterColor default_border_color = { 0, 0, 0, 255 };
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_rectangle_paint (ClutterActor *self)
|
clutter_rectangle_paint (ClutterActor *self)
|
||||||
{
|
{
|
||||||
@ -163,11 +167,11 @@ clutter_rectangle_set_property (GObject *object,
|
|||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
case PROP_COLOR:
|
case PROP_COLOR:
|
||||||
clutter_rectangle_set_color (rectangle, g_value_get_boxed (value));
|
clutter_rectangle_set_color (rectangle, clutter_value_get_color (value));
|
||||||
break;
|
break;
|
||||||
case PROP_BORDER_COLOR:
|
case PROP_BORDER_COLOR:
|
||||||
clutter_rectangle_set_border_color (rectangle,
|
clutter_rectangle_set_border_color (rectangle,
|
||||||
g_value_get_boxed (value));
|
clutter_value_get_color (value));
|
||||||
break;
|
break;
|
||||||
case PROP_BORDER_WIDTH:
|
case PROP_BORDER_WIDTH:
|
||||||
clutter_rectangle_set_border_width (rectangle,
|
clutter_rectangle_set_border_width (rectangle,
|
||||||
@ -188,24 +192,21 @@ clutter_rectangle_get_property (GObject *object,
|
|||||||
GValue *value,
|
GValue *value,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
ClutterRectangle *rectangle = CLUTTER_RECTANGLE(object);
|
ClutterRectanglePrivate *priv = CLUTTER_RECTANGLE(object)->priv;
|
||||||
ClutterColor color;
|
|
||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
case PROP_COLOR:
|
case PROP_COLOR:
|
||||||
clutter_rectangle_get_color (rectangle, &color);
|
clutter_value_set_color (value, &priv->color);
|
||||||
g_value_set_boxed (value, &color);
|
|
||||||
break;
|
break;
|
||||||
case PROP_BORDER_COLOR:
|
case PROP_BORDER_COLOR:
|
||||||
clutter_rectangle_get_border_color (rectangle, &color);
|
clutter_value_set_color (value, &priv->border_color);
|
||||||
g_value_set_boxed (value, &color);
|
|
||||||
break;
|
break;
|
||||||
case PROP_BORDER_WIDTH:
|
case PROP_BORDER_WIDTH:
|
||||||
g_value_set_uint (value, rectangle->priv->border_width);
|
g_value_set_uint (value, priv->border_width);
|
||||||
break;
|
break;
|
||||||
case PROP_HAS_BORDER:
|
case PROP_HAS_BORDER:
|
||||||
g_value_set_boolean (value, rectangle->priv->has_border);
|
g_value_set_boolean (value, priv->has_border);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
@ -230,8 +231,9 @@ clutter_rectangle_dispose (GObject *object)
|
|||||||
static void
|
static void
|
||||||
clutter_rectangle_class_init (ClutterRectangleClass *klass)
|
clutter_rectangle_class_init (ClutterRectangleClass *klass)
|
||||||
{
|
{
|
||||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||||
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
|
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
|
||||||
|
GParamSpec *pspec;
|
||||||
|
|
||||||
actor_class->paint = clutter_rectangle_paint;
|
actor_class->paint = clutter_rectangle_paint;
|
||||||
|
|
||||||
@ -245,13 +247,13 @@ clutter_rectangle_class_init (ClutterRectangleClass *klass)
|
|||||||
*
|
*
|
||||||
* The color of the rectangle.
|
* The color of the rectangle.
|
||||||
*/
|
*/
|
||||||
g_object_class_install_property (gobject_class,
|
pspec = clutter_param_spec_color ("color",
|
||||||
PROP_COLOR,
|
"Color",
|
||||||
g_param_spec_boxed ("color",
|
"The color of the rectangle",
|
||||||
"Color",
|
&default_color,
|
||||||
"The color of the rectangle",
|
CLUTTER_PARAM_READWRITE);
|
||||||
CLUTTER_TYPE_COLOR,
|
g_object_class_install_property (gobject_class, PROP_COLOR, pspec);
|
||||||
CLUTTER_PARAM_READWRITE));
|
|
||||||
/**
|
/**
|
||||||
* ClutterRectangle:border-color:
|
* ClutterRectangle:border-color:
|
||||||
*
|
*
|
||||||
@ -259,13 +261,13 @@ clutter_rectangle_class_init (ClutterRectangleClass *klass)
|
|||||||
*
|
*
|
||||||
* Since: 0.2
|
* Since: 0.2
|
||||||
*/
|
*/
|
||||||
g_object_class_install_property (gobject_class,
|
pspec = clutter_param_spec_color ("border-color",
|
||||||
PROP_BORDER_COLOR,
|
"Border Color",
|
||||||
g_param_spec_boxed ("border-color",
|
"The color of the border of the rectangle",
|
||||||
"Border Color",
|
&default_border_color,
|
||||||
"The color of the border of the rectangle",
|
CLUTTER_PARAM_READWRITE);
|
||||||
CLUTTER_TYPE_COLOR,
|
g_object_class_install_property (gobject_class, PROP_BORDER_COLOR, pspec);
|
||||||
CLUTTER_PARAM_READWRITE));
|
|
||||||
/**
|
/**
|
||||||
* ClutterRectangle:border-width:
|
* ClutterRectangle:border-width:
|
||||||
*
|
*
|
||||||
@ -306,15 +308,8 @@ clutter_rectangle_init (ClutterRectangle *self)
|
|||||||
|
|
||||||
self->priv = priv = CLUTTER_RECTANGLE_GET_PRIVATE (self);
|
self->priv = priv = CLUTTER_RECTANGLE_GET_PRIVATE (self);
|
||||||
|
|
||||||
priv->color.red = 0xff;
|
priv->color = default_color;
|
||||||
priv->color.green = 0xff;
|
priv->border_color = default_border_color;
|
||||||
priv->color.blue = 0xff;
|
|
||||||
priv->color.alpha = 0xff;
|
|
||||||
|
|
||||||
priv->border_color.red = 0x00;
|
|
||||||
priv->border_color.green = 0x00;
|
|
||||||
priv->border_color.blue = 0x00;
|
|
||||||
priv->border_color.alpha = 0xff;
|
|
||||||
|
|
||||||
priv->border_width = 0;
|
priv->border_width = 0;
|
||||||
|
|
||||||
|
@ -882,7 +882,7 @@ clutter_script_parse_node (ClutterScript *script,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (G_VALUE_HOLDS (value, CLUTTER_TYPE_COLOR))
|
else if (CLUTTER_VALUE_HOLDS_COLOR (value))
|
||||||
{
|
{
|
||||||
ClutterColor color = { 0, };
|
ClutterColor color = { 0, };
|
||||||
|
|
||||||
@ -934,7 +934,7 @@ clutter_script_parse_node (ClutterScript *script,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (G_VALUE_HOLDS (value, CLUTTER_TYPE_COLOR))
|
else if (CLUTTER_VALUE_HOLDS_COLOR (value))
|
||||||
{
|
{
|
||||||
ClutterColor color = { 0, };
|
ClutterColor color = { 0, };
|
||||||
|
|
||||||
|
@ -120,6 +120,8 @@ enum
|
|||||||
|
|
||||||
static guint stage_signals[LAST_SIGNAL] = { 0, };
|
static guint stage_signals[LAST_SIGNAL] = { 0, };
|
||||||
|
|
||||||
|
static const ClutterColor default_stage_color = { 255, 255, 255, 255 };
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_stage_get_preferred_width (ClutterActor *self,
|
clutter_stage_get_preferred_width (ClutterActor *self,
|
||||||
ClutterUnit for_height,
|
ClutterUnit for_height,
|
||||||
@ -354,7 +356,7 @@ clutter_stage_set_property (GObject *object,
|
|||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
case PROP_COLOR:
|
case PROP_COLOR:
|
||||||
clutter_stage_set_color (stage, g_value_get_boxed (value));
|
clutter_stage_set_color (stage, clutter_value_get_color (value));
|
||||||
break;
|
break;
|
||||||
case PROP_OFFSCREEN:
|
case PROP_OFFSCREEN:
|
||||||
if (priv->is_offscreen == g_value_get_boolean (value))
|
if (priv->is_offscreen == g_value_get_boolean (value))
|
||||||
@ -414,7 +416,6 @@ clutter_stage_get_property (GObject *object,
|
|||||||
{
|
{
|
||||||
ClutterStage *stage;
|
ClutterStage *stage;
|
||||||
ClutterStagePrivate *priv;
|
ClutterStagePrivate *priv;
|
||||||
ClutterColor color;
|
|
||||||
ClutterPerspective perspective;
|
ClutterPerspective perspective;
|
||||||
|
|
||||||
stage = CLUTTER_STAGE(object);
|
stage = CLUTTER_STAGE(object);
|
||||||
@ -423,8 +424,7 @@ clutter_stage_get_property (GObject *object,
|
|||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
case PROP_COLOR:
|
case PROP_COLOR:
|
||||||
clutter_stage_get_color (stage, &color);
|
clutter_value_set_color (value, &priv->color);
|
||||||
g_value_set_boxed (value, &color);
|
|
||||||
break;
|
break;
|
||||||
case PROP_OFFSCREEN:
|
case PROP_OFFSCREEN:
|
||||||
g_value_set_boolean (value, priv->is_offscreen);
|
g_value_set_boolean (value, priv->is_offscreen);
|
||||||
@ -497,6 +497,7 @@ clutter_stage_class_init (ClutterStageClass *klass)
|
|||||||
{
|
{
|
||||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||||
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
|
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
|
||||||
|
GParamSpec *pspec;
|
||||||
|
|
||||||
gobject_class->set_property = clutter_stage_set_property;
|
gobject_class->set_property = clutter_stage_set_property;
|
||||||
gobject_class->get_property = clutter_stage_get_property;
|
gobject_class->get_property = clutter_stage_get_property;
|
||||||
@ -569,13 +570,12 @@ clutter_stage_class_init (ClutterStageClass *klass)
|
|||||||
*
|
*
|
||||||
* The color of the main stage.
|
* The color of the main stage.
|
||||||
*/
|
*/
|
||||||
g_object_class_install_property
|
pspec = clutter_param_spec_color ("color",
|
||||||
(gobject_class, PROP_COLOR,
|
"Color",
|
||||||
g_param_spec_boxed ("color",
|
"The color of the stage",
|
||||||
"Color",
|
&default_stage_color,
|
||||||
"The color of the main stage",
|
CLUTTER_PARAM_READWRITE);
|
||||||
CLUTTER_TYPE_COLOR,
|
g_object_class_install_property (gobject_class, PROP_COLOR, pspec);
|
||||||
CLUTTER_PARAM_READWRITE));
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClutterStage:perspective:
|
* ClutterStage:perspective:
|
||||||
@ -729,10 +729,7 @@ clutter_stage_init (ClutterStage *self)
|
|||||||
priv->is_cursor_visible = TRUE;
|
priv->is_cursor_visible = TRUE;
|
||||||
priv->use_fog = FALSE;
|
priv->use_fog = FALSE;
|
||||||
|
|
||||||
priv->color.red = 0xff;
|
priv->color = default_stage_color;
|
||||||
priv->color.green = 0xff;
|
|
||||||
priv->color.blue = 0xff;
|
|
||||||
priv->color.alpha = 0xff;
|
|
||||||
|
|
||||||
priv->perspective.fovy = COGL_FIXED_60; /* 60 Degrees */
|
priv->perspective.fovy = COGL_FIXED_60; /* 60 Degrees */
|
||||||
priv->perspective.aspect = COGL_FIXED_1;
|
priv->perspective.aspect = COGL_FIXED_1;
|
||||||
|
Loading…
Reference in New Issue
Block a user