api: remove efl.ui.cursor interface

this existed only to provide the methods for Efl.Ui.Layout_Part and fill
in implementation for some legacy functions which should probably not be
supported going forward

the corresponding methods have been merged into efl_ui_widget and the
legacy functions no longer use eolian-generated implementations

Reviewed-by: WooHyun Jung <woohyun0705@gmail.com>
Differential Revision: https://phab.enlightenment.org/D7899
This commit is contained in:
Mike Blumenkrantz 2019-02-08 14:36:05 -05:00 committed by Marcel Hollerbach
parent 2b2bf31264
commit 41f0ebb52b
9 changed files with 246 additions and 170 deletions

View File

@ -59,7 +59,6 @@ elm_public_eolian_files = \
lib/elementary/efl_ui_textpath_legacy.eo \
lib/elementary/efl_ui_l10n.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_calc.eo \

View File

@ -1,88 +0,0 @@
interface @beta 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. These engines may provide different decorations for cursors,
and Elementary provides functions to choose them for instance
X11 cursors.
By default, Elementary searches cursors only from the engine. Besides
using cursors provided by the you can also use those
coming from Edje theme files. Both globally and per widget, Elementary
can help you store cursors in engines
only or in Elementary's theme file. To set cursor's hot spot two data
items must be added to the cursor's theme: "hot_x" and "hot_y" are the
offset from the 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.
]]
return: bool; [[$true if successful.]]
}
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.
]]
set {
[[Sets a style for the current cursor. Call after @.cursor.set.]]
return: bool; [[$true if successful.]]
}
get {
[[Returns the current cursor style name.]]
}
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.
]]
set {
[[Enables or disables theme cursors.]]
return: bool; [[$true if successful.]]
}
get {
[[Returns the current state of theme cursors search.]]
}
values {
allow: bool(true); [[Whether to use theme cursors.]]
}
}
}
}

View File

