forked from enlightenment/efl
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
This commit is contained in:
parent
f63a564817
commit
aeacb54c35
|
@ -122,6 +122,7 @@ elm_public_eolian_files = \
|
||||||
lib/elementary/efl_ui_text_editable.eo \
|
lib/elementary/efl_ui_text_editable.eo \
|
||||||
lib/elementary/efl_config_global.eo \
|
lib/elementary/efl_config_global.eo \
|
||||||
lib/elementary/efl_ui_clock.eo \
|
lib/elementary/efl_ui_clock.eo \
|
||||||
|
lib/elementary/efl_ui_cursor.eo \
|
||||||
lib/elementary/efl_ui_image_factory.eo \
|
lib/elementary/efl_ui_image_factory.eo \
|
||||||
lib/elementary/efl_ui_focus_manager.eo \
|
lib/elementary/efl_ui_focus_manager.eo \
|
||||||
lib/elementary/efl_ui_focus_manager_sub.eo \
|
lib/elementary/efl_ui_focus_manager_sub.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.]]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,55 +1,14 @@
|
||||||
/**
|
/**
|
||||||
* @defgroup Elm_Cursors Cursors
|
* @defgroup Elm_Cursors Cursors
|
||||||
* @ingroup Elementary
|
* @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).
|
|
||||||
*
|
|
||||||
* @{
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
#ifdef EFL_EO_API_SUPPORT
|
||||||
* Set the cursor to be shown when mouse is over the object
|
#include "efl_ui_cursor.eo.h"
|
||||||
*
|
#endif
|
||||||
* 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);
|
|
||||||
|
|
||||||
/**
|
#ifndef EFL_NOLEGACY_API_SUPPORT
|
||||||
* Get the cursor to be shown when mouse is over the object
|
#include "efl_ui_cursor.eo.legacy.h"
|
||||||
*
|
|
||||||
* @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);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unset cursor for object
|
* Unset cursor for object
|
||||||
|
@ -64,56 +23,7 @@ EAPI const char *elm_object_cursor_get(const Evas_Object *obj);
|
||||||
*/
|
*/
|
||||||
EAPI void elm_object_cursor_unset(Evas_Object *obj);
|
EAPI void elm_object_cursor_unset(Evas_Object *obj);
|
||||||
|
|
||||||
/**
|
#endif
|
||||||
* 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);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
|
|
|
@ -31,7 +31,7 @@ struct @extern Elm.Theme; [[Elementary theme]]
|
||||||
|
|
||||||
abstract Elm.Widget (Efl.Canvas.Group, Elm.Interface.Atspi_Accessible,
|
abstract Elm.Widget (Efl.Canvas.Group, Elm.Interface.Atspi_Accessible,
|
||||||
Elm.Interface.Atspi_Component, Efl.Ui.Focus.User,
|
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]]
|
[[Elementary widget abstract class]]
|
||||||
legacy_prefix: elm_widget;
|
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.scale { get; set; }
|
||||||
Efl.Ui.Base.mirrored { get; set; }
|
Efl.Ui.Base.mirrored { get; set; }
|
||||||
Efl.Ui.Base.mirrored_automatic { 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 {
|
events {
|
||||||
moved; [[Called when widget moved]]
|
moved; [[Called when widget moved]]
|
||||||
|
|
|
@ -636,15 +636,16 @@ elm_object_sub_cursor_set(Evas_Object *eventarea, Evas_Object *owner, const char
|
||||||
_elm_cursor_del, cur);
|
_elm_cursor_del, cur);
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EOLIAN void
|
||||||
elm_object_cursor_set(Evas_Object *obj, const char *cursor)
|
_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);
|
EINA_SAFETY_ON_NULL_RETURN(obj);
|
||||||
elm_object_sub_cursor_set(obj, obj, cursor);
|
elm_object_sub_cursor_set(obj, obj, cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI const char *
|
EOLIAN const char *
|
||||||
elm_object_cursor_get(const Evas_Object *obj)
|
_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);
|
ELM_CURSOR_GET_OR_RETURN(cur, obj, NULL);
|
||||||
return cur->cursor_name;
|
return cur->cursor_name;
|
||||||
|
@ -712,8 +713,9 @@ elm_object_cursor_unset(Evas_Object *obj)
|
||||||
free(cur);
|
free(cur);
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EOLIAN void
|
||||||
elm_object_cursor_style_set(Evas_Object *obj, const char *style)
|
_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);
|
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 *
|
EOLIAN const char *
|
||||||
elm_object_cursor_style_get(const Evas_Object *obj)
|
_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);
|
ELM_CURSOR_GET_OR_RETURN(cur, obj, NULL);
|
||||||
return cur->style ? cur->style : "default";
|
return cur->style ? cur->style : "default";
|
||||||
|
@ -761,8 +763,9 @@ elm_cursor_theme(Elm_Cursor *cur)
|
||||||
_elm_cursor_set_hot_spots(cur);
|
_elm_cursor_set_hot_spots(cur);
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EOLIAN void
|
||||||
elm_object_cursor_theme_search_enabled_set(Evas_Object *obj, Eina_Bool theme_search)
|
_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);
|
ELM_CURSOR_GET_OR_RETURN(cur, obj);
|
||||||
cur->theme_search = theme_search;
|
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);
|
_elm_cursor_cur_set(cur);
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Eina_Bool
|
EOLIAN Eina_Bool
|
||||||
elm_object_cursor_theme_search_enabled_get(const Evas_Object *obj)
|
_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);
|
ELM_CURSOR_GET_OR_RETURN(cur, obj, EINA_FALSE);
|
||||||
return cur->theme_search;
|
return cur->theme_search;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include "efl_ui_cursor.eo.c"
|
||||||
|
|
Loading…
Reference in New Issue