mirror of
https://github.com/brl/mutter.git
synced 2024-11-23 00:20:42 -05:00
actor-box: Add setters for origin and size
This commit is contained in:
parent
164af55a6e
commit
3f6ec0ba5a
@ -420,6 +420,55 @@ clutter_actor_box_progress (const GValue *a,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_actor_box_set_origin:
|
||||
* @box: a #ClutterActorBox
|
||||
* @x: the X coordinate of the new origin
|
||||
* @y: the Y coordinate of the new origin
|
||||
*
|
||||
* Changes the origin of @box, maintaining the size of the #ClutterActorBox.
|
||||
*
|
||||
* Since: 1.6
|
||||
*/
|
||||
void
|
||||
clutter_actor_box_set_origin (ClutterActorBox *box,
|
||||
gfloat x,
|
||||
gfloat y)
|
||||
{
|
||||
gfloat width, height;
|
||||
|
||||
g_return_if_fail (box != NULL);
|
||||
|
||||
width = box->x2 - box->x1;
|
||||
height = box->y2 - box->y1;
|
||||
|
||||
box->x1 = x;
|
||||
box->y1 = y;
|
||||
box->x2 = box->x1 + width;
|
||||
box->y2 = box->y1 + height;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_actor_box_set_size:
|
||||
* @box: a #ClutterActorBox
|
||||
* @width: the new width
|
||||
* @height: the new height
|
||||
*
|
||||
* Sets the size of @box, maintaining the origin of the #ClutterActorBox.
|
||||
*
|
||||
* Since: 1.6
|
||||
*/
|
||||
void
|
||||
clutter_actor_box_set_size (ClutterActorBox *box,
|
||||
gfloat width,
|
||||
gfloat height)
|
||||
{
|
||||
g_return_if_fail (box != NULL);
|
||||
|
||||
box->x2 = box->x1 + width;
|
||||
box->y2 = box->y1 + height;
|
||||
}
|
||||
|
||||
G_DEFINE_BOXED_TYPE_WITH_CODE (ClutterActorBox, clutter_actor_box,
|
||||
clutter_actor_box_copy,
|
||||
clutter_actor_box_free,
|
||||
|
@ -189,6 +189,13 @@ void clutter_actor_box_union (const ClutterActorBox *a,
|
||||
const ClutterActorBox *b,
|
||||
ClutterActorBox *result);
|
||||
|
||||
void clutter_actor_box_set_origin (ClutterActorBox *box,
|
||||
gfloat x,
|
||||
gfloat y);
|
||||
void clutter_actor_box_set_size (ClutterActorBox *box,
|
||||
gfloat width,
|
||||
gfloat height);
|
||||
|
||||
/**
|
||||
* ClutterGeometry:
|
||||
* @x: X coordinate of the top left corner of an actor
|
||||
|
@ -451,7 +451,9 @@ clutter_actor_box_get_x
|
||||
clutter_actor_box_get_y
|
||||
clutter_actor_box_get_width
|
||||
clutter_actor_box_get_height
|
||||
clutter_actor_box_set_origin
|
||||
clutter_actor_box_get_origin
|
||||
clutter_actor_box_set_size
|
||||
clutter_actor_box_get_size
|
||||
clutter_actor_box_get_area
|
||||
clutter_actor_box_contains
|
||||
|
Loading…
Reference in New Issue
Block a user