@ -2497,56 +2497,6 @@ _efl_ui_layout_default_text_part_get(const Eo *obj, Efl_Ui_Layout_Data *sd EINA_
return part;
}
/* Efl.Ui.Layout_Part (common) */
EOLIAN static Eina_Bool
_efl_ui_layout_part_efl_ui_cursor_cursor_set(Eo *obj, void *_pd EINA_UNUSED, const char *cursor)
{
Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
Efl_Ui_Layout_Data *sd = efl_data_scope_get(pd->obj, MY_CLASS);
return _efl_ui_layout_part_cursor_set(sd, pd->part, cursor);
}
EOLIAN static const char *
_efl_ui_layout_part_efl_ui_cursor_cursor_get(const Eo *obj, void *_pd EINA_UNUSED)
{
Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
Efl_Ui_Layout_Data *sd = efl_data_scope_get(pd->obj, MY_CLASS);
return _efl_ui_layout_part_cursor_get(sd, pd->part);
}
EOLIAN static Eina_Bool
_efl_ui_layout_part_efl_ui_cursor_cursor_style_set(Eo *obj, void *_pd EINA_UNUSED, const char *style)
{
Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
Efl_Ui_Layout_Data *sd = efl_data_scope_get(pd->obj, MY_CLASS);
return _efl_ui_layout_part_cursor_style_set(sd, pd->part, style);
}
EOLIAN static const char *
_efl_ui_layout_part_efl_ui_cursor_cursor_style_get(const Eo *obj, void *_pd EINA_UNUSED)
{
Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
Efl_Ui_Layout_Data *sd = efl_data_scope_get(pd->obj, MY_CLASS);
return _efl_ui_layout_part_cursor_style_get(sd, pd->part);
}
EOLIAN static Eina_Bool
_efl_ui_layout_part_efl_ui_cursor_cursor_theme_search_enabled_set(Eo *obj, void *_pd EINA_UNUSED, Eina_Bool allow)
{
Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
Efl_Ui_Layout_Data *sd = efl_data_scope_get(pd->obj, MY_CLASS);
return _efl_ui_layout_part_cursor_engine_only_set(sd, pd->part, !allow);
}
EOLIAN static Eina_Bool
_efl_ui_layout_part_efl_ui_cursor_cursor_theme_search_enabled_get(const Eo *obj, void *_pd EINA_UNUSED)
{
Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
Efl_Ui_Layout_Data *sd = efl_data_scope_get(pd->obj, MY_CLASS);
return !_efl_ui_layout_part_cursor_engine_only_get(sd, pd->part);
}
#define CONTENT_FULL(part_typename, typename, CLASS, TYPENAME) \
ELM_PART_OVERRIDE_CONTENT_GET_FULL(part_typename, typename, ELM_PART_OVERRIDE_INTERNALS_FETCH(CLASS, TYPENAME)) \
ELM_PART_OVERRIDE_CONTENT_SET_FULL(part_typename, typename, ELM_PART_OVERRIDE_INTERNALS_FETCH(CLASS, TYPENAME)) \
@ -2794,43 +2744,57 @@ elm_layout_text_get(const Eo *obj, const char *part)
EAPI Eina_Bool
elm_layout_part_cursor_engine_only_set(Eo *obj, const char *part, Eina_Bool engine_only)
{
return efl_ui_cursor_theme_search_enabled_set(efl_part(obj, part), !engine_only);
Efl_Ui_Layout_Data *sd = efl_data_scope_get(obj, MY_CLASS);
EINA_SAFETY_ON_NULL_RETURN_VAL(sd, EINA_FALSE);
return _efl_ui_layout_part_cursor_engine_only_set(sd, part, engine_only);
}
EAPI Eina_Bool
elm_layout_part_cursor_engine_only_get(const Eo *obj, const char *part)
{
return !efl_ui_cursor_theme_search_enabled_get(efl_part(obj, part));
Efl_Ui_Layout_Data *sd = efl_data_scope_get(obj, MY_CLASS);
EINA_SAFETY_ON_NULL_RETURN_VAL(sd, EINA_FALSE);
return _efl_ui_layout_part_cursor_engine_only_get(sd, part);
}
EAPI Eina_Bool
elm_layout_part_cursor_set(Eo *obj, const char *part, const char *cursor)
{
return efl_ui_cursor_set(efl_part(obj, part), cursor);
Efl_Ui_Layout_Data *sd = efl_data_scope_get(obj, MY_CLASS);
EINA_SAFETY_ON_NULL_RETURN_VAL(sd, EINA_FALSE);
return _efl_ui_layout_part_cursor_set(sd, part, cursor);
}
EAPI const char *
elm_layout_part_cursor_get(const Eo *obj, const char *part)
{
return efl_ui_cursor_get(efl_part(obj, part));
Efl_Ui_Layout_Data *sd = efl_data_scope_get(obj, MY_CLASS);
EINA_SAFETY_ON_NULL_RETURN_VAL(sd, NULL);
return _efl_ui_layout_part_cursor_get(sd, part);
}
EAPI Eina_Bool
elm_layout_part_cursor_style_set(Eo *obj, const char *part, const char *style)
{
return efl_ui_cursor_style_set(efl_part(obj, part), style);
Efl_Ui_Layout_Data *sd = efl_data_scope_get(obj, MY_CLASS);
EINA_SAFETY_ON_NULL_RETURN_VAL(sd, EINA_FALSE);
return _efl_ui_layout_part_cursor_style_set(sd, part, style);
}
EAPI const char *
elm_layout_part_cursor_style_get(const Eo *obj, const char *part)
{
return efl_ui_cursor_style_get(efl_part(obj, part));
Efl_Ui_Layout_Data *sd = efl_data_scope_get(obj, MY_CLASS);
EINA_SAFETY_ON_NULL_RETURN_VAL(sd, NULL);
return _efl_ui_layout_part_cursor_style_get(sd, part);
}
EAPI Eina_Bool
elm_layout_part_cursor_unset(Eo *obj, const char *part)
{
return efl_ui_cursor_set(efl_part(obj, part), NULL);
Efl_Ui_Layout_Data *sd = efl_data_scope_get(obj, MY_CLASS);
EINA_SAFETY_ON_NULL_RETURN_VAL(sd, EINA_FALSE);
return _efl_ui_layout_part_cursor_set(sd, part, NULL);
}
EAPI int

View File

@ -1,10 +1,5 @@
class @beta Efl.Ui.Layout_Part extends Efl.Ui.Widget_Part implements Efl.Ui.Cursor
class @beta Efl.Ui.Layout_Part extends Efl.Ui.Widget_Part
{
[[Elementary layout internal part class]]
data: null;
implements {
Efl.Ui.Cursor.cursor { get; set; }
Efl.Ui.Cursor.cursor_style { get; set; }
Efl.Ui.Cursor.cursor_theme_search_enabled { get; set; }
}
}

View File

