From 849607316a36d733a7f0cba3b076c85f9b7d6249 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Tue, 14 Apr 2015 12:37:42 +0100 Subject: [PATCH] actor: Add functions mapping to state query macros The macros are useless for language bindings, and are terribly unsafe from C as well. There's always the option of using the GObject properties they refer to, but it's more efficient to just have a simple getter function. --- clutter/clutter-actor.c | 60 +++++++++++++++++++++++++++++++++++++++++ clutter/clutter-actor.h | 7 +++++ 2 files changed, 67 insertions(+) diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index df43e4d8b..270126f91 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -1542,6 +1542,26 @@ clutter_actor_map (ClutterActor *self) clutter_actor_update_map_state (self, MAP_STATE_MAKE_MAPPED); } +/** + * clutter_actor_is_mapped: + * @self: a #ClutterActor + * + * Checks whether a #ClutterActor has been set as mapped. + * + * See also %CLUTTER_ACTOR_IS_MAPPED and #ClutterActor:mapped + * + * Returns: %TRUE if the actor is mapped + * + * Since: 1.24 + */ +gboolean +clutter_actor_is_mapped (ClutterActor *self) +{ + g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE); + + return CLUTTER_ACTOR_IS_MAPPED (self); +} + static void clutter_actor_real_unmap (ClutterActor *self) { @@ -1740,6 +1760,26 @@ clutter_actor_show (ClutterActor *self) g_object_thaw_notify (G_OBJECT (self)); } +/** + * clutter_actor_is_visible: + * @self: a #ClutterActor + * + * Checks whether an actor is marked as visible. + * + * See also %CLUTTER_ACTOR_IS_VISIBLE and #ClutterActor:visible. + * + * Returns: %TRUE if the actor visible + * + * Since: 1.24 + */ +gboolean +clutter_actor_is_visible (ClutterActor *self) +{ + g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE); + + return CLUTTER_ACTOR_IS_VISIBLE (self); +} + /** * clutter_actor_show_all: * @self: a #ClutterActor @@ -1900,6 +1940,26 @@ clutter_actor_realize (ClutterActor *self) clutter_actor_realize_internal (self); } +/** + * clutter_actor_is_realized: + * @self: a #ClutterActor + * + * Checks whether a #ClutterActor is realized. + * + * See also %CLUTTER_ACTOR_IS_REALIZED and #ClutterActor:realized. + * + * Returns: %TRUE if the actor is realized + * + * Since: 1.24 + */ +gboolean +clutter_actor_is_realized (ClutterActor *self) +{ + g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE); + + return CLUTTER_ACTOR_IS_REALIZED (self); +} + static void clutter_actor_realize_internal (ClutterActor *self) { diff --git a/clutter/clutter-actor.h b/clutter/clutter-actor.h index 85dc68a3b..a11fbb944 100644 --- a/clutter/clutter-actor.h +++ b/clutter/clutter-actor.h @@ -345,6 +345,13 @@ const gchar * clutter_actor_get_name CLUTTER_AVAILABLE_IN_ALL AtkObject * clutter_actor_get_accessible (ClutterActor *self); +CLUTTER_AVAILABLE_IN_1_24 +gboolean clutter_actor_is_visible (ClutterActor *self); +CLUTTER_AVAILABLE_IN_1_24 +gboolean clutter_actor_is_mapped (ClutterActor *self); +CLUTTER_AVAILABLE_IN_1_24 +gboolean clutter_actor_is_realized (ClutterActor *self); + /* Size negotiation */ CLUTTER_AVAILABLE_IN_ALL void clutter_actor_set_request_mode (ClutterActor *self,