actor: Add :has-pointer property

ClutterActor should be able to tell whether a pointer is within
its area or not.
This commit is contained in:
Emmanuele Bassi 2009-11-24 12:53:57 +00:00
parent d23dd9af6b
commit 1f87cac069
3 changed files with 63 additions and 1 deletions

View File

@ -308,6 +308,7 @@ struct _ClutterActorPrivate
guint clip_to_allocation : 1;
guint enable_model_view_transform : 1;
guint enable_paint_unmapped : 1;
guint has_pointer : 1;
gfloat clip[4];
@ -429,7 +430,8 @@ enum
PROP_SHOW_ON_SET_PARENT,
PROP_TEXT_DIRECTION
PROP_TEXT_DIRECTION,
PROP_HAS_POINTER
};
enum
@ -3031,6 +3033,10 @@ clutter_actor_get_property (GObject *object,
g_value_set_enum (value, priv->text_direction);
break;
case PROP_HAS_POINTER:
g_value_set_boolean (value, priv->has_pointer);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -3858,6 +3864,24 @@ clutter_actor_class_init (ClutterActorClass *klass)
PROP_TEXT_DIRECTION,
pspec);
/**
* ClutterActor:has-pointer:
*
* Whether the actor contains the pointer of a #ClutterInputDevice
* or not.
*
* Since: 1.2
*/
pspec = g_param_spec_boolean ("has-pointer",
"Has Pointer",
"Whether the actor contains the pointer "
"of an input device",
FALSE,
CLUTTER_PARAM_READABLE);
g_object_class_install_property (object_class,
PROP_HAS_POINTER,
pspec);
/**
* ClutterActor::destroy:
* @actor: the object which received the signal
@ -9638,6 +9662,20 @@ clutter_actor_set_text_direction (ClutterActor *self,
}
}
void
_clutter_actor_set_has_pointer (ClutterActor *self,
gboolean has_pointer)
{
ClutterActorPrivate *priv = self->priv;
if (priv->has_pointer != has_pointer)
{
priv->has_pointer = has_pointer;
g_object_notify (G_OBJECT (self), "has-pointer");
}
}
/**
* clutter_actor_get_text_direction:
* @self: a #ClutterActor
@ -9748,3 +9786,23 @@ clutter_actor_pop_internal (void)
ctx->internal_child -= 1;
}
/**
* clutter_actor_has_pointer:
* @self: a #ClutterActor
*
* Checks whether an actor contains the the pointer of a
* #ClutterInputDevice
*
* Return value: %TRUE if the actor contains the pointer, and
* %FALSE otherwise
*
* Since: 1.2
*/
gboolean
clutter_actor_has_pointer (ClutterActor *self)
{
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
return self->priv->has_pointer;
}

View File

@ -532,6 +532,7 @@ void clutter_actor_get_transformation_matrix (ClutterActor *self
CoglMatrix *matrix);
gboolean clutter_actor_is_in_clone_paint (ClutterActor *self);
gboolean clutter_actor_has_pointer (ClutterActor *self);
void clutter_actor_set_text_direction (ClutterActor *self,
ClutterTextDirection text_dir);

View File

@ -296,6 +296,9 @@ void _clutter_actor_set_enable_model_view_transform (ClutterActor *self,
void _clutter_actor_set_enable_paint_unmapped (ClutterActor *self,
gboolean enable);
void _clutter_actor_set_has_pointer (ClutterActor *self,
gboolean has_pointer);
void _clutter_run_repaint_functions (void);
gint32 _clutter_backend_get_units_serial (ClutterBackend *backend);