@ -15,7 +15,7 @@ struct Efl.Ui.Widget_Focus_State {
abstract @beta Efl.Ui.Widget extends Efl.Canvas.Group implements Efl.Access.Object,
Efl.Access.Component, Efl.Part, Efl.Ui.Focus.Object,
Efl.Ui.Cursor, Efl.Ui.L10n,
Efl.Ui.L10n,
Efl.Ui.Selection, Efl.Ui.Dnd
{
[[Efl UI widget abstract class]]
@ -24,6 +24,70 @@ abstract @beta Efl.Ui.Widget extends Efl.Canvas.Group implements Efl.Access.Obje
event_prefix: efl_ui_widget;
data: Efl_Ui_Widget_Data;
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.
]]
return: bool; [[$true if successful.]]
}
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.
]]
set {
[[Sets a style for the current cursor. Call after @.cursor.set.]]
return: bool; [[$true if successful.]]
}
get {
[[Returns the current cursor style name.]]
}
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.
]]
set {
[[Enables or disables theme cursors.]]
return: bool; [[$true if successful.]]
}
get {
[[Returns the current state of theme cursors search.]]
}
values {
allow: bool(true); [[Whether to use theme cursors.]]
}
}
@property resize_object @protected {
[[This is the internal canvas object managed by a widget.
@ -587,9 +651,6 @@ abstract @beta Efl.Ui.Widget extends Efl.Canvas.Group implements Efl.Access.Obje
Efl.Ui.Focus.Object.focus { set; }
Efl.Ui.I18n.mirrored { get; set; }
Efl.Ui.I18n.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; }
Efl.Ui.Focus.Object.on_focus_update;
Efl.Ui.L10n.translation_update; [[This implements the calls to $gettext() and $text_set().]]
Efl.Part.part_get; [[Returns @Efl.Ui.Widget_Part.]]

View File

@ -3,12 +3,123 @@
* @ingroup Elementary
*/
#ifdef EFL_EO_API_SUPPORT
#include "efl_ui_cursor.eo.h"
#endif
#ifndef EFL_NOLEGACY_API_SUPPORT
#include "efl_ui_cursor.eo.legacy.h"
/**
* @brief 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 @ref elm_object_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.
*
* Sets or unsets the current cursor.
*
* If @c cursor is @c null this function will reset the cursor to the default
* one.
*
* @param[in] obj The object.
* @param[in] cursor The cursor name, defined either by the display system or
* the theme.
*
* @return @c true if successful.
*
* @ingroup Elm_Cursors
*/
EAPI Eina_Bool elm_object_cursor_set(Eo *obj, const char *cursor);
/**
* @brief 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 @ref elm_object_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.
*
* Returns the current cursor name.
*
* @param[in] obj The object.
*
* @return The cursor name, defined either by the display system or the theme.
*
* @ingroup Elm_Cursors
*/
EAPI const char *elm_object_cursor_get(const Eo *obj);
/**
* @brief A different style for the cursor.
*
* This only makes sense if theme cursors are used. The cursor should be set
* with @ref elm_object_cursor_set first before setting its style with this
* property.
*
* Sets a style for the current cursor. Call after @ref elm_object_cursor_set.
*
* @param[in] obj The object.
* @param[in] style A specific style to use, eg. default, transparent, ....
*
* @return @c true if successful.
*
* @ingroup Elm_Cursors
*/
EAPI Eina_Bool elm_object_cursor_style_set(Eo *obj, const char *style);
/**
* @brief A different style for the cursor.
*
* This only makes sense if theme cursors are used. The cursor should be set
* with @ref elm_object_cursor_set first before setting its style with this
* property.
*
* Returns the current cursor style name.
*
* @param[in] obj The object.
*
* @return A specific style to use, eg. default, transparent, ....
*
* @ingroup Elm_Cursors
*/
EAPI const char *elm_object_cursor_style_get(const Eo *obj);
/**
* @brief Whether the cursor may be looked in the theme or not.
*
* If @c false, the cursor may only come from the render engine, i.e. from the
* display manager.
*
* Enables or disables theme cursors.
*
* @param[in] obj The object.
* @param[in] allow Whether to use theme cursors.
*
* @return @c true if successful.
*
* @ingroup Elm_Cursors
*/
EAPI Eina_Bool elm_object_cursor_theme_search_enabled_set(Eo *obj, Eina_Bool allow);
/**
* @brief Whether the cursor may be looked in the theme or not.
*
* If @c false, the cursor may only come from the render engine, i.e. from the
* display manager.
*
* Returns the current state of theme cursors search.
*
* @param[in] obj The object.
*
* @return Whether to use theme cursors.
*
* @ingroup Elm_Cursors
*/
EAPI Eina_Bool elm_object_cursor_theme_search_enabled_get(const Eo *obj);
/**
* Unset cursor for object

View File

@ -1967,3 +1967,40 @@ elm_object_item_del(Eo *obj)
efl_event_callback_add(obj, EFL_EVENT_NOREF, _item_noref, NULL);
item->on_deletion = EINA_TRUE;
}
EAPI Eina_Bool
elm_object_cursor_set(Eo *obj, const char *cursor)
{
return efl_ui_widget_cursor_set(obj, cursor);
}
EAPI const char *
elm_object_cursor_get(const Eo *obj)
{
return efl_ui_widget_cursor_get(obj);
}
EAPI Eina_Bool
elm_object_cursor_style_set(Eo *obj, const char *style)
{
return efl_ui_widget_cursor_style_set(obj, style);
}
EAPI const char *
elm_object_cursor_style_get(const Eo *obj)
{
return efl_ui_widget_cursor_style_get(obj);
}
EAPI Eina_Bool
elm_object_cursor_theme_search_enabled_set(Eo *obj, Eina_Bool allow)
{
return efl_ui_widget_cursor_theme_search_enabled_set(obj, allow);
}
EAPI Eina_Bool
elm_object_cursor_theme_search_enabled_get(const Eo *obj)
{
return efl_ui_widget_cursor_theme_search_enabled_get(obj);
}

View File

@ -672,7 +672,7 @@ elm_object_sub_cursor_set(Evas_Object *eventarea, Evas_Object *owner, const char
}
EOLIAN Eina_Bool
_efl_ui_widget_efl_ui_cursor_cursor_set(Evas_Object *obj, Elm_Widget_Smart_Data *pd EINA_UNUSED,
_efl_ui_widget_cursor_set(Evas_Object *obj, Elm_Widget_Smart_Data *pd EINA_UNUSED,
const char *cursor)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
@ -688,7 +688,7 @@ elm_object_sub_cursor_get(const Evas_Object *obj)
}
EOLIAN const char *
_efl_ui_widget_efl_ui_cursor_cursor_get(const Evas_Object *obj, Elm_Widget_Smart_Data *pd EINA_UNUSED)
_efl_ui_widget_cursor_get(const Evas_Object *obj, Elm_Widget_Smart_Data *pd EINA_UNUSED)
{
return elm_object_sub_cursor_get(obj);
}
@ -793,7 +793,7 @@ elm_object_sub_cursor_style_set(Evas_Object *obj, const char *style)
}
EOLIAN Eina_Bool
_efl_ui_widget_efl_ui_cursor_cursor_style_set(Evas_Object *obj, Elm_Widget_Smart_Data *pd EINA_UNUSED,
_efl_ui_widget_cursor_style_set(Evas_Object *obj, Elm_Widget_Smart_Data *pd EINA_UNUSED,
const char *style)
{
return elm_object_sub_cursor_style_set(obj, style);
@ -807,7 +807,7 @@ elm_object_sub_cursor_style_get(const Evas_Object *obj)
}
EOLIAN const char *
_efl_ui_widget_efl_ui_cursor_cursor_style_get(const Evas_Object *obj, Elm_Widget_Smart_Data *pd EINA_UNUSED)
_efl_ui_widget_cursor_style_get(const Evas_Object *obj, Elm_Widget_Smart_Data *pd EINA_UNUSED)
{
return elm_object_sub_cursor_style_get(obj);
}
@ -838,7 +838,7 @@ elm_object_sub_cursor_theme_search_enabled_set(Evas_Object *obj, Eina_Bool theme
}
EOLIAN Eina_Bool
_efl_ui_widget_efl_ui_cursor_cursor_theme_search_enabled_set(Evas_Object *obj, Elm_Widget_Smart_Data *pd EINA_UNUSED,
_efl_ui_widget_cursor_theme_search_enabled_set(Evas_Object *obj, Elm_Widget_Smart_Data *pd EINA_UNUSED,
Eina_Bool theme_search)
{
return elm_object_sub_cursor_theme_search_enabled_set(obj, theme_search);
@ -852,9 +852,7 @@ elm_object_sub_cursor_theme_search_enabled_get(const Evas_Object *obj)
}
EOLIAN Eina_Bool
_efl_ui_widget_efl_ui_cursor_cursor_theme_search_enabled_get(const Evas_Object *obj, Elm_Widget_Smart_Data *pd EINA_UNUSED)
_efl_ui_widget_cursor_theme_search_enabled_get(const Evas_Object *obj, Elm_Widget_Smart_Data *pd EINA_UNUSED)
{
return elm_object_sub_cursor_theme_search_enabled_get(obj);
}
#include "efl_ui_cursor.eo.c"

View File

@ -182,7 +182,6 @@ pub_eo_files = [
'efl_ui_textpath.eo',
'efl_ui_l10n.eo',
'efl_ui_clock.eo',
'efl_ui_cursor.eo',
'efl_ui_image_factory.eo',
'efl_ui_focus_manager.eo',
'efl_ui_focus_manager_calc.eo',