mirror of
https://github.com/brl/mutter.git
synced 2025-03-28 22:23:47 +00:00
paint-volume: Add convenience function for using an allocation
Classes overriding ClutterActor::get_paint_volume() that wish to use their allocation as the paint volume should have an idiomatic way of doing so.
This commit is contained in:
parent
5640a65046
commit
b77d9a6d2c
@ -859,3 +859,40 @@ _clutter_actor_set_default_paint_volume (ClutterActor *self,
|
|||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_paint_volume_set_from_allocation:
|
||||||
|
* @pv: a #ClutterPaintVolume
|
||||||
|
* @actor: a #ClutterActor
|
||||||
|
*
|
||||||
|
* Sets the #ClutterPaintVolume from the allocation of @actor.
|
||||||
|
*
|
||||||
|
* This function should be used when overriding the
|
||||||
|
* <function>get_paint_volume()</function> by #ClutterActor sub-classes that do
|
||||||
|
* not paint outside their allocation.
|
||||||
|
*
|
||||||
|
* A typical example is:
|
||||||
|
*
|
||||||
|
* |[
|
||||||
|
* static gboolean
|
||||||
|
* my_actor_get_paint_volume (ClutterActor *self,
|
||||||
|
* ClutterPaintVolume *volume)
|
||||||
|
* {
|
||||||
|
* return clutter_paint_volume_set_from_allocation (volume, self);
|
||||||
|
* }
|
||||||
|
* ]|
|
||||||
|
*
|
||||||
|
* Return value: %TRUE if the paint volume was successfully set, and %FALSE
|
||||||
|
* otherwise
|
||||||
|
*
|
||||||
|
* Since: 1.4
|
||||||
|
*/
|
||||||
|
gboolean
|
||||||
|
clutter_paint_volume_set_from_allocation (ClutterPaintVolume *pv,
|
||||||
|
ClutterActor *actor)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (pv != NULL, FALSE);
|
||||||
|
g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), FALSE);
|
||||||
|
|
||||||
|
return _clutter_actor_set_default_paint_volume (actor, G_TYPE_INVALID, pv);
|
||||||
|
}
|
||||||
|
@ -456,24 +456,27 @@ typedef enum {
|
|||||||
|
|
||||||
GType clutter_paint_volume_get_type (void) G_GNUC_CONST;
|
GType clutter_paint_volume_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
ClutterPaintVolume *clutter_paint_volume_copy (const ClutterPaintVolume *pv);
|
ClutterPaintVolume *clutter_paint_volume_copy (const ClutterPaintVolume *pv);
|
||||||
void clutter_paint_volume_free (ClutterPaintVolume *pv);
|
void clutter_paint_volume_free (ClutterPaintVolume *pv);
|
||||||
|
|
||||||
void clutter_paint_volume_set_origin (ClutterPaintVolume *pv,
|
void clutter_paint_volume_set_origin (ClutterPaintVolume *pv,
|
||||||
const ClutterVertex *origin);
|
const ClutterVertex *origin);
|
||||||
void clutter_paint_volume_get_origin (const ClutterPaintVolume *pv,
|
void clutter_paint_volume_get_origin (const ClutterPaintVolume *pv,
|
||||||
ClutterVertex *vertex);
|
ClutterVertex *vertex);
|
||||||
void clutter_paint_volume_set_width (ClutterPaintVolume *pv,
|
void clutter_paint_volume_set_width (ClutterPaintVolume *pv,
|
||||||
gfloat width);
|
gfloat width);
|
||||||
gfloat clutter_paint_volume_get_width (const ClutterPaintVolume *pv);
|
gfloat clutter_paint_volume_get_width (const ClutterPaintVolume *pv);
|
||||||
void clutter_paint_volume_set_height (ClutterPaintVolume *pv,
|
void clutter_paint_volume_set_height (ClutterPaintVolume *pv,
|
||||||
gfloat height);
|
gfloat height);
|
||||||
gfloat clutter_paint_volume_get_height (const ClutterPaintVolume *pv);
|
gfloat clutter_paint_volume_get_height (const ClutterPaintVolume *pv);
|
||||||
void clutter_paint_volume_set_depth (ClutterPaintVolume *pv,
|
void clutter_paint_volume_set_depth (ClutterPaintVolume *pv,
|
||||||
gfloat depth);
|
gfloat depth);
|
||||||
gfloat clutter_paint_volume_get_depth (const ClutterPaintVolume *pv);
|
gfloat clutter_paint_volume_get_depth (const ClutterPaintVolume *pv);
|
||||||
void clutter_paint_volume_union (ClutterPaintVolume *pv,
|
void clutter_paint_volume_union (ClutterPaintVolume *pv,
|
||||||
const ClutterPaintVolume *another_pv);
|
const ClutterPaintVolume *another_pv);
|
||||||
|
|
||||||
|
gboolean clutter_paint_volume_set_from_allocation (ClutterPaintVolume *pv,
|
||||||
|
ClutterActor *actor);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user