Add more ActorBox utility methods

ActorBox should have methods for easily extracting the X and Y
coordinates of the origin, and the width and height separately.

These methods will make it easier for high-level language bindings
to manipulate ActorBox instances and avoid the Geometry type.
This commit is contained in:
Emmanuele Bassi 2009-06-16 16:30:41 +01:00
parent 9ed2a47db1
commit 4bed539b21
3 changed files with 80 additions and 0 deletions

View File

@ -7955,6 +7955,78 @@ clutter_actor_box_equal (const ClutterActorBox *box_a,
box_a->x2 == box_b->x2 && box_a->y2 == box_b->y2; box_a->x2 == box_b->x2 && box_a->y2 == box_b->y2;
} }
/**
* clutter_actor_get_x:
* @box: a #ClutterActorBox
*
* Retrieves the X coordinate of the origin of @box
*
* Return value: the X coordinate of the origin
*
* Since: 1.0
*/
gfloat
clutter_actor_box_get_x (const ClutterActorBox *box)
{
g_return_val_if_fail (box != NULL, 0.);
return box->x1;
}
/**
* clutter_actor_get_y:
* @box: a #ClutterActorBox
*
* Retrieves the Y coordinate of the origin of @box
*
* Return value: the Y coordinate of the origin
*
* Since: 1.0
*/
gfloat
clutter_actor_box_get_y (const ClutterActorBox *box)
{
g_return_val_if_fail (box != NULL, 0.);
return box->y1;
}
/**
* clutter_actor_get_width:
* @box: a #ClutterActorBox
*
* Retrieves the width of the @box
*
* Return value: the width of the box
*
* Since: 1.0
*/
gfloat
clutter_actor_box_get_width (const ClutterActorBox *box)
{
g_return_val_if_fail (box != NULL, 0.);
return box->x2 - box->x1;
}
/**
* clutter_actor_get_height:
* @box: a #ClutterActorBox
*
* Retrieves the height of the @box
*
* Return value: the height of the box
*
* Since: 1.0
*/
gfloat
clutter_actor_box_get_height (const ClutterActorBox *box)
{
g_return_val_if_fail (box != NULL, 0.);
return box->y2 - box->y1;
}
/** /**
* clutter_actor_box_get_origin: * clutter_actor_box_get_origin:
* @box: a #ClutterActorBox * @box: a #ClutterActorBox

View File

@ -136,6 +136,10 @@ ClutterActorBox *clutter_actor_box_copy (const ClutterActorBox *box);
void clutter_actor_box_free (ClutterActorBox *box); void clutter_actor_box_free (ClutterActorBox *box);
gboolean clutter_actor_box_equal (const ClutterActorBox *box_a, gboolean clutter_actor_box_equal (const ClutterActorBox *box_a,
const ClutterActorBox *box_b); const ClutterActorBox *box_b);
gfloat clutter_actor_box_get_x (const ClutterActorBox *box);
gfloat clutter_actor_box_get_y (const ClutterActorBox *box);
gfloat clutter_actor_box_get_width (const ClutterActorBox *box);
gfloat clutter_actor_box_get_height (const ClutterActorBox *box);
void clutter_actor_box_get_origin (const ClutterActorBox *box, void clutter_actor_box_get_origin (const ClutterActorBox *box,
gfloat *x, gfloat *x,
gfloat *y); gfloat *y);

View File

@ -394,6 +394,10 @@ clutter_actor_box_new
clutter_actor_box_copy clutter_actor_box_copy
clutter_actor_box_free clutter_actor_box_free
clutter_actor_box_equal clutter_actor_box_equal
clutter_actor_box_get_x
clutter_actor_box_get_y
clutter_actor_box_get_width
clutter_actor_box_get_height
clutter_actor_box_get_origin clutter_actor_box_get_origin
clutter_actor_box_get_size clutter_actor_box_get_size
clutter_actor_box_get_area clutter_actor_box_get_area