2006-05-29 04:59:36 -04: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
|
2010-03-01 07:56:10 -05:00
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*
|
2006-05-29 04:59:36 -04:00
|
|
|
*/
|
|
|
|
|
2006-06-21 18:34:25 -04:00
|
|
|
/**
|
|
|
|
* SECTION:clutter-rectangle
|
2008-02-15 12:11:50 -05:00
|
|
|
* @short_description: An actor that displays a simple rectangle.
|
2006-06-21 18:34:25 -04:00
|
|
|
*
|
2008-02-15 12:11:50 -05:00
|
|
|
* #ClutterRectangle is a #ClutterActor which draws a simple filled rectangle.
|
2011-12-06 12:49:27 -05:00
|
|
|
*
|
2015-03-05 07:57:08 -05:00
|
|
|
* #ClutterRectangle is deprecated since Clutter 1.10. If you want an actor
|
|
|
|
* painting a solid color, you can replace it with #ClutterActor and set the
|
|
|
|
* #ClutterActor:background-color property to the desired #ClutterColor. If
|
|
|
|
* you are drawing more complex shapes, use #ClutterCanvas to draw using the
|
|
|
|
* Cairo 2D API instead.
|
2006-06-21 18:34:25 -04:00
|
|
|
*/
|
2011-12-06 12:49:27 -05:00
|
|
|
|
2007-10-12 04:17:00 -04:00
|
|
|
#ifdef HAVE_CONFIG_H
|
2007-09-27 18:20:30 -04:00
|
|
|
#include "config.h"
|
2007-10-12 04:17:00 -04:00
|
|
|
#endif
|
2006-06-21 18:34:25 -04:00
|
|
|
|
2011-12-06 12:49:27 -05:00
|
|
|
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
2012-08-10 09:17:56 -04:00
|
|
|
#include "deprecated/clutter-rectangle.h"
|
|
|
|
#include "deprecated/clutter-actor.h"
|
2011-12-06 12:49:27 -05:00
|
|
|
|
2010-10-21 07:16:05 -04:00
|
|
|
#include "clutter-actor-private.h"
|
2008-11-17 09:21:49 -05:00
|
|
|
#include "clutter-color.h"
|
|
|
|
#include "clutter-debug.h"
|
2006-05-29 04:59:36 -04:00
|
|
|
#include "clutter-main.h"
|
2007-10-12 04:17:00 -04:00
|
|
|
#include "clutter-private.h"
|
2006-05-29 04:59:36 -04:00
|
|
|
|
2008-04-25 09:37:36 -04:00
|
|
|
#include "cogl/cogl.h"
|
2006-05-29 04:59:36 -04:00
|
|
|
|
2013-07-03 13:04:40 -04:00
|
|
|
struct _ClutterRectanglePrivate
|
|
|
|
{
|
|
|
|
ClutterColor color;
|
|
|
|
ClutterColor border_color;
|
|
|
|
|
|
|
|
guint border_width;
|
|
|
|
|
|
|
|
guint has_border : 1;
|
|
|
|
};
|
2006-05-29 04:59:36 -04:00
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
2006-11-20 17:20:48 -05:00
|
|
|
|
|
|
|
PROP_COLOR,
|
|
|
|
PROP_BORDER_COLOR,
|
|
|
|
PROP_BORDER_WIDTH,
|
|
|
|
PROP_HAS_BORDER
|
2006-05-29 04:59:36 -04:00
|
|
|
|
|
|
|
/* FIXME: Add gradient, rounded corner props etc */
|
|
|
|
};
|
|
|
|
|
2008-11-17 09:21:49 -05:00
|
|
|
static const ClutterColor default_color = { 255, 255, 255, 255 };
|
|
|
|
static const ClutterColor default_border_color = { 0, 0, 0, 255 };
|
|
|
|
|
2013-07-03 13:04:40 -04:00
|
|
|
G_DEFINE_TYPE_WITH_PRIVATE (ClutterRectangle, clutter_rectangle, CLUTTER_TYPE_ACTOR)
|
|
|
|
|
2006-05-29 04:59:36 -04:00
|
|
|
static void
|
2006-06-13 09:17:45 -04:00
|
|
|
clutter_rectangle_paint (ClutterActor *self)
|
2006-05-29 04:59:36 -04:00
|
|
|
{
|
2010-02-11 10:17:32 -05:00
|
|
|
ClutterRectanglePrivate *priv = CLUTTER_RECTANGLE (self)->priv;
|
|
|
|
ClutterGeometry geom;
|
|
|
|
guint8 tmp_alpha;
|
2006-05-29 04:59:36 -04:00
|
|
|
|
2007-04-27 17:13:06 -04: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 13:07:52 -04:00
|
|
|
clutter_actor_get_allocation_geometry (self, &geom);
|
2006-05-29 04:59:36 -04:00
|
|
|
|
2015-03-14 19:15:01 -04:00
|
|
|
/* We paint the border if the rectangle is big enough to show it */
|
|
|
|
if (priv->has_border &&
|
|
|
|
priv->border_width < geom.width &&
|
|
|
|
priv->border_width < geom.height)
|
2006-11-20 17:20:48 -05:00
|
|
|
{
|
2008-11-12 07:39:55 -05: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 08:57:58 -05:00
|
|
|
* priv->border_color.alpha
|
|
|
|
/ 255;
|
2008-11-12 07:39:55 -05:00
|
|
|
|
2008-10-30 12:50:07 -04:00
|
|
|
/* paint the border */
|
2008-11-12 08:57:58 -05:00
|
|
|
cogl_set_source_color4ub (priv->border_color.red,
|
|
|
|
priv->border_color.green,
|
|
|
|
priv->border_color.blue,
|
|
|
|
tmp_alpha);
|
2006-11-20 17:20:48 -05:00
|
|
|
|
|
|
|
/* this sucks, but it's the only way to make a border */
|
2008-04-29 11:41:34 -04:00
|
|
|
cogl_rectangle (priv->border_width, 0,
|
2009-01-28 09:47:03 -05:00
|
|
|
geom.width,
|
2008-04-29 11:41:34 -04:00
|
|
|
priv->border_width);
|
2007-06-25 09:44:32 -04:00
|
|
|
|
2008-04-29 11:41:34 -04:00
|
|
|
cogl_rectangle (geom.width - priv->border_width,
|
|
|
|
priv->border_width,
|
2009-01-28 09:47:03 -05:00
|
|
|
geom.width,
|
|
|
|
geom.height);
|
2007-06-25 09:44:32 -04:00
|
|
|
|
2008-04-29 11:41:34 -04:00
|
|
|
cogl_rectangle (0, geom.height - priv->border_width,
|
|
|
|
geom.width - priv->border_width,
|
2009-01-28 09:47:03 -05:00
|
|
|
geom.height);
|
2007-06-25 09:44:32 -04:00
|
|
|
|
2008-04-29 11:41:34 -04:00
|
|
|
cogl_rectangle (0, 0,
|
|
|
|
priv->border_width,
|
|
|
|
geom.height - priv->border_width);
|
2007-04-27 17:13:06 -04:00
|
|
|
|
2008-11-12 07:39:55 -05:00
|
|
|
tmp_alpha = clutter_actor_get_paint_opacity (self)
|
2008-11-12 08:57:58 -05:00
|
|
|
* priv->color.alpha
|
|
|
|
/ 255;
|
2008-11-12 07:39:55 -05:00
|
|
|
|
2008-10-30 12:50:07 -04:00
|
|
|
/* now paint the rectangle */
|
2008-11-12 08:57:58 -05:00
|
|
|
cogl_set_source_color4ub (priv->color.red,
|
|
|
|
priv->color.green,
|
|
|
|
priv->color.blue,
|
|
|
|
tmp_alpha);
|
2007-04-27 17:13:06 -04: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 13:07:52 -04:00
|
|
|
cogl_rectangle (priv->border_width, priv->border_width,
|
2009-01-28 09:47:03 -05:00
|
|
|
geom.width - priv->border_width,
|
|
|
|
geom.height - priv->border_width);
|
2006-11-20 17:20:48 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-11-12 07:39:55 -05: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 08:57:58 -05:00
|
|
|
* priv->color.alpha
|
|
|
|
/ 255;
|
|
|
|
|
2015-03-14 19:15:01 -04:00
|
|
|
if (priv->border_width < geom.width &&
|
|
|
|
priv->border_width < geom.height)
|
|
|
|
{
|
|
|
|
cogl_set_source_color4ub (priv->color.red,
|
|
|
|
priv->color.green,
|
|
|
|
priv->color.blue,
|
|
|
|
tmp_alpha);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* If the rectangle is as big as the border, we
|
|
|
|
* use the border color to draw
|
|
|
|
*/
|
|
|
|
cogl_set_source_color4ub (priv->border_color.red,
|
|
|
|
priv->border_color.green,
|
|
|
|
priv->border_color.blue,
|
|
|
|
tmp_alpha);
|
|
|
|
}
|
2007-04-27 17:13:06 -04:00
|
|
|
|
2008-04-29 11:41:34 -04:00
|
|
|
cogl_rectangle (0, 0, geom.width, geom.height);
|
2007-04-27 17:13:06 -04:00
|
|
|
}
|
2006-05-29 04:59:36 -04:00
|
|
|
}
|
|
|
|
|
2010-09-08 14:47:11 -04:00
|
|
|
static gboolean
|
2010-09-09 07:30:29 -04:00
|
|
|
clutter_rectangle_get_paint_volume (ClutterActor *self,
|
2010-09-08 14:47:11 -04:00
|
|
|
ClutterPaintVolume *volume)
|
|
|
|
{
|
2010-09-09 07:30:29 -04:00
|
|
|
return _clutter_actor_set_default_paint_volume (self,
|
|
|
|
CLUTTER_TYPE_RECTANGLE,
|
|
|
|
volume);
|
2010-09-08 14:47:11 -04:00
|
|
|
}
|
|
|
|
|
2011-03-14 12:30:53 -04:00
|
|
|
static gboolean
|
|
|
|
clutter_rectangle_has_overlaps (ClutterActor *self)
|
|
|
|
{
|
|
|
|
/* Rectangles never need an offscreen redirect because there are
|
|
|
|
never any overlapping primitives */
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2006-05-29 04:59:36 -04:00
|
|
|
static void
|
2007-10-12 04:17:00 -04:00
|
|
|
clutter_rectangle_set_property (GObject *object,
|
2006-05-29 04:59:36 -04:00
|
|
|
guint prop_id,
|
2007-10-12 04:17:00 -04:00
|
|
|
const GValue *value,
|
2006-05-29 04:59:36 -04: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 09:38:31 -04:00
|
|
|
ClutterRectangle *rectangle = CLUTTER_RECTANGLE(object);
|
2006-05-29 04:59:36 -04:00
|
|
|
|
2007-10-12 04:17:00 -04:00
|
|
|
switch (prop_id)
|
2006-05-29 04:59:36 -04: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 09:38:31 -04:00
|
|
|
case PROP_COLOR:
|
2008-11-17 09:21:49 -05:00
|
|
|
clutter_rectangle_set_color (rectangle, clutter_value_get_color (value));
|
2006-05-29 04:59:36 -04:00
|
|
|
break;
|
2006-11-20 17:20:48 -05:00
|
|
|
case PROP_BORDER_COLOR:
|
|
|
|
clutter_rectangle_set_border_color (rectangle,
|
2008-11-17 09:21:49 -05:00
|
|
|
clutter_value_get_color (value));
|
2006-11-20 17:20:48 -05: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 04:59:36 -04:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2007-10-12 04:17:00 -04:00
|
|
|
clutter_rectangle_get_property (GObject *object,
|
2006-05-29 04:59:36 -04:00
|
|
|
guint prop_id,
|
2007-10-12 04:17:00 -04:00
|
|
|
GValue *value,
|
2006-05-29 04:59:36 -04:00
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
2008-11-17 09:21:49 -05:00
|
|
|
ClutterRectanglePrivate *priv = CLUTTER_RECTANGLE(object)->priv;
|
2006-05-29 04:59:36 -04:00
|
|
|
|
2007-10-12 04:17:00 -04:00
|
|
|
switch (prop_id)
|
2006-05-29 04:59:36 -04: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 09:38:31 -04:00
|
|
|
case PROP_COLOR:
|
2008-11-17 09:21:49 -05:00
|
|
|
clutter_value_set_color (value, &priv->color);
|
2006-05-29 04:59:36 -04:00
|
|
|
break;
|
2006-11-20 17:20:48 -05:00
|
|
|
case PROP_BORDER_COLOR:
|
2008-11-17 09:21:49 -05:00
|
|
|
clutter_value_set_color (value, &priv->border_color);
|
2006-11-20 17:20:48 -05:00
|
|
|
break;
|
|
|
|
case PROP_BORDER_WIDTH:
|
2008-11-17 09:21:49 -05:00
|
|
|
g_value_set_uint (value, priv->border_width);
|
2006-11-20 17:20:48 -05:00
|
|
|
break;
|
|
|
|
case PROP_HAS_BORDER:
|
2008-11-17 09:21:49 -05:00
|
|
|
g_value_set_boolean (value, priv->has_border);
|
2006-11-20 17:20:48 -05:00
|
|
|
break;
|
2006-05-29 04:59:36 -04:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
2007-10-12 04:17:00 -04:00
|
|
|
}
|
2006-05-29 04:59:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-12 04:17:00 -04:00
|
|
|
static void
|
2006-05-29 04:59:36 -04:00
|
|
|
clutter_rectangle_finalize (GObject *object)
|
|
|
|
{
|
|
|
|
G_OBJECT_CLASS (clutter_rectangle_parent_class)->finalize (object);
|
|
|
|
}
|
|
|
|
|
2007-10-12 04:17:00 -04:00
|
|
|
static void
|
2006-05-29 04:59:36 -04: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 09:21:49 -05:00
|
|
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
2006-06-13 09:17:45 -04:00
|
|
|
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
|
2008-11-17 09:21:49 -05:00
|
|
|
GParamSpec *pspec;
|
2006-05-29 04:59:36 -04:00
|
|
|
|
2010-09-08 14:47:11 -04:00
|
|
|
actor_class->paint = clutter_rectangle_paint;
|
|
|
|
actor_class->get_paint_volume = clutter_rectangle_get_paint_volume;
|
2011-03-14 12:30:53 -04:00
|
|
|
actor_class->has_overlaps = clutter_rectangle_has_overlaps;
|
2006-05-29 04:59:36 -04: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 17:20:48 -05:00
|
|
|
/**
|
|
|
|
* ClutterRectangle:color:
|
|
|
|
*
|
|
|
|
* The color of the rectangle.
|
|
|
|
*/
|
2008-11-17 09:21:49 -05:00
|
|
|
pspec = clutter_param_spec_color ("color",
|
2010-06-03 07:57:50 -04:00
|
|
|
P_("Color"),
|
|
|
|
P_("The color of the rectangle"),
|
2008-11-17 09:21:49 -05:00
|
|
|
&default_color,
|
|
|
|
CLUTTER_PARAM_READWRITE);
|
|
|
|
g_object_class_install_property (gobject_class, PROP_COLOR, pspec);
|
|
|
|
|
2006-11-20 17:20:48 -05:00
|
|
|
/**
|
|
|
|
* ClutterRectangle:border-color:
|
|
|
|
*
|
|
|
|
* The color of the border of the rectangle.
|
|
|
|
*
|
|
|
|
* Since: 0.2
|
|
|
|
*/
|
2008-11-17 09:21:49 -05:00
|
|
|
pspec = clutter_param_spec_color ("border-color",
|
2010-06-03 07:57:50 -04:00
|
|
|
P_("Border Color"),
|
|
|
|
P_("The color of the border of the rectangle"),
|
2008-11-17 09:21:49 -05:00
|
|
|
&default_border_color,
|
|
|
|
CLUTTER_PARAM_READWRITE);
|
|
|
|
g_object_class_install_property (gobject_class, PROP_BORDER_COLOR, pspec);
|
|
|
|
|
2006-11-20 17:20:48 -05:00
|
|
|
/**
|
|
|
|
* ClutterRectangle:border-width:
|
|
|
|
*
|
|
|
|
* The width of the border of the rectangle, in pixels.
|
2007-10-12 04:17:00 -04:00
|
|
|
*
|
2006-11-20 17:20:48 -05:00
|
|
|
* Since: 0.2
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
PROP_BORDER_WIDTH,
|
|
|
|
g_param_spec_uint ("border-width",
|
2010-06-03 07:57:50 -04:00
|
|
|
P_("Border Width"),
|
|
|
|
P_("The width of the border of the rectangle"),
|
2006-11-20 17:20:48 -05:00
|
|
|
0, G_MAXUINT,
|
|
|
|
0,
|
2006-12-04 11:26:35 -05:00
|
|
|
CLUTTER_PARAM_READWRITE));
|
2006-11-20 17:20:48 -05: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",
|
2010-06-03 07:57:50 -04:00
|
|
|
P_("Has Border"),
|
|
|
|
P_("Whether the rectangle should have a border"),
|
2006-11-20 17:20:48 -05:00
|
|
|
FALSE,
|
2006-12-04 11:26:35 -05:00
|
|
|
CLUTTER_PARAM_READWRITE));
|
2006-05-29 04:59:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
clutter_rectangle_init (ClutterRectangle *self)
|
|
|
|
{
|
2006-11-20 17:20:48 -05:00
|
|
|
ClutterRectanglePrivate *priv;
|
|
|
|
|
2013-07-03 13:04:40 -04:00
|
|
|
self->priv = priv = clutter_rectangle_get_instance_private (self);
|
2006-11-20 17:20:48 -05:00
|
|
|
|
2008-11-17 09:21:49 -05:00
|
|
|
priv->color = default_color;
|
|
|
|
priv->border_color = default_border_color;
|
2006-11-20 17:20:48 -05:00
|
|
|
|
|
|
|
priv->border_width = 0;
|
|
|
|
|
|
|
|
priv->has_border = FALSE;
|
2006-05-29 04:59:36 -04: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 09:38:31 -04:00
|
|
|
/**
|
|
|
|
* clutter_rectangle_new:
|
|
|
|
*
|
2006-06-13 09:17:45 -04: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 09:38:31 -04:00
|
|
|
*
|
2015-03-05 07:57:08 -05:00
|
|
|
* Return value: a new #ClutterRectangle
|
|
|
|
*
|
|
|
|
* Deprecated: 1.10: Use clutter_actor_new() instead
|
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 09:38:31 -04:00
|
|
|
*/
|
2006-06-13 09:17:45 -04: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 09:38:31 -04:00
|
|
|
clutter_rectangle_new (void)
|
|
|
|
{
|
|
|
|
return g_object_new (CLUTTER_TYPE_RECTANGLE, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_rectangle_new_with_color:
|
|
|
|
* @color: a #ClutterColor
|
|
|
|
*
|
2006-06-13 09:17:45 -04:00
|
|
|
* Creates a new #ClutterActor with a rectangular shape
|
2008-02-15 10:18:02 -05: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 09:38:31 -04:00
|
|
|
*
|
2015-03-05 07:57:08 -05:00
|
|
|
* Return value: a new #ClutterRectangle
|
|
|
|
*
|
|
|
|
* Deprecated: 1.10: Use clutter_actor_new() and
|
|
|
|
* clutter_actor_set_background_color() instead
|
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 09:38:31 -04:00
|
|
|
*/
|
2006-06-13 09:17:45 -04: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 09:38:31 -04:00
|
|
|
clutter_rectangle_new_with_color (const ClutterColor *color)
|
2006-05-29 04:59:36 -04: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 09:38:31 -04:00
|
|
|
"color", color,
|
2006-05-29 04:59:36 -04: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 09:38:31 -04:00
|
|
|
/**
|
|
|
|
* clutter_rectangle_get_color:
|
|
|
|
* @rectangle: a #ClutterRectangle
|
2011-02-14 13:36:51 -05:00
|
|
|
* @color: (out caller-allocates): return location for a #ClutterColor
|
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 09:38:31 -04:00
|
|
|
*
|
|
|
|
* Retrieves the color of @rectangle.
|
2015-03-05 07:57:08 -05:00
|
|
|
*
|
|
|
|
* Deprecated: 1.10: Use #ClutterActor and clutter_actor_get_background_color()
|
|
|
|
* instead
|
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 09:38:31 -04:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_rectangle_get_color (ClutterRectangle *rectangle,
|
|
|
|
ClutterColor *color)
|
|
|
|
{
|
|
|
|
ClutterRectanglePrivate *priv;
|
2007-10-12 04:17:00 -04: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 09:38:31 -04: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.
|
2015-03-05 07:57:08 -05:00
|
|
|
*
|
|
|
|
* Deprecated: 1.10: Use #ClutterActor and clutter_actor_set_background_color()
|
|
|
|
* instead
|
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 09:38:31 -04:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_rectangle_set_color (ClutterRectangle *rectangle,
|
|
|
|
const ClutterColor *color)
|
|
|
|
{
|
|
|
|
ClutterRectanglePrivate *priv;
|
2007-10-12 04:17:00 -04: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 09:38:31 -04:00
|
|
|
g_return_if_fail (CLUTTER_IS_RECTANGLE (rectangle));
|
|
|
|
g_return_if_fail (color != NULL);
|
|
|
|
|
2006-11-20 17:20:48 -05: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 09:38:31 -04: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 11:26:12 -04:00
|
|
|
#if 0
|
|
|
|
/* FIXME - appears to be causing border to always get drawn */
|
2006-12-14 17:19:08 -05:00
|
|
|
if (clutter_color_equal (&priv->color, &priv->border_color))
|
|
|
|
priv->has_border = FALSE;
|
|
|
|
else
|
|
|
|
priv->has_border = TRUE;
|
2007-05-01 11:26:12 -04:00
|
|
|
#endif
|
2006-12-14 17:19:08 -05:00
|
|
|
|
2010-02-09 14:34:32 -05: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 09:38:31 -04:00
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (rectangle), "color");
|
2006-12-14 17:19:08 -05:00
|
|
|
g_object_notify (G_OBJECT (rectangle), "has-border");
|
2006-11-20 17:20:48 -05: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
|
2015-03-05 07:57:08 -05:00
|
|
|
*
|
|
|
|
* Deprecated: 1.10: Use #ClutterActor and a #ClutterCanvas content
|
|
|
|
* to draw the border using Cairo
|
2006-11-20 17:20:48 -05:00
|
|
|
*/
|
|
|
|
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
|
2015-03-05 07:57:08 -05:00
|
|
|
*
|
|
|
|
* Deprecated: 1.10: Use #ClutterActor and a #ClutterCanvas content
|
|
|
|
* to draw the border using Cairo
|
2006-11-20 17:20:48 -05:00
|
|
|
*/
|
|
|
|
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 14:34:32 -05:00
|
|
|
clutter_actor_queue_redraw (CLUTTER_ACTOR (rectangle));
|
2006-11-20 17:20:48 -05: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
|
2011-02-14 13:36:51 -05:00
|
|
|
* @color: (out caller-allocates): return location for a #ClutterColor
|
2006-11-20 17:20:48 -05:00
|
|
|
*
|
|
|
|
* Gets the color of the border used by @rectangle and places
|
|
|
|
* it into @color.
|
|
|
|
*
|
|
|
|
* Since: 0.2
|
2015-03-05 07:57:08 -05:00
|
|
|
*
|
|
|
|
* Deprecated: 1.10: Use #ClutterActor and a #ClutterCanvas to draw
|
|
|
|
* the border with Cairo
|
2006-11-20 17:20:48 -05:00
|
|
|
*/
|
|
|
|
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
|
2015-03-05 07:57:08 -05:00
|
|
|
*
|
|
|
|
* Deprecated: 1.10: Use #ClutterActor and a #ClutterCanvas to draw
|
|
|
|
* the border with Cairo
|
2006-11-20 17:20:48 -05:00
|
|
|
*/
|
|
|
|
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 07:58:20 -04:00
|
|
|
if (priv->border_color.red != color->red ||
|
|
|
|
priv->border_color.green != color->green ||
|
|
|
|
priv->border_color.blue != color->blue ||
|
2006-11-20 17:20:48 -05: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 17:19:08 -05:00
|
|
|
if (clutter_color_equal (&priv->color, &priv->border_color))
|
|
|
|
priv->has_border = FALSE;
|
|
|
|
else
|
|
|
|
priv->has_border = TRUE;
|
|
|
|
|
2010-02-09 14:34:32 -05:00
|
|
|
clutter_actor_queue_redraw (CLUTTER_ACTOR (rectangle));
|
2006-11-20 17:20:48 -05:00
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (rectangle), "border-color");
|
2006-12-14 17:19:08 -05:00
|
|
|
g_object_notify (G_OBJECT (rectangle), "has-border");
|
2006-11-20 17:20:48 -05: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 09:38:31 -04:00
|
|
|
}
|