Summary: These APIs allow to enable/disable a tooltip to move with respect to mouse pointer
Test Plan: elm_tooltip_movement_lock_set(), elm_tooltip_movement_lock_get(), elementary_test -to tooltip
Reviewers: singh.amitesh, seoz, raster
Reviewed By: raster
CC: raster
Differential Revision: https://phab.enlightenment.org/D369
2013-12-01 Mike Blumenkrantz
* fix mouse eventing on e border theme
+
+2013-12-09 Abhinandan Aryadipta (aryarockstar)
+
+ * tooltip: Added elm_tooltip_move_lock_set() and elm_tooltip_move_lock_get().
Additions:
+ * Add elm_tooltip_move_lock_set() and elm_tooltip_move_lock_get()
+
Improvements:
Fixes:
}
static void
+_tt_move_lock(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ if (!elm_tooltip_move_lock_get(obj))
+ {
+ elm_tooltip_move_lock_set(obj, EINA_TRUE);
+ elm_object_tooltip_text_set(obj, "Locked");
+ }
+ else
+ {
+ elm_tooltip_move_lock_set(obj, EINA_FALSE);
+ elm_object_tooltip_text_set(obj, "Free");
+ }
+}
+
+static void
_tt_orient_text_replace(void *data EINA_UNUSED,
Evas_Object *obj,
void *event_info EINA_UNUSED)
evas_object_show(bt);
bt = elm_button_add(win);
+ elm_object_text_set(bt, "Movement Lock Tooltip, click to change");
+ elm_object_tooltip_text_set(bt, "Free");
+ evas_object_smart_callback_add(bt, "clicked", _tt_move_lock, NULL);
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+
+ bt = elm_button_add(win);
elm_object_text_set(bt, "Orient Tooltip, click to change");
elm_object_tooltip_text_set(bt, "Top Left");
elm_object_tooltip_orient_set(bt, ELM_TOOLTIP_ORIENT_TOP_LEFT);
} Elm_Tooltip_Orient;
/**
+ * @def elm_tooltip_move_lock_set
+ * @since 1.9
+ *
+ * @brief Enable/Disable tooltip movement with respect to mouse pointer
+ *
+ * @param[in] obj The tooltip's anchor object
+ * @param[in] lock If EINA_TRUE, tooltip movement with respect to mouse pointer is disabled
+ *
+ * This function allows to enable/disable a tooltip to move with respect to mouse pointer
+ *
+ * @ingroup Tooltips
+ * @see elm_tooltip_move_lock_get
+ */
+EAPI void elm_tooltip_move_lock_set(Evas_Object *obj, Eina_Bool lock);
+
+/**
+ * @def elm_tooltip_move_lock_get
+ * @since 1.9
+ *
+ * @brief Get the lock status of tooltip movement with respect to mouse pointer
+ *
+ * @param[in] obj The tooltip's anchor object
+ * @return The lock status of tooltip movement with respect to mouse pointer
+ *
+ * This function returns the status of tooltip movement with respect to mouse pointer
+ *
+ * @ingroup Tooltips
+ * @see elm_tooltip_move_lock_set
+ */
+EAPI Eina_Bool elm_tooltip_move_lock_get(const Evas_Object *obj);
+
+/**
* @def elm_object_tooltip_orient_set
* @since 1.9
*
} rel_pos;
Elm_Tooltip_Orient orient; /** orientation for tooltip */
double hide_timeout; /* from theme */
+ Eina_Bool move_lock : 1; /* set/reset tooltip movement with respect to mouse pointer*/
Eina_Bool visible_lock:1;
Eina_Bool changed_style:1;
Eina_Bool free_size : 1;
(tt->eventarea, EVAS_CALLBACK_MOVE, _elm_tooltip_obj_move_cb, tt);
evas_object_event_callback_add
(tt->eventarea, EVAS_CALLBACK_RESIZE, _elm_tooltip_obj_resize_cb, tt);
- //No movement of tooltip upon mouse move if orientation set
- if ((tt->orient <= ELM_TOOLTIP_ORIENT_NONE) || (tt->orient >= ELM_TOOLTIP_ORIENT_LAST))
+ if (!tt->move_lock)
{
- evas_object_event_callback_add
- (tt->eventarea, EVAS_CALLBACK_MOUSE_MOVE, (Evas_Object_Event_Cb)_elm_tooltip_obj_mouse_move_cb, tt);
+ //No movement of tooltip upon mouse move if orientation set
+ if ((tt->orient <= ELM_TOOLTIP_ORIENT_NONE) || (tt->orient >= ELM_TOOLTIP_ORIENT_LAST))
+ {
+ evas_object_event_callback_add
+ (tt->eventarea, EVAS_CALLBACK_MOUSE_MOVE, (Evas_Object_Event_Cb)_elm_tooltip_obj_mouse_move_cb, tt);
+ }
}
-
tt->changed_style = EINA_TRUE;
_elm_tooltip_reconfigure_job_start(tt);
}
}
EAPI void
+elm_tooltip_move_lock_set(Evas_Object *obj, Eina_Bool lock)
+{
+ ELM_TOOLTIP_GET_OR_RETURN(tt, obj);
+
+ tt->move_lock = lock;
+}
+
+EAPI Eina_Bool
+elm_tooltip_move_lock_get(const Evas_Object *obj)
+{
+ ELM_TOOLTIP_GET_OR_RETURN(tt, obj, EINA_FALSE);
+
+ return tt->move_lock;
+}
+
+EAPI void
elm_object_tooltip_orient_set(Evas_Object *obj, Elm_Tooltip_Orient orient)
{
ELM_TOOLTIP_GET_OR_RETURN(tt, obj);