2006-05-29 08:59:36 +00:00
|
|
|
/*
|
|
|
|
* Clutter.
|
|
|
|
*
|
|
|
|
* An OpenGL based 'interactive canvas' library.
|
|
|
|
*
|
|
|
|
* Authored By Matthew Allum <mallum@openedhand.com>
|
|
|
|
*
|
|
|
|
* Copyright (C) 2006 OpenedHand
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
2006-06-21 22:34:25 +00:00
|
|
|
/**
|
|
|
|
* SECTION:clutter-rectangle
|
2008-02-15 17:11:50 +00:00
|
|
|
* @short_description: An actor that displays a simple rectangle.
|
2006-06-21 22:34:25 +00:00
|
|
|
*
|
2008-02-15 17:11:50 +00:00
|
|
|
* #ClutterRectangle is a #ClutterActor which draws a simple filled rectangle.
|
2006-06-21 22:34:25 +00:00
|
|
|
*/
|
2007-10-12 08:17:00 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
2007-09-27 22:20:30 +00:00
|
|
|
#include "config.h"
|
2007-10-12 08:17:00 +00:00
|
|
|
#endif
|
2006-06-21 22:34:25 +00:00
|
|
|
|
2008-11-17 14:21:49 +00:00
|
|
|
#include "clutter-color.h"
|
|
|
|
#include "clutter-debug.h"
|
2006-05-29 08:59:36 +00:00
|
|
|
#include "clutter-main.h"
|
2007-10-12 08:17:00 +00:00
|
|
|
#include "clutter-private.h"
|
2008-11-17 14:21:49 +00:00
|
|
|
#include "clutter-rectangle.h"
|
2006-05-29 08:59:36 +00:00
|
|
|
|
2008-04-25 13:37:36 +00:00
|
|
|
#include "cogl/cogl.h"
|
2006-05-29 08:59:36 +00:00
|
|
|
|
2006-06-13 13:17:45 +00:00
|
|
|
G_DEFINE_TYPE (ClutterRectangle, clutter_rectangle, CLUTTER_TYPE_ACTOR);
|
2006-05-29 08:59:36 +00:00
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
2006-11-20 22:20:48 +00:00
|
|
|
|
|
|
|
PROP_COLOR,
|
|
|
|
PROP_BORDER_COLOR,
|
|
|
|
PROP_BORDER_WIDTH,
|
|
|
|
PROP_HAS_BORDER
|
2006-05-29 08:59:36 +00:00
|
|
|
|
|
|
|
/* FIXME: Add gradient, rounded corner props etc */
|
|
|
|
};
|
|
|
|
|
|
|
|
#define CLUTTER_RECTANGLE_GET_PRIVATE(obj) \
|
|
|
|
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), CLUTTER_TYPE_RECTANGLE, ClutterRectanglePrivate))
|
|
|
|
|
|
|
|
struct _ClutterRectanglePrivate
|
|
|
|
{
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 13:38:31 +00:00
|
|
|
ClutterColor color;
|
2006-11-20 22:20:48 +00:00
|
|
|
ClutterColor border_color;
|
|
|
|
|
|
|
|
guint border_width;
|
|
|
|
|
|
|
|
guint has_border : 1;
|
2006-05-29 08:59:36 +00:00
|
|
|
};
|
|
|
|
|
2008-11-17 14:21:49 +00:00
|
|
|
static const ClutterColor default_color = { 255, 255, 255, 255 };
|
|
|
|
static const ClutterColor default_border_color = { 0, 0, 0, 255 };
|
|
|
|
|
2006-05-29 08:59:36 +00:00
|
|
|
static void
|
2006-06-13 13:17:45 +00:00
|
|
|
clutter_rectangle_paint (ClutterActor *self)
|
2006-05-29 08:59:36 +00:00
|
|
|
{
|
|
|
|
ClutterRectangle *rectangle = CLUTTER_RECTANGLE(self);
|
|
|
|
ClutterRectanglePrivate *priv;
|
|
|
|
ClutterGeometry geom;
|
2008-10-30 16:50:07 +00:00
|
|
|
guint8 tmp_alpha;
|
2006-05-29 08:59:36 +00:00
|
|
|
|
|
|
|
rectangle = CLUTTER_RECTANGLE(self);
|
|
|
|
priv = rectangle->priv;
|
|
|
|
|
2007-04-27 21:13:06 +00:00
|
|
|
CLUTTER_NOTE (PAINT,
|
|
|
|
"painting rect '%s'",
|
|
|
|
clutter_actor_get_name (self) ? clutter_actor_get_name (self)
|
|
|
|
: "unknown");
|
2008-06-10 Emmanuele Bassi <ebassi@openedhand.com>
Bug #815 - Split up request, allocation, and paint box
* clutter/clutter-actor.[ch]: Rework the size allocation,
request and paint area. Now ::request_coords() is called
::allocate(), and ::query_coords() has been split into
::get_preferred_width() and ::get_preferred_height(). See
the documentation and the layout test on how to implement
a container and layout manager with the new API. (#915,
based on a patch by Havoc Pennington, Lucas Rocha and Johan
Bilien)
* clutter/clutter-clone-texture.c: Port CloneTexture to
the new size negotiation API; it just means forwarding
the requests to the parent texture.
* clutter/clutter-deprecated.h: Add deprecated and replaced
API.
* clutter/clutter-entry.c: Port Entry to the new size
negotiation API.
* clutter/clutter-group.c: Port Group to the new size
negotiation API; the semantics of the Group actor do not
change.
* clutter/clutter-label.c: Port Label to the new size
negotiation API, and vastly simplify the code.
* clutter/clutter-main.[ch]: Add API for executing a
relayout when needed.
* clutter/clutter-private.h: Add new Stage private API.
* clutter/clutter-rectangle.c: Update the get_abs_opacity()
call to get_paint_opacity().
* clutter/clutter-stage.c:
(clutter_stage_get_preferred_width),
(clutter_stage_get_preferred_height),
(clutter_stage_allocate),
(clutter_stage_class_init): Port Stage to the new size
negotiation API.
* clutter/clutter-texture.c: Port Texture to the new size
negotiation API.
* clutter/clutter-types.h: Add ClutterRequestMode enumeration.
* clutter/x11/clutter-stage-x11.c: Port the X11 stage
implementation to the new size negotiation API.
* tests/Makefile.am: Add the layout manager test case.
* tests/test-opacity.c: Update.
* tests/test-project.c: Update.
* tests/test-layout.c: Test case for a layout manager implemented
using the new size negotiation API; the layout manager handles
both transformed and untransformed children.
2008-06-10 17:07:52 +00:00
|
|
|
clutter_actor_get_allocation_geometry (self, &geom);
|
2006-05-29 08:59:36 +00:00
|
|
|
|
2007-10-12 08:17:00 +00:00
|
|
|
/* parent paint call will have translated us into position so
|
2006-11-20 22:20:48 +00:00
|
|
|
* paint from 0, 0
|
|
|
|
*/
|
|
|
|
if (priv->has_border)
|
|
|
|
{
|
2008-11-12 12:39:55 +00:00
|
|
|
/* compute the composited opacity of the actor taking into
|
|
|
|
* account the opacity of the color set by the user
|
|
|
|
*/
|
|
|
|
tmp_alpha = clutter_actor_get_paint_opacity (self)
|
2008-11-12 13:57:58 +00:00
|
|
|
* priv->border_color.alpha
|
|
|
|
/ 255;
|
2008-11-12 12:39:55 +00:00
|
|
|
|
2008-10-30 16:50:07 +00:00
|
|
|
/* paint the border */
|
2008-11-12 13:57:58 +00:00
|
|
|
cogl_set_source_color4ub (priv->border_color.red,
|
|
|
|
priv->border_color.green,
|
|
|
|
priv->border_color.blue,
|
|
|
|
tmp_alpha);
|
2006-11-20 22:20:48 +00:00
|
|
|
|
|
|
|
/* this sucks, but it's the only way to make a border */
|
2008-04-29 15:41:34 +00:00
|
|
|
cogl_rectangle (priv->border_width, 0,
|
2009-01-28 14:47:03 +00:00
|
|
|
geom.width,
|
2008-04-29 15:41:34 +00:00
|
|
|
priv->border_width);
|
2007-06-25 13:44:32 +00:00
|
|
|
|
2008-04-29 15:41:34 +00:00
|
|
|
cogl_rectangle (geom.width - priv->border_width,
|
|
|
|
priv->border_width,
|
2009-01-28 14:47:03 +00:00
|
|
|
geom.width,
|
|
|
|
geom.height);
|
2007-06-25 13:44:32 +00:00
|
|
|
|
2008-04-29 15:41:34 +00:00
|
|
|
cogl_rectangle (0, geom.height - priv->border_width,
|
|
|
|
geom.width - priv->border_width,
|
2009-01-28 14:47:03 +00:00
|
|
|
geom.height);
|
2007-06-25 13:44:32 +00:00
|
|
|
|
2008-04-29 15:41:34 +00:00
|
|
|
cogl_rectangle (0, 0,
|
|
|
|
priv->border_width,
|
|
|
|
geom.height - priv->border_width);
|
2007-04-27 21:13:06 +00:00
|
|
|
|
2008-11-12 12:39:55 +00:00
|
|
|
tmp_alpha = clutter_actor_get_paint_opacity (self)
|
2008-11-12 13:57:58 +00:00
|
|
|
* priv->color.alpha
|
|
|
|
/ 255;
|
2008-11-12 12:39:55 +00:00
|
|
|
|
2008-10-30 16:50:07 +00:00
|
|
|
/* now paint the rectangle */
|
2008-11-12 13:57:58 +00:00
|
|
|
cogl_set_source_color4ub (priv->color.red,
|
|
|
|
priv->color.green,
|
|
|
|
priv->color.blue,
|
|
|
|
tmp_alpha);
|
2007-04-27 21:13:06 +00:00
|
|
|
|
2008-06-10 Emmanuele Bassi <ebassi@openedhand.com>
Bug #815 - Split up request, allocation, and paint box
* clutter/clutter-actor.[ch]: Rework the size allocation,
request and paint area. Now ::request_coords() is called
::allocate(), and ::query_coords() has been split into
::get_preferred_width() and ::get_preferred_height(). See
the documentation and the layout test on how to implement
a container and layout manager with the new API. (#915,
based on a patch by Havoc Pennington, Lucas Rocha and Johan
Bilien)
* clutter/clutter-clone-texture.c: Port CloneTexture to
the new size negotiation API; it just means forwarding
the requests to the parent texture.
* clutter/clutter-deprecated.h: Add deprecated and replaced
API.
* clutter/clutter-entry.c: Port Entry to the new size
negotiation API.
* clutter/clutter-group.c: Port Group to the new size
negotiation API; the semantics of the Group actor do not
change.
* clutter/clutter-label.c: Port Label to the new size
negotiation API, and vastly simplify the code.
* clutter/clutter-main.[ch]: Add API for executing a
relayout when needed.
* clutter/clutter-private.h: Add new Stage private API.
* clutter/clutter-rectangle.c: Update the get_abs_opacity()
call to get_paint_opacity().
* clutter/clutter-stage.c:
(clutter_stage_get_preferred_width),
(clutter_stage_get_preferred_height),
(clutter_stage_allocate),
(clutter_stage_class_init): Port Stage to the new size
negotiation API.
* clutter/clutter-texture.c: Port Texture to the new size
negotiation API.
* clutter/clutter-types.h: Add ClutterRequestMode enumeration.
* clutter/x11/clutter-stage-x11.c: Port the X11 stage
implementation to the new size negotiation API.
* tests/Makefile.am: Add the layout manager test case.
* tests/test-opacity.c: Update.
* tests/test-project.c: Update.
* tests/test-layout.c: Test case for a layout manager implemented
using the new size negotiation API; the layout manager handles
both transformed and untransformed children.
2008-06-10 17:07:52 +00:00
|
|
|
cogl_rectangle (priv->border_width, priv->border_width,
|
2009-01-28 14:47:03 +00:00
|
|
|
geom.width - priv->border_width,
|
|
|
|
geom.height - priv->border_width);
|
2006-11-20 22:20:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-11-12 12:39:55 +00:00
|
|
|
/* compute the composited opacity of the actor taking into
|
|
|
|
* account the opacity of the color set by the user
|
|
|
|
*/
|
|
|
|
tmp_alpha = clutter_actor_get_paint_opacity (self)
|
2008-11-12 13:57:58 +00:00
|
|
|
* priv->color.alpha
|
|
|
|
/ 255;
|
|
|
|
|
|
|
|
cogl_set_source_color4ub (priv->color.red,
|
|
|
|
priv->color.green,
|
|
|
|
priv->color.blue,
|
|
|
|
tmp_alpha);
|
2007-04-27 21:13:06 +00:00
|
|
|
|
2008-04-29 15:41:34 +00:00
|
|
|
cogl_rectangle (0, 0, geom.width, geom.height);
|
2007-04-27 21:13:06 +00:00
|
|
|
}
|
2006-05-29 08:59:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2007-10-12 08:17:00 +00:00
|
|
|
clutter_rectangle_set_property (GObject *object,
|
2006-05-29 08:59:36 +00:00
|
|
|
guint prop_id,
|
2007-10-12 08:17:00 +00:00
|
|
|
const GValue *value,
|
2006-05-29 08:59:36 +00:00
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 13:38:31 +00:00
|
|
|
ClutterRectangle *rectangle = CLUTTER_RECTANGLE(object);
|
2006-05-29 08:59:36 +00:00
|
|
|
|
2007-10-12 08:17:00 +00:00
|
|
|
switch (prop_id)
|
2006-05-29 08:59:36 +00:00
|
|
|
{
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 13:38:31 +00:00
|
|
|
case PROP_COLOR:
|
2008-11-17 14:21:49 +00:00
|
|
|
clutter_rectangle_set_color (rectangle, clutter_value_get_color (value));
|
2006-05-29 08:59:36 +00:00
|
|
|
break;
|
2006-11-20 22:20:48 +00:00
|
|
|
case PROP_BORDER_COLOR:
|
|
|
|
clutter_rectangle_set_border_color (rectangle,
|
2008-11-17 14:21:49 +00:00
|
|
|
clutter_value_get_color (value));
|
2006-11-20 22:20:48 +00:00
|
|
|
break;
|
|
|
|
case PROP_BORDER_WIDTH:
|
|
|
|
clutter_rectangle_set_border_width (rectangle,
|
|
|
|
g_value_get_uint (value));
|
|
|
|
break;
|
|
|
|
case PROP_HAS_BORDER:
|
|
|
|
rectangle->priv->has_border = g_value_get_boolean (value);
|
|
|
|
break;
|
2006-05-29 08:59:36 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2007-10-12 08:17:00 +00:00
|
|
|
clutter_rectangle_get_property (GObject *object,
|
2006-05-29 08:59:36 +00:00
|
|
|
guint prop_id,
|
2007-10-12 08:17:00 +00:00
|
|
|
GValue *value,
|
2006-05-29 08:59:36 +00:00
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
2008-11-17 14:21:49 +00:00
|
|
|
ClutterRectanglePrivate *priv = CLUTTER_RECTANGLE(object)->priv;
|
2006-05-29 08:59:36 +00:00
|
|
|
|
2007-10-12 08:17:00 +00:00
|
|
|
switch (prop_id)
|
2006-05-29 08:59:36 +00:00
|
|
|
{
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 13:38:31 +00:00
|
|
|
case PROP_COLOR:
|
2008-11-17 14:21:49 +00:00
|
|
|
clutter_value_set_color (value, &priv->color);
|
2006-05-29 08:59:36 +00:00
|
|
|
break;
|
2006-11-20 22:20:48 +00:00
|
|
|
case PROP_BORDER_COLOR:
|
2008-11-17 14:21:49 +00:00
|
|
|
clutter_value_set_color (value, &priv->border_color);
|
2006-11-20 22:20:48 +00:00
|
|
|
break;
|
|
|
|
case PROP_BORDER_WIDTH:
|
2008-11-17 14:21:49 +00:00
|
|
|
g_value_set_uint (value, priv->border_width);
|
2006-11-20 22:20:48 +00:00
|
|
|
break;
|
|
|
|
case PROP_HAS_BORDER:
|
2008-11-17 14:21:49 +00:00
|
|
|
g_value_set_boolean (value, priv->has_border);
|
2006-11-20 22:20:48 +00:00
|
|
|
break;
|
2006-05-29 08:59:36 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
2007-10-12 08:17:00 +00:00
|
|
|
}
|
2006-05-29 08:59:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-12 08:17:00 +00:00
|
|
|
static void
|
2006-05-29 08:59:36 +00:00
|
|
|
clutter_rectangle_finalize (GObject *object)
|
|
|
|
{
|
|
|
|
G_OBJECT_CLASS (clutter_rectangle_parent_class)->finalize (object);
|
|
|
|
}
|
|
|
|
|
2007-10-12 08:17:00 +00:00
|
|
|
static void
|
2006-05-29 08:59:36 +00:00
|
|
|
clutter_rectangle_dispose (GObject *object)
|
|
|
|
{
|
|
|
|
G_OBJECT_CLASS (clutter_rectangle_parent_class)->dispose (object);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
clutter_rectangle_class_init (ClutterRectangleClass *klass)
|
|
|
|
{
|
2008-11-17 14:21:49 +00:00
|
|
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
2006-06-13 13:17:45 +00:00
|
|
|
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
|
2008-11-17 14:21:49 +00:00
|
|
|
GParamSpec *pspec;
|
2006-05-29 08:59:36 +00:00
|
|
|
|
2006-06-13 13:17:45 +00:00
|
|
|
actor_class->paint = clutter_rectangle_paint;
|
2006-05-29 08:59:36 +00:00
|
|
|
|
|
|
|
gobject_class->finalize = clutter_rectangle_finalize;
|
|
|
|
gobject_class->dispose = clutter_rectangle_dispose;
|
|
|
|
gobject_class->set_property = clutter_rectangle_set_property;
|
|
|
|
gobject_class->get_property = clutter_rectangle_get_property;
|
|
|
|
|
2006-11-20 22:20:48 +00:00
|
|
|
/**
|
|
|
|
* ClutterRectangle:color:
|
|
|
|
*
|
|
|
|
* The color of the rectangle.
|
|
|
|
*/
|
2008-11-17 14:21:49 +00:00
|
|
|
pspec = clutter_param_spec_color ("color",
|
|
|
|
"Color",
|
|
|
|
"The color of the rectangle",
|
|
|
|
&default_color,
|
|
|
|
CLUTTER_PARAM_READWRITE);
|
|
|
|
g_object_class_install_property (gobject_class, PROP_COLOR, pspec);
|
|
|
|
|
2006-11-20 22:20:48 +00:00
|
|
|
/**
|
|
|
|
* ClutterRectangle:border-color:
|
|
|
|
*
|
|
|
|
* The color of the border of the rectangle.
|
|
|
|
*
|
|
|
|
* Since: 0.2
|
|
|
|
*/
|
2008-11-17 14:21:49 +00:00
|
|
|
pspec = clutter_param_spec_color ("border-color",
|
|
|
|
"Border Color",
|
|
|
|
"The color of the border of the rectangle",
|
|
|
|
&default_border_color,
|
|
|
|
CLUTTER_PARAM_READWRITE);
|
|
|
|
g_object_class_install_property (gobject_class, PROP_BORDER_COLOR, pspec);
|
|
|
|
|
2006-11-20 22:20:48 +00:00
|
|
|
/**
|
|
|
|
* ClutterRectangle:border-width:
|
|
|
|
*
|
|
|
|
* The width of the border of the rectangle, in pixels.
|
2007-10-12 08:17:00 +00:00
|
|
|
*
|
2006-11-20 22:20:48 +00:00
|
|
|
* Since: 0.2
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
PROP_BORDER_WIDTH,
|
|
|
|
g_param_spec_uint ("border-width",
|
|
|
|
"Border Width",
|
|
|
|
"The width of the border of the rectangle",
|
|
|
|
0, G_MAXUINT,
|
|
|
|
0,
|
2006-12-04 16:26:35 +00:00
|
|
|
CLUTTER_PARAM_READWRITE));
|
2006-11-20 22:20:48 +00:00
|
|
|
/**
|
|
|
|
* ClutterRectangle:has-border:
|
|
|
|
*
|
|
|
|
* Whether the #ClutterRectangle should be displayed with a border.
|
|
|
|
*
|
|
|
|
* Since: 0.2
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
PROP_HAS_BORDER,
|
|
|
|
g_param_spec_boolean ("has-border",
|
|
|
|
"Has Border",
|
|
|
|
"Whether the rectangle should have a border",
|
|
|
|
FALSE,
|
2006-12-04 16:26:35 +00:00
|
|
|
CLUTTER_PARAM_READWRITE));
|
2006-05-29 08:59:36 +00:00
|
|
|
|
|
|
|
g_type_class_add_private (gobject_class, sizeof (ClutterRectanglePrivate));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
clutter_rectangle_init (ClutterRectangle *self)
|
|
|
|
{
|
2006-11-20 22:20:48 +00:00
|
|
|
ClutterRectanglePrivate *priv;
|
|
|
|
|
|
|
|
self->priv = priv = CLUTTER_RECTANGLE_GET_PRIVATE (self);
|
|
|
|
|
2008-11-17 14:21:49 +00:00
|
|
|
priv->color = default_color;
|
|
|
|
priv->border_color = default_border_color;
|
2006-11-20 22:20:48 +00:00
|
|
|
|
|
|
|
priv->border_width = 0;
|
|
|
|
|
|
|
|
priv->has_border = FALSE;
|
2006-05-29 08:59:36 +00:00
|
|
|
}
|
|
|
|
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 13:38:31 +00:00
|
|
|
/**
|
|
|
|
* clutter_rectangle_new:
|
|
|
|
*
|
2006-06-13 13:17:45 +00:00
|
|
|
* Creates a new #ClutterActor with a rectangular shape.
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 13:38:31 +00:00
|
|
|
*
|
2006-06-13 13:17:45 +00:00
|
|
|
* Return value: a new #ClutterActor
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 13:38:31 +00:00
|
|
|
*/
|
2006-06-13 13:17:45 +00:00
|
|
|
ClutterActor*
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 13:38:31 +00:00
|
|
|
clutter_rectangle_new (void)
|
|
|
|
{
|
|
|
|
return g_object_new (CLUTTER_TYPE_RECTANGLE, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_rectangle_new_with_color:
|
|
|
|
* @color: a #ClutterColor
|
|
|
|
*
|
2006-06-13 13:17:45 +00:00
|
|
|
* Creates a new #ClutterActor with a rectangular shape
|
2008-02-15 15:18:02 +00:00
|
|
|
* and of the given @color.
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 13:38:31 +00:00
|
|
|
*
|
2006-06-13 13:17:45 +00:00
|
|
|
* Return value: a new #ClutterActor
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 13:38:31 +00:00
|
|
|
*/
|
2006-06-13 13:17:45 +00:00
|
|
|
ClutterActor *
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 13:38:31 +00:00
|
|
|
clutter_rectangle_new_with_color (const ClutterColor *color)
|
2006-05-29 08:59:36 +00:00
|
|
|
{
|
|
|
|
return g_object_new (CLUTTER_TYPE_RECTANGLE,
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 13:38:31 +00:00
|
|
|
"color", color,
|
2006-05-29 08:59:36 +00:00
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 13:38:31 +00:00
|
|
|
/**
|
|
|
|
* clutter_rectangle_get_color:
|
|
|
|
* @rectangle: a #ClutterRectangle
|
|
|
|
* @color: return location for a #ClutterColor
|
|
|
|
*
|
|
|
|
* Retrieves the color of @rectangle.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_rectangle_get_color (ClutterRectangle *rectangle,
|
|
|
|
ClutterColor *color)
|
|
|
|
{
|
|
|
|
ClutterRectanglePrivate *priv;
|
2007-10-12 08:17:00 +00:00
|
|
|
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 13:38:31 +00:00
|
|
|
g_return_if_fail (CLUTTER_IS_RECTANGLE (rectangle));
|
|
|
|
g_return_if_fail (color != NULL);
|
|
|
|
|
|
|
|
priv = rectangle->priv;
|
|
|
|
|
|
|
|
color->red = priv->color.red;
|
|
|
|
color->green = priv->color.green;
|
|
|
|
color->blue = priv->color.blue;
|
|
|
|
color->alpha = priv->color.alpha;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_rectangle_set_color:
|
|
|
|
* @rectangle: a #ClutterRectangle
|
|
|
|
* @color: a #ClutterColor
|
|
|
|
*
|
|
|
|
* Sets the color of @rectangle.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_rectangle_set_color (ClutterRectangle *rectangle,
|
|
|
|
const ClutterColor *color)
|
|
|
|
{
|
|
|
|
ClutterRectanglePrivate *priv;
|
2007-10-12 08:17:00 +00:00
|
|
|
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 13:38:31 +00:00
|
|
|
g_return_if_fail (CLUTTER_IS_RECTANGLE (rectangle));
|
|
|
|
g_return_if_fail (color != NULL);
|
|
|
|
|
2006-11-20 22:20:48 +00:00
|
|
|
g_object_ref (rectangle);
|
|
|
|
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 13:38:31 +00:00
|
|
|
priv = rectangle->priv;
|
|
|
|
|
|
|
|
priv->color.red = color->red;
|
|
|
|
priv->color.green = color->green;
|
|
|
|
priv->color.blue = color->blue;
|
|
|
|
priv->color.alpha = color->alpha;
|
|
|
|
|
2007-05-01 15:26:12 +00:00
|
|
|
#if 0
|
|
|
|
/* FIXME - appears to be causing border to always get drawn */
|
2006-12-14 22:19:08 +00:00
|
|
|
if (clutter_color_equal (&priv->color, &priv->border_color))
|
|
|
|
priv->has_border = FALSE;
|
|
|
|
else
|
|
|
|
priv->has_border = TRUE;
|
2007-05-01 15:26:12 +00:00
|
|
|
#endif
|
2006-12-14 22:19:08 +00:00
|
|
|
|
2010-02-09 19:34:32 +00:00
|
|
|
clutter_actor_queue_redraw (CLUTTER_ACTOR (rectangle));
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 13:38:31 +00:00
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (rectangle), "color");
|
2006-12-14 22:19:08 +00:00
|
|
|
g_object_notify (G_OBJECT (rectangle), "has-border");
|
2006-11-20 22:20:48 +00:00
|
|
|
g_object_unref (rectangle);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_rectangle_get_border_width:
|
|
|
|
* @rectangle: a #ClutterRectangle
|
|
|
|
*
|
|
|
|
* Gets the width (in pixels) of the border used by @rectangle
|
|
|
|
*
|
|
|
|
* Return value: the border's width
|
|
|
|
*
|
|
|
|
* Since: 0.2
|
|
|
|
*/
|
|
|
|
guint
|
|
|
|
clutter_rectangle_get_border_width (ClutterRectangle *rectangle)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (CLUTTER_IS_RECTANGLE (rectangle), 0);
|
|
|
|
|
|
|
|
return rectangle->priv->border_width;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_rectangle_set_border_width:
|
|
|
|
* @rectangle: a #ClutterRectangle
|
|
|
|
* @width: the width of the border
|
|
|
|
*
|
|
|
|
* Sets the width (in pixel) of the border used by @rectangle.
|
|
|
|
* A @width of 0 will unset the border.
|
|
|
|
*
|
|
|
|
* Since: 0.2
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_rectangle_set_border_width (ClutterRectangle *rectangle,
|
|
|
|
guint width)
|
|
|
|
{
|
|
|
|
ClutterRectanglePrivate *priv;
|
|
|
|
|
|
|
|
g_return_if_fail (CLUTTER_IS_RECTANGLE (rectangle));
|
|
|
|
priv = rectangle->priv;
|
|
|
|
|
|
|
|
if (priv->border_width != width)
|
|
|
|
{
|
|
|
|
g_object_ref (rectangle);
|
|
|
|
|
|
|
|
priv->border_width = width;
|
|
|
|
|
|
|
|
if (priv->border_width != 0)
|
|
|
|
priv->has_border = TRUE;
|
|
|
|
else
|
|
|
|
priv->has_border = FALSE;
|
|
|
|
|
2010-02-09 19:34:32 +00:00
|
|
|
clutter_actor_queue_redraw (CLUTTER_ACTOR (rectangle));
|
2006-11-20 22:20:48 +00:00
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (rectangle), "border-width");
|
|
|
|
g_object_notify (G_OBJECT (rectangle), "has-border");
|
|
|
|
g_object_unref (rectangle);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_rectangle_get_border_color:
|
|
|
|
* @rectangle: a #ClutterRectangle
|
|
|
|
* @color: return location for a #ClutterColor
|
|
|
|
*
|
|
|
|
* Gets the color of the border used by @rectangle and places
|
|
|
|
* it into @color.
|
|
|
|
*
|
|
|
|
* Since: 0.2
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_rectangle_get_border_color (ClutterRectangle *rectangle,
|
|
|
|
ClutterColor *color)
|
|
|
|
{
|
|
|
|
ClutterRectanglePrivate *priv;
|
|
|
|
|
|
|
|
g_return_if_fail (CLUTTER_IS_RECTANGLE (rectangle));
|
|
|
|
g_return_if_fail (color != NULL);
|
|
|
|
|
|
|
|
priv = rectangle->priv;
|
|
|
|
|
|
|
|
color->red = priv->border_color.red;
|
|
|
|
color->green = priv->border_color.green;
|
|
|
|
color->blue = priv->border_color.blue;
|
|
|
|
color->alpha = priv->border_color.alpha;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_rectangle_set_border_color:
|
|
|
|
* @rectangle: a #ClutterRectangle
|
|
|
|
* @color: the color of the border
|
|
|
|
*
|
|
|
|
* Sets the color of the border used by @rectangle using @color
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_rectangle_set_border_color (ClutterRectangle *rectangle,
|
|
|
|
const ClutterColor *color)
|
|
|
|
{
|
|
|
|
ClutterRectanglePrivate *priv;
|
|
|
|
|
|
|
|
g_return_if_fail (CLUTTER_IS_RECTANGLE (rectangle));
|
|
|
|
g_return_if_fail (color != NULL);
|
|
|
|
|
|
|
|
priv = rectangle->priv;
|
|
|
|
|
2007-08-31 11:58:20 +00:00
|
|
|
if (priv->border_color.red != color->red ||
|
|
|
|
priv->border_color.green != color->green ||
|
|
|
|
priv->border_color.blue != color->blue ||
|
2006-11-20 22:20:48 +00:00
|
|
|
priv->border_color.alpha != color->alpha)
|
|
|
|
{
|
|
|
|
g_object_ref (rectangle);
|
|
|
|
|
|
|
|
priv->border_color.red = color->red;
|
|
|
|
priv->border_color.green = color->green;
|
|
|
|
priv->border_color.blue = color->blue;
|
|
|
|
priv->border_color.alpha = color->alpha;
|
|
|
|
|
2006-12-14 22:19:08 +00:00
|
|
|
if (clutter_color_equal (&priv->color, &priv->border_color))
|
|
|
|
priv->has_border = FALSE;
|
|
|
|
else
|
|
|
|
priv->has_border = TRUE;
|
|
|
|
|
2010-02-09 19:34:32 +00:00
|
|
|
clutter_actor_queue_redraw (CLUTTER_ACTOR (rectangle));
|
2006-11-20 22:20:48 +00:00
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (rectangle), "border-color");
|
2006-12-14 22:19:08 +00:00
|
|
|
g_object_notify (G_OBJECT (rectangle), "has-border");
|
2006-11-20 22:20:48 +00:00
|
|
|
g_object_unref (rectangle);
|
|
|
|
}
|
2006-06-05 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-color.h:
* clutter-color.c: Reimplement ClutterColor as a boxed type;
add convenience API for color handling, like: add, subtract,
shade, HSL color-space conversion, packing and unpacking.
* clutter-private.h: Update ClutterMainContext, and export the
main context pointer here.
* clutter-rectangle.h:
* clutter-rectangle.c: Update the color-related code; make
clutter_rectangle_new() and empty constructor and provide
clutter_rectangle_new_with_color(); provide color setter
and getter API.
* clutter-label.h:
* clutter-label.c: Rename the "font" property to "font-name";
update the color-related code to the new ClutterColor object;
rename clutter_label_new() to clutter_label_new_with_text(),
and add setters and getters for the properties.
* clutter-marshal.list: Add VOID:OBJECT and VOID:BOXED marshallers
generators.
* clutter-stage.h:
* clutter-stage.c: Rework the API: provide a default constructor
for a singleton object, named clutter_stage_get_default(), which
supercedes the clutter_stage() function in clutter-main; provide
new events: button-press-event, button-release-event,
key-press-event and key-release-event; update the color-related
code;
(clutter_stage_snapshot): Allow negative width and height when
taking a snapshot (meaning: use full width/height).
(clutter_stage_get_element_at_pos): Rename clutter_stage_pick().
* clutter-element.c (clutter_element_paint): Clean up the
stage and color related code.
* clutter-event.h:
* clutter-event.c: Add generic ClutterAnyEvent type; add
clutter_event_new(), clutter_event_copy() and clutter_event_free();
make ClutterEvent a boxed type.
* clutter-main.h:
* clutter-main.c: Remove clutter_stage(); add clutter_main_quit(),
for cleanly quitting from clutter_main(); add multiple mainloops
support; allocate the ClutterCntx instead of adding it to the
stack; re-work the ClutterEvent dispatching.
* clutter-group.c (clutter_group_add), (clutter_group_remove): Keep
a reference on the element when added to a ClutterGroup.
* examples/rects.py
* examples/test.c:
* examples/test-text.c:
* examples/video-cube.c:
* examples/super-oh.c:
* examples/test-video.c: Update.
2006-06-05 13:38:31 +00:00
|
|
|
}
|