From d44131a3aa220b6482b3eb62e207c8c05c10e02e Mon Sep 17 00:00:00 2001 From: Daniel Hirt Date: Tue, 19 Sep 2017 19:36:43 +0300 Subject: [PATCH] Edje: move selection-related part_text API to legacy --- src/lib/edje/Edje_Legacy.h | 65 ++++++++++++++++++++++++++++++++ src/lib/edje/edje_object.eo | 64 ------------------------------- src/lib/edje/edje_util.c | 54 ++++++++++++++++---------- src/lib/elementary/efl_ui_text.c | 7 ---- src/lib/elementary/elm_entry.c | 6 +-- 5 files changed, 102 insertions(+), 94 deletions(-) diff --git a/src/lib/edje/Edje_Legacy.h b/src/lib/edje/Edje_Legacy.h index 2e1efc8ed4..7086acb4bc 100644 --- a/src/lib/edje/Edje_Legacy.h +++ b/src/lib/edje/Edje_Legacy.h @@ -2548,6 +2548,71 @@ EAPI Eina_Bool edje_object_part_text_input_panel_show_on_demand_get(const Edje_O */ EAPI void edje_object_part_text_prediction_hint_set(Edje_Object *obj, const char *part, const char *prediction_hint); +/** + * @brief Starts selecting at current cursor position + * + * @param[in] part The part name + * + * @ingroup Edje_Object + */ +EAPI void edje_object_part_text_select_begin(const Edje_Object *obj, const char *part); + +/** + * @brief Aborts any selection action on a part. + * + * @param[in] part The part name + * + * @ingroup Edje_Object + */ +EAPI void edje_object_part_text_select_abort(const Edje_Object *obj, const char *part); + +/** + * @brief Extends the current selection to the current cursor position + * + * @param[in] part The part name + * + * @ingroup Edje_Object + */ +EAPI void edje_object_part_text_select_extend(const Edje_Object *obj, const char *part); + +/** + * @brief Sets the selection to be everything. + * + * This function selects all text of the object of the part. + * + * @param[in] part The part name + * + * @ingroup Edje_Object + */ +EAPI void edje_object_part_text_select_all(const Edje_Object *obj, const char *part); + +/** + * @brief Sets the selection to be none. + * + * This function sets the selection text to be none. + * + * @param[in] part The part name + * + * @ingroup Edje_Object + */ +EAPI void edje_object_part_text_select_none(const Edje_Object *obj, const char *part); + +/** + * @brief Returns the selection text of the object part. + * + * This function returns selection text of the object part. + * + * See also @ref edje_object_part_text_select_all() and + * @ref edje_object_part_text_select_none() + * + * @param[in] part The part name + * + * @return The text string + * + * @ingroup Edje_Object + */ +EAPI const char *edje_object_part_text_selection_get(const Edje_Object *obj, const char *part); + /** * @brief Whether this object is playing or not. * diff --git a/src/lib/edje/edje_object.eo b/src/lib/edje/edje_object.eo index 2463b8408e..9c4a84bf56 100644 --- a/src/lib/edje/edje_object.eo +++ b/src/lib/edje/edje_object.eo @@ -365,70 +365,6 @@ class Edje.Object (Efl.Canvas.Group, Efl.File, Efl.Container, Efl.Part, data: void_ptr; [[The data pointer to pass to the func callback]] } } - @property part_text_select_allow { - set { - [[Enables selection if the entry is an EXPLICIT selection mode - type. - - The default is to not allow selection. This function only affects user - selection, functions such as edje_object_part_text_select_all() and - edje_object_part_text_select_none() are not affected.]] - legacy: null; - } - keys { - part: string; [[The part name]] - } - values { - allow: bool; [[$true to enable, $false otherwise]] - } - } - part_text_select_begin @const { - [[Starts selecting at current cursor position]] - params { - @in part: string; [[The part name]] - } - } - part_text_select_abort @const { - [[Aborts any selection action on a part.]] - params { - @in part: string; [[The part name]] - } - } - part_text_select_extend @const { - [[Extends the current selection to the current cursor position]] - params { - @in part: string; [[The part name]] - } - } - part_text_select_all @const { - [[Sets the selection to be everything. - - This function selects all text of the object of the part.]] - params { - @in part: string; [[The part name]] - } - } - part_text_select_none @const { - [[Sets the selection to be none. - - This function sets the selection text to be none.]] - params { - @in part: string; [[The part name]] - } - } - @property part_text_selection { - get { - [[Returns the selection text of the object part. - - This function returns selection text of the object part. - - See also @.part_text_select_all() and @.part_text_select_none()]] - return: string; [[The text string]] - } - keys { - part: string; [[The part name]] - } - } /* TEXT PART APIS END ------------------------------------------------ */ @property seat { diff --git a/src/lib/edje/edje_util.c b/src/lib/edje/edje_util.c index 67c18c6535..e76eb582b2 100644 --- a/src/lib/edje/edje_util.c +++ b/src/lib/edje/edje_util.c @@ -1978,10 +1978,13 @@ _edje_efl_text_get(Eo *obj EINA_UNUSED, Edje *ed, const char *part) return NULL; } -EOLIAN const char * -_edje_object_part_text_selection_get(Eo *obj EINA_UNUSED, Edje *ed, const char *part) +EAPI const char * +edje_object_part_text_selection_get(const Eo *obj, const char *part) { Edje_Real_Part *rp; + Edje *ed; + + ed = _edje_fetch(obj); if ((!ed) || (!part)) return NULL; rp = _edje_real_part_recursive_get(&ed, part); @@ -1992,10 +1995,13 @@ _edje_object_part_text_selection_get(Eo *obj EINA_UNUSED, Edje *ed, const char * return NULL; } -EOLIAN void -_edje_object_part_text_select_none(Eo *obj EINA_UNUSED, Edje *ed, const char *part) +EAPI void +edje_object_part_text_select_none(const Eo *obj, const char *part) { Edje_Real_Part *rp; + Edje *ed; + + ed = _edje_fetch(obj); if ((!ed) || (!part)) return; rp = _edje_real_part_recursive_get(&ed, part); @@ -2004,10 +2010,13 @@ _edje_object_part_text_select_none(Eo *obj EINA_UNUSED, Edje *ed, const char *pa _edje_entry_select_none(rp); } -EOLIAN void -_edje_object_part_text_select_all(Eo *obj EINA_UNUSED, Edje *ed, const char *part) +EAPI void +edje_object_part_text_select_all(const Eo *obj, const char *part) { Edje_Real_Part *rp; + Edje *ed; + + ed = _edje_fetch(obj); if ((!ed) || (!part)) return; rp = _edje_real_part_recursive_get(&ed, part); @@ -2037,16 +2046,12 @@ _edje_object_part_text_cursor_geometry_get(Eo *obj EINA_UNUSED, Edje *ed, const } EAPI void -edje_object_part_text_select_allow_set(const Evas_Object *obj, const char *part, Eina_Bool allow) -{ - edje_obj_part_text_select_allow_set((Eo *)obj, part, allow); -} - - -EOLIAN void -_edje_object_part_text_select_allow_set(Eo *obj EINA_UNUSED, Edje *ed, const char *part, Eina_Bool allow) +edje_object_part_text_select_allow_set(const Eo *obj, const char *part, Eina_Bool allow) { Edje_Real_Part *rp; + Edje *ed; + + ed = _edje_fetch(obj); if ((!ed) || (!part)) return; rp = _edje_real_part_recursive_get(&ed, part); @@ -2055,10 +2060,13 @@ _edje_object_part_text_select_allow_set(Eo *obj EINA_UNUSED, Edje *ed, const cha _edje_entry_select_allow_set(rp, allow); } -EOLIAN void -_edje_object_part_text_select_abort(Eo *obj EINA_UNUSED, Edje *ed, const char *part) +EAPI void +edje_object_part_text_select_abort(const Eo *obj, const char *part) { Edje_Real_Part *rp; + Edje *ed; + + ed = _edje_fetch(obj); if ((!ed) || (!part)) return; rp = _edje_real_part_recursive_get(&ed, part); @@ -2067,10 +2075,13 @@ _edje_object_part_text_select_abort(Eo *obj EINA_UNUSED, Edje *ed, const char *p _edje_entry_select_abort(rp); } -EOLIAN void -_edje_object_part_text_select_begin(Eo *obj EINA_UNUSED, Edje *ed, const char *part) +EAPI void +edje_object_part_text_select_begin(const Eo *obj, const char *part) { Edje_Real_Part *rp; + Edje *ed; + + ed = _edje_fetch(obj); if ((!ed) || (!part)) return; rp = _edje_real_part_recursive_get(&ed, part); @@ -2079,10 +2090,13 @@ _edje_object_part_text_select_begin(Eo *obj EINA_UNUSED, Edje *ed, const char *p _edje_entry_select_begin(rp); } -EOLIAN void -_edje_object_part_text_select_extend(Eo *obj EINA_UNUSED, Edje *ed, const char *part) +EAPI void +edje_object_part_text_select_extend(const Eo *obj, const char *part) { Edje_Real_Part *rp; + Edje *ed; + + ed = _edje_fetch(obj); if ((!ed) || (!part)) return; rp = _edje_real_part_recursive_get(&ed, part); diff --git a/src/lib/elementary/efl_ui_text.c b/src/lib/elementary/efl_ui_text.c index c908bedd77..1875e722a6 100644 --- a/src/lib/elementary/efl_ui_text.c +++ b/src/lib/elementary/efl_ui_text.c @@ -930,13 +930,6 @@ _efl_ui_text_elm_widget_theme_apply(Eo *obj, Efl_Ui_Text_Data *sd) elm_widget_theme_object_set (obj, sd->entry_edje, "efl_ui_text", _efl_ui_text_theme_group_get(obj), style); - if (sd->sel_allow && _elm_config->desktop_entry) - edje_obj_part_text_select_allow_set - (sd->entry_edje, "elm.text", EINA_TRUE); - else - edje_obj_part_text_select_allow_set - (sd->entry_edje, "elm.text", EINA_FALSE); - if (elm_widget_disabled_get(obj)) edje_object_signal_emit(sd->entry_edje, "elm,state,disabled", "elm"); diff --git a/src/lib/elementary/elm_entry.c b/src/lib/elementary/elm_entry.c index 822cd68ea0..a1a6896c3b 100644 --- a/src/lib/elementary/elm_entry.c +++ b/src/lib/elementary/elm_entry.c @@ -886,10 +886,10 @@ _elm_entry_elm_widget_theme_apply(Eo *obj, Elm_Entry_Data *sd) (obj, sd->entry_edje, "entry", _elm_entry_theme_group_get(obj), style); if (sd->sel_allow && _elm_config->desktop_entry) - edje_obj_part_text_select_allow_set + edje_object_part_text_select_allow_set (sd->entry_edje, "elm.text", EINA_TRUE); else - edje_obj_part_text_select_allow_set + edje_object_part_text_select_allow_set (sd->entry_edje, "elm.text", EINA_FALSE); edje_object_part_text_style_user_push(sd->entry_edje, "elm.text", stl_user); @@ -5449,7 +5449,7 @@ _elm_entry_select_allow_set(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, Eina_Bool a if (sd->sel_allow == allow) return; sd->sel_allow = allow; - edje_obj_part_text_select_allow_set(sd->entry_edje, "elm.text", allow); + edje_object_part_text_select_allow_set(sd->entry_edje, "elm.text", allow); } EOLIAN static Eina_Bool