summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-08-02 18:35:57 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-08-04 11:52:16 +0900
commitaeacb54c35a62aac62e8cb5c4d2f40354ea4590b (patch)
tree02c589e37ff7593048a0c6e906a0827859edc392
parentf63a5648179bec9e9d817cdb7227d1d902b3c439 (diff)
downloadefl-aeacb54c35a62aac62e8cb5c4d2f40354ea4590b.tar.gz
cursor: EO-ify elm_cursor API
This creates an interface and makes Elm.Widget implement it. Next step: make elm_layout parts implement it. Ref T5315
-rw-r--r--src/Makefile_Elementary.am1
-rw-r--r--src/lib/elementary/efl_ui_cursor.eo71
-rw-r--r--src/lib/elementary/elm_cursor.h104
-rw-r--r--src/lib/elementary/elm_widget.eo5
-rw-r--r--src/lib/elementary/els_cursor.c28
5 files changed, 99 insertions, 110 deletions
diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am
index 993e13032e..20cd18884c 100644
--- a/src/Makefile_Elementary.am
+++ b/src/Makefile_Elementary.am
@@ -122,6 +122,7 @@ elm_public_eolian_files = \
lib/elementary/efl_ui_text_editable.eo \
lib/elementary/efl_config_global.eo \
lib/elementary/efl_ui_clock.eo \
+ lib/elementary/efl_ui_cursor.eo \
lib/elementary/efl_ui_image_factory.eo \
lib/elementary/efl_ui_focus_manager.eo \
lib/elementary/efl_ui_focus_manager_sub.eo \
diff --git a/src/lib/elementary/efl_ui_cursor.eo b/src/lib/elementary/efl_ui_cursor.eo
new file mode 100644
index 0000000000..9bb73c0a02
--- /dev/null
+++ b/src/lib/elementary/efl_ui_cursor.eo
@@ -0,0 +1,71 @@
+interface Efl.Ui.Cursor ()
+{
+ [[An interface to define mouse cursors to use when hovering
+ over UI widgets.
+
+ The Elementary cursor is an internal smart object used to customize the
+ mouse cursor displayed over objects (or widgets). In the most common
+ scenario, the cursor decoration comes from the graphical engine Elementary
+ is running on. Those engines may provide different decorations for cursors,
+ and Elementary provides functions to choose them (think of X11 cursors, as
+ an example).
+
+ By default, Elementary searches cursors only from engine. There's also the
+ possibility of, besides using engine provided cursors, also use the ones
+ coming from Edje theme files. Both globally and per widget, Elementary
+ makes it possible for one to make the cursors lookup to be held on engines
+ only or on Elementary's theme file, too. To set cursor's hot spot, two data
+ items should be added to cursor's theme: "hot_x" and "hot_y", that are the
+ offset from upper-left corner of the cursor (coordinates 0,0).
+ ]]
+ legacy_prefix: elm_object;
+ methods {
+ @property cursor {
+ [[The cursor to be shown when mouse is over the object
+
+ This is the cursor that will be displayed when mouse is over the
+ object. The object can have only one cursor set to it, so if
+ @.cursor.set is called twice for an object, the previous set
+ will be unset.
+
+ If using X cursors, a definition of all the valid cursor names
+ is listed on Elementary_Cursors.h. If an invalid name is set
+ the default cursor will be used.
+ ]]
+ set {
+ [[Sets or unsets the current cursor.
+
+ If $cursor is $null this function will reset the cursor
+ to the default one.
+ ]]
+ }
+ get { [[Returns the current cursor name.]] }
+ values {
+ cursor: string @nullable; [[The cursor name, defined either
+ by the display system or the theme.]]
+ }
+ }
+ @property cursor_style {
+ [[A different style for the cursor.
+
+ This only makes sense if theme cursors are used.
+ The cursor should be set with @.cursor.set first before
+ setting its style with this property.
+ ]]
+ values {
+ style: string; [[A specific style to use, eg. default,
+ transparent, ....]]
+ }
+ }
+ @property cursor_theme_search_enabled {
+ [[Whether the cursor may be looked in the theme or not.
+
+ If $false, the cursor may only come from the render engine,
+ i.e. from the display manager.
+ ]]
+ values {
+ allow: bool(true); [[Whether to use theme cursors.]]
+ }
+ }
+ }
+}
diff --git a/src/lib/elementary/elm_cursor.h b/src/lib/elementary/elm_cursor.h
index a7495c4f40..a3e983a1de 100644
--- a/src/lib/elementary/elm_cursor.h
+++ b/src/lib/elementary/elm_cursor.h
@@ -1,55 +1,14 @@
/**
* @defgroup Elm_Cursors Cursors
* @ingroup Elementary
- *
- * The Elementary cursor is an internal smart object used to
- * customize the mouse cursor displayed over objects (or
- * widgets). In the most common scenario, the cursor decoration
- * comes from the graphical @b engine Elementary is running
- * on. Those engines may provide different decorations for cursors,
- * and Elementary provides functions to choose them (think of X11
- * cursors, as an example).
- *
- * By default, Elementary searches cursors only from engine.
- * There's also the possibility of, besides using engine provided
- * cursors, also use the ones coming from Edje theme files. Both
- * globally and per widget, Elementary makes it possible for one to
- * make the cursors lookup to be held on engines only or on
- * Elementary's theme file, too. To set cursor's hot spot,
- * two data items should be added to cursor's theme: "hot_x" and
- * "hot_y", that are the offset from upper-left corner of the cursor
- * (coordinates 0,0).
- *
- * @{
*/
-/**
- * Set the cursor to be shown when mouse is over the object
- *
- * Set the cursor that will be displayed when mouse is over the
- * object. The object can have only one cursor set to it, so if
- * this function is called twice for an object, the previous set
- * will be unset.
- * If using X cursors, a definition of all the valid cursor names
- * is listed on Elementary_Cursors.h. If an invalid name is set
- * the default cursor will be used.
- *
- * @param obj the object being set a cursor.
- * @param cursor the cursor name to be used.
- *
- * @ingroup Elm_Cursors
- */
-EAPI void elm_object_cursor_set(Evas_Object *obj, const char *cursor);
+#ifdef EFL_EO_API_SUPPORT
+#include "efl_ui_cursor.eo.h"
+#endif
-/**
- * Get the cursor to be shown when mouse is over the object
- *
- * @param obj an object with cursor already set.
- * @return the cursor name.
- *
- * @ingroup Elm_Cursors
- */
-EAPI const char *elm_object_cursor_get(const Evas_Object *obj);
+#ifndef EFL_NOLEGACY_API_SUPPORT
+#include "efl_ui_cursor.eo.legacy.h"
/**
* Unset cursor for object
@@ -62,58 +21,9 @@ EAPI const char *elm_object_cursor_get(const Evas_Object *obj);
*
* @ingroup Elm_Cursors
*/
-EAPI void elm_object_cursor_unset(Evas_Object *obj);
+EAPI void elm_object_cursor_unset(Evas_Object *obj);
-/**
- * Sets a different style for this object cursor.
- *
- * @note before you set a style you should define a cursor with
- * elm_object_cursor_set()
- *
- * @param obj an object with cursor already set.
- * @param style the theme style to use (default, transparent, ...)
- *
- * @ingroup Elm_Cursors
- */
-EAPI void elm_object_cursor_style_set(Evas_Object *obj, const char *style);
-
-/**
- * Get the style for this object cursor.
- *
- * @param obj an object with cursor already set.
- * @return style the theme style in use, defaults to "default". If the
- * object does not have a cursor set, then NULL is returned.
- *
- * @ingroup Elm_Cursors
- */
-EAPI const char *elm_object_cursor_style_get(const Evas_Object *obj);
-
-/**
- * Set if the cursor set should be searched on the theme or should use
- * the provided by the engine, only.
- *
- * @note before you set theme_search you should define a cursor with
- * elm_object_cursor_set(). By default it will only look for cursors
- * provided by the engine.
- *
- * @param obj an object with cursor already set.
- * @param theme_search boolean to define if cursors should be searched
- * on widget's theme.
- *
- * @ingroup Elm_Cursors
- */
-EAPI void elm_object_cursor_theme_search_enabled_set(Evas_Object *obj, Eina_Bool theme_search);
-
-/**
- * Get if the cursor set should be searched on the theme for this object cursor.
- *
- * @param obj an object with cursor already set.
- * @return @c EINA_TRUE if the cursor set should be searched on widget's theme,
- * @c EINA_FALSE otherwise.
- *
- * @ingroup Elm_Cursors
- */
-EAPI Eina_Bool elm_object_cursor_theme_search_enabled_get(const Evas_Object *obj);
+#endif
/**
* @}
diff --git a/src/lib/elementary/elm_widget.eo b/src/lib/elementary/elm_widget.eo
index 78b77cf605..a9867c8a0a 100644
--- a/src/lib/elementary/elm_widget.eo
+++ b/src/lib/elementary/elm_widget.eo
@@ -31,7 +31,7 @@ struct @extern Elm.Theme; [[Elementary theme]]
abstract Elm.Widget (Efl.Canvas.Group, Elm.Interface.Atspi_Accessible,
Elm.Interface.Atspi_Component, Efl.Ui.Focus.User,
- Efl.Ui.Focus.Object, Efl.Ui.Base)
+ Efl.Ui.Focus.Object, Efl.Ui.Base, Efl.Ui.Cursor)
{
[[Elementary widget abstract class]]
legacy_prefix: elm_widget;
@@ -811,6 +811,9 @@ abstract Elm.Widget (Efl.Canvas.Group, Elm.Interface.Atspi_Accessible,
Efl.Ui.Base.scale { get; set; }
Efl.Ui.Base.mirrored { get; set; }
Efl.Ui.Base.mirrored_automatic { get; set; }
+ Efl.Ui.Cursor.cursor { get; set; }
+ Efl.Ui.Cursor.cursor_style { get; set; }
+ Efl.Ui.Cursor.cursor_theme_search_enabled { get; set; }
}
events {
moved; [[Called when widget moved]]
diff --git a/src/lib/elementary/els_cursor.c b/src/lib/elementary/els_cursor.c
index 3d09d9addd..b02f02e594 100644
--- a/src/lib/elementary/els_cursor.c
+++ b/src/lib/elementary/els_cursor.c
@@ -636,15 +636,16 @@ elm_object_sub_cursor_set(Evas_Object *eventarea, Evas_Object *owner, const char
_elm_cursor_del, cur);
}
-EAPI void
-elm_object_cursor_set(Evas_Object *obj, const char *cursor)
+EOLIAN void
+_elm_widget_efl_ui_cursor_cursor_set(Evas_Object *obj, Elm_Widget_Smart_Data *pd EINA_UNUSED,
+ const char *cursor)
{
EINA_SAFETY_ON_NULL_RETURN(obj);
elm_object_sub_cursor_set(obj, obj, cursor);
}
-EAPI const char *
-elm_object_cursor_get(const Evas_Object *obj)
+EOLIAN const char *
+_elm_widget_efl_ui_cursor_cursor_get(const Evas_Object *obj, Elm_Widget_Smart_Data *pd EINA_UNUSED)
{
ELM_CURSOR_GET_OR_RETURN(cur, obj, NULL);
return cur->cursor_name;
@@ -712,8 +713,9 @@ elm_object_cursor_unset(Evas_Object *obj)
free(cur);
}
-EAPI void
-elm_object_cursor_style_set(Evas_Object *obj, const char *style)
+EOLIAN void
+_elm_widget_efl_ui_cursor_cursor_style_set(Evas_Object *obj, Elm_Widget_Smart_Data *pd EINA_UNUSED,
+ const char *style)
{
ELM_CURSOR_GET_OR_RETURN(cur, obj);
@@ -739,8 +741,8 @@ elm_object_cursor_style_set(Evas_Object *obj, const char *style)
}
}
-EAPI const char *
-elm_object_cursor_style_get(const Evas_Object *obj)
+EOLIAN const char *
+_elm_widget_efl_ui_cursor_cursor_style_get(const Evas_Object *obj, Elm_Widget_Smart_Data *pd EINA_UNUSED)
{
ELM_CURSOR_GET_OR_RETURN(cur, obj, NULL);
return cur->style ? cur->style : "default";
@@ -761,8 +763,9 @@ elm_cursor_theme(Elm_Cursor *cur)
_elm_cursor_set_hot_spots(cur);
}
-EAPI void
-elm_object_cursor_theme_search_enabled_set(Evas_Object *obj, Eina_Bool theme_search)
+EOLIAN void
+_elm_widget_efl_ui_cursor_cursor_theme_search_enabled_set(Evas_Object *obj, Elm_Widget_Smart_Data *pd EINA_UNUSED,
+ Eina_Bool theme_search)
{
ELM_CURSOR_GET_OR_RETURN(cur, obj);
cur->theme_search = theme_search;
@@ -770,10 +773,11 @@ elm_object_cursor_theme_search_enabled_set(Evas_Object *obj, Eina_Bool theme_sea
_elm_cursor_cur_set(cur);
}
-EAPI Eina_Bool
-elm_object_cursor_theme_search_enabled_get(const Evas_Object *obj)
+EOLIAN Eina_Bool
+_elm_widget_efl_ui_cursor_cursor_theme_search_enabled_get(const Evas_Object *obj, Elm_Widget_Smart_Data *pd EINA_UNUSED)
{
ELM_CURSOR_GET_OR_RETURN(cur, obj, EINA_FALSE);
return cur->theme_search;
}
+#include "efl_ui_cursor.eo.c"