This makes layout parts implement Efl.Ui.Cursor.
This also adds the missing bool returns from that interface.
This removes 7 APIs from Elm.Layout.
Ref T5315
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.]]
}
- get { [[Returns the current cursor name.]] }
values {
cursor: string @nullable; [[The cursor name, defined either
by the display system or the theme.]]
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, ....]]
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.]]
}
Eo *_elm_layout_pack_proxy_get(Elm_Layout *obj, Edje_Part_Type type, const char *part);
static void _efl_model_properties_changed_cb(void *, const Efl_Event *);
+static Eina_Bool _elm_layout_part_cursor_unset(Elm_Layout_Smart_Data *sd, const char *part_name);
static const char SIG_THEME_CHANGED[] = "theme,changed";
const char SIG_LAYOUT_FOCUSED[] = "focused";
return 0;
}
-EOLIAN static Eina_Bool
-_elm_layout_part_cursor_set(Eo *obj, Elm_Layout_Smart_Data *sd, const char *part_name, const char *cursor)
+static Eina_Bool
+_elm_layout_part_cursor_set(Elm_Layout_Smart_Data *sd, const char *part_name, const char *cursor)
{
+ Evas_Object *part_obj;
+ Elm_Layout_Sub_Object_Cursor *pc;
+ Eo *obj = sd->obj;
+
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
EINA_SAFETY_ON_NULL_RETURN_VAL(part_name, EINA_FALSE);
- Evas_Object *part_obj;
- Elm_Layout_Sub_Object_Cursor *pc;
+ if (!cursor) return _elm_layout_part_cursor_unset(sd, part_name);
part_obj = (Evas_Object *)edje_object_part_object_get
(wd->resize_obj, part_name);
return EINA_TRUE;
}
-EOLIAN static const char*
-_elm_layout_part_cursor_get(const Eo *obj EINA_UNUSED, Elm_Layout_Smart_Data *sd, const char *part_name)
+static const char *
+_elm_layout_part_cursor_get(Elm_Layout_Smart_Data *sd, const char *part_name)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(part_name, NULL);
return elm_object_cursor_get(pc->obj);
}
-EOLIAN static Eina_Bool
-_elm_layout_part_cursor_unset(Eo *obj EINA_UNUSED, Elm_Layout_Smart_Data *sd, const char *part_name)
+static Eina_Bool
+_elm_layout_part_cursor_unset(Elm_Layout_Smart_Data *sd, const char *part_name)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(part_name, EINA_FALSE);
return EINA_FALSE;
}
-EOLIAN static Eina_Bool
-_elm_layout_part_cursor_style_set(Eo *obj EINA_UNUSED, Elm_Layout_Smart_Data *sd, const char *part_name, const char *style)
+static Eina_Bool
+_elm_layout_part_cursor_style_set(Elm_Layout_Smart_Data *sd, const char *part_name, const char *style)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(part_name, EINA_FALSE);
return EINA_TRUE;
}
-EOLIAN static const char*
-_elm_layout_part_cursor_style_get(const Eo *obj EINA_UNUSED, Elm_Layout_Smart_Data *sd, const char *part_name)
+static const char*
+_elm_layout_part_cursor_style_get(Elm_Layout_Smart_Data *sd, const char *part_name)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(part_name, NULL);
return elm_object_cursor_style_get(pc->obj);
}
-EOLIAN static Eina_Bool
-_elm_layout_part_cursor_engine_only_set(Eo *obj EINA_UNUSED, Elm_Layout_Smart_Data *sd, const char *part_name, Eina_Bool engine_only)
+static Eina_Bool
+_elm_layout_part_cursor_engine_only_set(Elm_Layout_Smart_Data *sd, const char *part_name, Eina_Bool engine_only)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(part_name, EINA_FALSE);
return EINA_TRUE;
}
-EOLIAN static Eina_Bool
-_elm_layout_part_cursor_engine_only_get(const Eo *obj EINA_UNUSED, Elm_Layout_Smart_Data *sd, const char *part_name)
+static Eina_Bool
+_elm_layout_part_cursor_engine_only_get(Elm_Layout_Smart_Data *sd, const char *part_name)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(part_name, EINA_FALSE);
return efl_text_get(efl_part(obj, part));
}
+EAPI Eina_Bool
+elm_layout_part_cursor_engine_only_set(Elm_Layout *obj, const char *part, Eina_Bool engine_only)
+{
+ return efl_ui_cursor_theme_search_enabled_set(efl_part(obj, part), !engine_only);
+}
+
+EAPI Eina_Bool
+elm_layout_part_cursor_engine_only_get(const Elm_Layout *obj, const char *part)
+{
+ return !efl_ui_cursor_theme_search_enabled_get(efl_part(obj, part));
+}
+
+EAPI Eina_Bool
+elm_layout_part_cursor_set(Elm_Layout *obj, const char *part, const char *cursor)
+{
+ return efl_ui_cursor_set(efl_part(obj, part), cursor);
+}
+
+EAPI const char *
+elm_layout_part_cursor_get(const Elm_Layout *obj, const char *part)
+{
+ return efl_ui_cursor_get(efl_part(obj, part));
+}
+
+EAPI Eina_Bool
+elm_layout_part_cursor_style_set(Elm_Layout *obj, const char *part, const char *style)
+{
+ return efl_ui_cursor_style_set(efl_part(obj, part), style);
+}
+
+EAPI const char *
+elm_layout_part_cursor_style_get(const Elm_Layout *obj, const char *part)
+{
+ return efl_ui_cursor_style_get(efl_part(obj, part));
+}
+
+EAPI Eina_Bool
+elm_layout_part_cursor_unset(Elm_Layout *obj, const char *part)
+{
+ return efl_ui_cursor_set(efl_part(obj, part), NULL);
+}
+
+/* End of legacy only */
+
+
/* Efl.Part implementation */
static EOLIAN Efl_Object *
return part;
}
+EOLIAN static Eina_Bool
+_elm_layout_internal_part_efl_ui_cursor_cursor_set(Eo *obj, Elm_Part_Data *pd, const char *cursor)
+{
+ ELM_PART_RETURN_VAL(_elm_layout_part_cursor_set(pd->sd, pd->part, cursor));
+}
+
+EOLIAN static const char *
+_elm_layout_internal_part_efl_ui_cursor_cursor_get(Eo *obj, Elm_Part_Data *pd)
+{
+ ELM_PART_RETURN_VAL(_elm_layout_part_cursor_get(pd->sd, pd->part));
+}
+
+EOLIAN static Eina_Bool
+_elm_layout_internal_part_efl_ui_cursor_cursor_style_set(Eo *obj, Elm_Part_Data *pd, const char *style)
+{
+ ELM_PART_RETURN_VAL(_elm_layout_part_cursor_style_set(pd->sd, pd->part, style));
+}
+
+EOLIAN static const char *
+_elm_layout_internal_part_efl_ui_cursor_cursor_style_get(Eo *obj, Elm_Part_Data *pd)
+{
+ ELM_PART_RETURN_VAL(_elm_layout_part_cursor_style_get(pd->sd, pd->part));
+}
+
+EOLIAN static Eina_Bool
+_elm_layout_internal_part_efl_ui_cursor_cursor_theme_search_enabled_set(Eo *obj, Elm_Part_Data *pd, Eina_Bool allow)
+{
+ ELM_PART_RETURN_VAL(_elm_layout_part_cursor_engine_only_set(pd->sd, pd->part, !allow));
+}
+
+EOLIAN static Eina_Bool
+_elm_layout_internal_part_efl_ui_cursor_cursor_theme_search_enabled_get(Eo *obj, Elm_Part_Data *pd)
+{
+ ELM_PART_RETURN_VAL(!_elm_layout_part_cursor_engine_only_get(pd->sd, pd->part));
+}
+
ELM_PART_IMPLEMENT_DESTRUCTOR(elm_layout, ELM_LAYOUT, Elm_Layout_Smart_Data, Elm_Part_Data)
ELM_PART_IMPLEMENT_CONTENT_SET(elm_layout, ELM_LAYOUT, Elm_Layout_Smart_Data, Elm_Part_Data)
ELM_PART_IMPLEMENT_CONTENT_GET(elm_layout, ELM_LAYOUT, Elm_Layout_Smart_Data, Elm_Part_Data)
settings loaded \@ref elm_layout_file_set.]]
}
}
- part_cursor_engine_only_set {
- [[Sets if the cursor set should be searched on the theme or should
- use the provided by the engine, only.
-
- Note: Before you set if should look on theme you should define a
- cursor with @.part_cursor_set. By default it will only look for
- cursors provided by the engine.
- ]]
- return: bool; [[$true on success or $false on failure, that may be
- part not exists or it did not had a cursor set.]]
- params {
- @in part_name: string; [[A part from loaded edje group.]]
- @in engine_only: bool; [[If cursors should be just provided by
- the engine ($true) or should also search
- on widget's theme as well ($false)]]
- }
- }
- part_cursor_engine_only_get @const {
- [[Get a specific cursor engine_only for an edje part.]]
- return: bool; [[Whenever the cursor is just provided by engine
- or also from theme.]]
- params {
- @in part_name: string; [[A part from loaded edje group.]]
- }
- }
freeze {
[[Freezes the Elementary layout object.
@in height: bool; [[Restrict minimum size ot the current height.]]
}
}
- part_cursor_style_set {
- [[Sets a specific cursor style for an edje part.]]
- return: bool; [[$true on success or $false on failure, that may be
- part not exists or it did not had a cursor set.]]
- params {
- @in part_name: string; [[A part from loaded edje group.]]
- @in style: string; [[The theme style to use (default,
- transparent, ...).]]
- }
- }
- part_cursor_style_get @const {
- [[Get a specific cursor style for an edje part.]]
- return: string; [[The theme style in use, defaults to "default".
- If the object does not have a cursor set,
- then $null is returned.]]
- params {
- @in part_name: string; [[A part from loaded edje group.]]
- }
- }
signal_callback_add {
[[Add a callback for a (Edje) signal emitted by a layout widget's
underlying Edje object.
callback function.]]
}
}
- part_cursor_set {
- [[Sets a specific cursor for an edje part.]]
- return: bool; [[$true on success or $false on failure, that may be
- part not exists or it has "mouse_events: 0".]]
- params {
- @in part_name: string; [[A part from loaded edje group.]]
- @in cursor: string; [[Cursor name to use, see Elementary_Cursor.h.]]
- }
- }
- part_cursor_get @const {
- [[Get the cursor to be shown when mouse is over an edje part.]]
- return: string; [[Cursor name]]
- params {
- @in part_name: string; [[A part from loaded edje group.]]
- }
- }
sub_object_add_enable {
[[Enable sub object add]]
legacy: null;
@in source: string; [[The signal's source string.]]
}
}
- part_cursor_unset {
- [[Unsets a cursor previously set with @.part_cursor_set.]]
- return: bool; [[$true on success, $false otherwise]]
- params {
- @in part_name: string; [[A part from loaded edje group,
- that had a cursor set wit
- @.part_cursor_set.]]
- }
- }
}
implements {
class.constructor;
-class Elm.Layout.Internal.Part (Efl.Object, Efl.Container, Efl.Text)
+class Elm.Layout.Internal.Part (Efl.Object, Efl.Container, Efl.Text,
+ Efl.Ui.Cursor)
{
[[Elementary layout internal part class]]
data: Elm_Part_Data;
Efl.Container.content { get; set; }
Efl.Container.content_unset;
Efl.Text.text { set; get; }
+ Efl.Ui.Cursor.cursor { get; set; }
+ Efl.Ui.Cursor.cursor_style { get; set; }
+ Efl.Ui.Cursor.cursor_theme_search_enabled { get; set; }
}
}
*/
EAPI Eina_Bool elm_layout_edje_object_can_access_get(const Evas_Object *obj);
+/**
+ * @brief Sets if the cursor set should be searched on the theme or should use
+ * the provided by the engine, only.
+ *
+ * @note Before you set if should look on theme you should define a cursor with
+ * @ref elm_layout_part_cursor_set. By default it will only look for cursors
+ * provided by the engine.
+ *
+ * @param[in] part_name A part from loaded edje group.
+ * @param[in] engine_only If cursors should be just provided by the engine
+ * ($true) or should also search on widget's theme as well ($false)
+ *
+ * @return @c true on success or @c false on failure, that may be part not
+ * exists or it did not had a cursor set.
+ *
+ * @ingroup Elm_Layout
+ */
+EAPI Eina_Bool elm_layout_part_cursor_engine_only_set(Evas_Object *obj, const char *part_name, Eina_Bool engine_only);
+
+/**
+ * @brief Get a specific cursor engine_only for an edje part.
+ *
+ * @param[in] part_name A part from loaded edje group.
+ *
+ * @return Whenever the cursor is just provided by engine or also from theme.
+ *
+ * @ingroup Elm_Layout
+ */
+EAPI Eina_Bool elm_layout_part_cursor_engine_only_get(const Evas_Object *obj, const char *part_name);
+
+/**
+ * @brief Sets a specific cursor for an edje part.
+ *
+ * @param[in] part_name A part from loaded edje group.
+ * @param[in] cursor Cursor name to use, see Elementary_Cursor.h.
+ *
+ * @return @c true on success or @c false on failure, that may be part not
+ * exists or it has "mouse_events: 0".
+ *
+ * @ingroup Elm_Layout
+ */
+EAPI Eina_Bool elm_layout_part_cursor_set(Evas_Object *obj, const char *part_name, const char *cursor);
+
+/**
+ * @brief Get the cursor to be shown when mouse is over an edje part.
+ *
+ * @param[in] part_name A part from loaded edje group.
+ *
+ * @return Cursor name
+ *
+ * @ingroup Elm_Layout
+ */
+EAPI const char *elm_layout_part_cursor_get(const Evas_Object *obj, const char *part_name);
+
+/**
+ * @brief Sets a specific cursor style for an edje part.
+ *
+ * @param[in] part_name A part from loaded edje group.
+ * @param[in] style The theme style to use (default, transparent, ...).
+ *
+ * @return @c true on success or @c false on failure, that may be part not
+ * exists or it did not had a cursor set.
+ *
+ * @ingroup Elm_Layout
+ */
+EAPI Eina_Bool elm_layout_part_cursor_style_set(Evas_Object *obj, const char *part_name, const char *style);
+
+/**
+ * @brief Get a specific cursor style for an edje part.
+ *
+ * @param[in] part_name A part from loaded edje group.
+ *
+ * @return The theme style in use, defaults to "default". If the object does
+ * not have a cursor set, then @c null is returned.
+ *
+ * @ingroup Elm_Layout
+ */
+EAPI const char *elm_layout_part_cursor_style_get(const Evas_Object *obj, const char *part_name);
+
+/**
+ * @brief Unsets a cursor previously set with @ref elm_layout_part_cursor_set.
+ *
+ * @param[in] part_name A part from loaded edje group, that had a cursor set
+ * wit @ref elm_layout_part_cursor_set.
+ *
+ * @return @c true on success, @c false otherwise
+ *
+ * @ingroup Elm_Layout
+ */
+EAPI Eina_Bool elm_layout_part_cursor_unset(Evas_Object *obj, const char *part_name);
+
#include "elm_layout.eo.legacy.h"
#include "elm_layout_internal_part.eo.h"
//#define ELM_PART_HOOK do { ERR("%p:%s [%d]", pd->obj, pd->part, (int) pd->temp); } while(0)
-#define ELM_PART_HOOK
+#define ELM_PART_HOOK do {} while(0)
#define ELM_PART_REF(obj, pd) do { if (!(pd->temp++)) efl_ref(obj); } while(0)
#define ELM_PART_UNREF(obj, pd) do { if (pd->temp) { if (!(--pd->temp)) efl_del(obj); } } while(0)
_elm_cursor_del, cur);
}
-EOLIAN void
+EOLIAN Eina_Bool
_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_VAL(obj, EINA_FALSE);
elm_object_sub_cursor_set(obj, obj, cursor);
+ return EINA_TRUE;
}
EOLIAN const char *
free(cur);
}
-EOLIAN void
+EOLIAN Eina_Bool
_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, EINA_FALSE);
if (!eina_stringshare_replace(&cur->style, style))
ERR("Could not set current style=%s", style);
- if (cur->use_engine) return;
+ if (cur->use_engine) return EINA_FALSE;
if (!cur->obj)
{
if (!_elm_cursor_obj_add(cur->owner, cur))
- ERR("Could not create cursor object");
+ {
+ ERR("Could not create cursor object");
+ return EINA_FALSE;
+ }
else
_elm_cursor_set_hot_spots(cur);
}
{
if (!_elm_theme_object_set(obj, cur->obj, "cursor", cur->cursor_name,
style))
- ERR("Could not apply the theme to the cursor style=%s", style);
+ {
+ ERR("Could not apply the theme to the cursor style=%s", style);
+ return EINA_FALSE;
+ }
else
_elm_cursor_set_hot_spots(cur);
}
+
+ return EINA_TRUE;
}
EOLIAN const char *
_elm_cursor_set_hot_spots(cur);
}
-EOLIAN void
+EOLIAN Eina_Bool
_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, EINA_FALSE);
cur->theme_search = theme_search;
ELM_SAFE_FREE(cur->obj, evas_object_del);
_elm_cursor_cur_set(cur);
+ return EINA_TRUE;
}
EOLIAN Eina_Bool