From 6bfbeff47e934892d2789214ee19634ce0206e29 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Thu, 15 Jun 2017 11:12:00 +0900 Subject: [PATCH] widget: Move mirrored_automatic to Efl.Ui.Base This is, unlike what some of the documentation says, a public API on elm_object. Let's place it along mirrored for consistency, even if edje object will not implement it. Ref T5363 --- src/lib/efl/interfaces/efl_ui_base.eo | 20 ++++++++++++++------ src/lib/elementary/elc_combobox.c | 8 ++++---- src/lib/elementary/elc_fileselector.c | 18 +++++++++--------- src/lib/elementary/elc_fileselector_button.c | 4 ++-- src/lib/elementary/elc_fileselector_entry.c | 4 ++-- src/lib/elementary/elc_player.c | 2 +- src/lib/elementary/elc_popup.c | 10 +++++----- src/lib/elementary/elm_main.c | 4 ++-- src/lib/elementary/elm_scroller.c | 2 +- src/lib/elementary/elm_widget.c | 8 ++++---- src/lib/elementary/elm_widget.eo | 7 +------ src/lib/elementary/elm_widget.h | 6 +----- 12 files changed, 46 insertions(+), 47 deletions(-) diff --git a/src/lib/efl/interfaces/efl_ui_base.eo b/src/lib/efl/interfaces/efl_ui_base.eo index b4bd11d2c0..7ddcbf0336 100644 --- a/src/lib/efl/interfaces/efl_ui_base.eo +++ b/src/lib/efl/interfaces/efl_ui_base.eo @@ -10,16 +10,24 @@ interface Efl.Ui.Base If mirrored, an object is in RTL (right to left) mode instead of LTR (left to right). ]] - set { - [[Sets the RTL orientation for this object.]] - } - get { - [[Gets the RTL orientation for this object.]] - } values { rtl: bool(false); [[$true for RTL, $false for LTR (default).]] } } + @property mirrored_automatic { + [[Whether the property @.mirrored should be set automatically. + + If enabled, the system or application configuration will be used + to set the value of @.mirrored. + + This property may be implemented by high-level widgets (in $Efl.Ui) + but not by low-level widgets (in $Efl.Canvas) as the configuration + should affect only high-level widgets. + ]] + values { + automatic: bool(true); [[Whether the widget uses automatic mirroring]] + } + } @property language { [[The (human) language for this object.]] set { diff --git a/src/lib/elementary/elc_combobox.c b/src/lib/elementary/elc_combobox.c index 606e735ff0..df06061058 100644 --- a/src/lib/elementary/elc_combobox.c +++ b/src/lib/elementary/elc_combobox.c @@ -290,7 +290,7 @@ _elm_combobox_efl_canvas_group_group_add(Eo *obj, Elm_Combobox_Data *sd EINA_UNU efl_canvas_group_add(efl_super(obj, MY_CLASS)); elm_widget_sub_object_parent_add(obj); - elm_widget_mirrored_automatic_set(obj, EINA_FALSE); + efl_ui_mirrored_automatic_set(obj, EINA_FALSE); efl_event_callback_add(obj, EFL_UI_EVENT_CLICKED, _on_clicked, obj); @@ -358,7 +358,7 @@ _elm_combobox_efl_object_constructor(Eo *obj, Elm_Combobox_Data *sd) //hover sd->hover = efl_add(ELM_HOVER_CLASS, sd->hover_parent); evas_object_layer_set(sd->hover, EVAS_LAYER_MAX); - elm_widget_mirrored_automatic_set(sd->hover, EINA_FALSE); + efl_ui_mirrored_automatic_set(sd->hover, EINA_FALSE); elm_hover_target_set(sd->hover, obj); elm_widget_sub_object_add(obj, sd->hover); snprintf(buf, sizeof(buf), "combobox_vertical/%s", @@ -385,7 +385,7 @@ _elm_combobox_efl_object_constructor(Eo *obj, Elm_Combobox_Data *sd) // This is the genlist object that will take over the genlist call sd->genlist = gl = efl_add(ELM_GENLIST_CLASS, obj); elm_genlist_filter_set(gl, NULL); - elm_widget_mirrored_automatic_set(gl, EINA_FALSE); + efl_ui_mirrored_automatic_set(gl, EINA_FALSE); efl_ui_mirrored_set(gl, efl_ui_mirrored_get(obj)); evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL); @@ -399,7 +399,7 @@ _elm_combobox_efl_object_constructor(Eo *obj, Elm_Combobox_Data *sd) // This is the entry object that will take over the entry call sd->entry = entry = efl_add(ELM_ENTRY_CLASS, obj); - elm_widget_mirrored_automatic_set(entry, EINA_FALSE); + efl_ui_mirrored_automatic_set(entry, EINA_FALSE); efl_ui_mirrored_set(entry, efl_ui_mirrored_get(obj)); elm_scroller_policy_set(entry, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF); diff --git a/src/lib/elementary/elc_fileselector.c b/src/lib/elementary/elc_fileselector.c index 795a2f9abf..ffdc8444d2 100644 --- a/src/lib/elementary/elc_fileselector.c +++ b/src/lib/elementary/elc_fileselector.c @@ -1592,7 +1592,7 @@ _files_list_add(Evas_Object *obj) li = elm_genlist_add(obj); evas_object_data_set(li, "parent", obj); - elm_widget_mirrored_automatic_set(li, EINA_FALSE); + efl_ui_mirrored_automatic_set(li, EINA_FALSE); efl_event_callback_add (li, EFL_UI_EVENT_SELECTED, _on_item_selected, obj); @@ -1623,7 +1623,7 @@ _files_grid_add(Evas_Object *obj) grid = elm_gengrid_add(obj); evas_object_data_set(grid, "parent", obj); - elm_widget_mirrored_automatic_set(grid, EINA_FALSE); + efl_ui_mirrored_automatic_set(grid, EINA_FALSE); evas_object_size_hint_align_set(grid, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); @@ -1890,7 +1890,7 @@ _elm_fileselector_efl_canvas_group_group_add(Eo *obj, Elm_Fileselector_Data *pri ic = elm_icon_add(obj); elm_icon_standard_set(ic, "go-up"); bt = elm_button_add(obj); - elm_widget_mirrored_automatic_set(bt, EINA_FALSE); + efl_ui_mirrored_automatic_set(bt, EINA_FALSE); elm_object_part_content_set(bt, "icon", ic); elm_object_domain_translatable_text_set(bt, PACKAGE, N_("Up")); efl_event_callback_add @@ -1904,7 +1904,7 @@ _elm_fileselector_efl_canvas_group_group_add(Eo *obj, Elm_Fileselector_Data *pri ic = elm_icon_add(obj); elm_icon_standard_set(ic, "go-home"); bt = elm_button_add(obj); - elm_widget_mirrored_automatic_set(bt, EINA_FALSE); + efl_ui_mirrored_automatic_set(bt, EINA_FALSE); elm_object_part_content_set(bt, "icon", ic); elm_object_domain_translatable_text_set(bt, PACKAGE, N_("Home")); efl_event_callback_add @@ -1920,7 +1920,7 @@ _elm_fileselector_efl_canvas_group_group_add(Eo *obj, Elm_Fileselector_Data *pri evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); en = elm_entry_add(obj); elm_entry_scrollable_set(en, EINA_TRUE); - elm_widget_mirrored_automatic_set(en, EINA_FALSE); + efl_ui_mirrored_automatic_set(en, EINA_FALSE); elm_entry_editable_set(en, EINA_TRUE); elm_entry_single_line_set(en, EINA_TRUE); elm_entry_line_wrap_set(en, ELM_WRAP_CHAR); @@ -1952,7 +1952,7 @@ _elm_fileselector_efl_canvas_group_group_add(Eo *obj, Elm_Fileselector_Data *pri // path entry en = elm_entry_add(obj); elm_entry_scrollable_set(en, EINA_TRUE); - elm_widget_mirrored_automatic_set(en, EINA_FALSE); + efl_ui_mirrored_automatic_set(en, EINA_FALSE); elm_entry_single_line_set(en, EINA_TRUE); elm_entry_line_wrap_set(en, ELM_WRAP_CHAR); @@ -1972,7 +1972,7 @@ _elm_fileselector_efl_canvas_group_group_add(Eo *obj, Elm_Fileselector_Data *pri // name entry en = elm_entry_add(obj); elm_entry_scrollable_set(en, EINA_TRUE); - elm_widget_mirrored_automatic_set(en, EINA_FALSE); + efl_ui_mirrored_automatic_set(en, EINA_FALSE); elm_entry_editable_set(en, EINA_TRUE); elm_entry_single_line_set(en, EINA_TRUE); elm_entry_line_wrap_set(en, ELM_WRAP_CHAR); @@ -2215,7 +2215,7 @@ _elm_fileselector_buttons_ok_cancel_set(Eo *obj, Elm_Fileselector_Data *sd, Eina { // cancel btn bt = elm_button_add(obj); - elm_widget_mirrored_automatic_set(bt, EINA_FALSE); + efl_ui_mirrored_automatic_set(bt, EINA_FALSE); elm_object_domain_translatable_text_set(bt, PACKAGE, N_("Cancel")); efl_event_callback_add(bt, EFL_UI_EVENT_CLICKED, _canc, obj); @@ -2225,7 +2225,7 @@ _elm_fileselector_buttons_ok_cancel_set(Eo *obj, Elm_Fileselector_Data *sd, Eina // ok btn bt = elm_button_add(obj); - elm_widget_mirrored_automatic_set(bt, EINA_FALSE); + efl_ui_mirrored_automatic_set(bt, EINA_FALSE); elm_object_domain_translatable_text_set(bt, PACKAGE, N_("OK")); efl_event_callback_add(bt, EFL_UI_EVENT_CLICKED, _ok, obj); diff --git a/src/lib/elementary/elc_fileselector_button.c b/src/lib/elementary/elc_fileselector_button.c index 48fc60a408..dc224a277e 100644 --- a/src/lib/elementary/elc_fileselector_button.c +++ b/src/lib/elementary/elc_fileselector_button.c @@ -177,7 +177,7 @@ _activate(Elm_Fileselector_Button_Data *sd) sd->fs = elm_fileselector_add(sd->fsw); efl_ui_mirrored_set (sd->fs, efl_ui_mirrored_get(sd->obj)); - elm_widget_mirrored_automatic_set(sd->fs, EINA_FALSE); + efl_ui_mirrored_automatic_set(sd->fs, EINA_FALSE); elm_fileselector_expandable_set(sd->fs, sd->fsd.expandable); elm_fileselector_folder_only_set(sd->fs, sd->fsd.folder_only); elm_fileselector_is_save_set(sd->fs, sd->fsd.is_save); @@ -227,7 +227,7 @@ _elm_fileselector_button_efl_canvas_group_group_add(Eo *obj, Elm_Fileselector_Bu priv->w = 400; priv->h = 400; - elm_widget_mirrored_automatic_set(obj, EINA_FALSE); + efl_ui_mirrored_automatic_set(obj, EINA_FALSE); efl_event_callback_add(obj, EFL_UI_EVENT_CLICKED, _button_clicked, priv); diff --git a/src/lib/elementary/elc_fileselector_entry.c b/src/lib/elementary/elc_fileselector_entry.c index 18f1ac70d6..25183fe05f 100644 --- a/src/lib/elementary/elc_fileselector_entry.c +++ b/src/lib/elementary/elc_fileselector_entry.c @@ -322,7 +322,7 @@ _elm_fileselector_entry_efl_canvas_group_group_add(Eo *obj, Elm_Fileselector_Ent elm_widget_sub_object_parent_add(obj); priv->button = elm_fileselector_button_add(obj); - elm_widget_mirrored_automatic_set(priv->button, EINA_FALSE); + efl_ui_mirrored_automatic_set(priv->button, EINA_FALSE); efl_ui_mirrored_set(priv->button, efl_ui_mirrored_get(obj)); elm_widget_style_set(priv->button, "fileselector_entry/default"); @@ -338,7 +338,7 @@ _elm_fileselector_entry_efl_canvas_group_group_add(Eo *obj, Elm_Fileselector_Ent priv->entry = elm_entry_add(obj); elm_entry_scrollable_set(priv->entry, EINA_TRUE); - elm_widget_mirrored_automatic_set(priv->entry, EINA_FALSE); + efl_ui_mirrored_automatic_set(priv->entry, EINA_FALSE); elm_widget_style_set(priv->entry, "fileselector_entry/default"); elm_entry_single_line_set(priv->entry, EINA_TRUE); elm_entry_editable_set(priv->entry, EINA_TRUE); diff --git a/src/lib/elementary/elc_player.c b/src/lib/elementary/elc_player.c index bde0f04657..c2204462ed 100644 --- a/src/lib/elementary/elc_player.c +++ b/src/lib/elementary/elc_player.c @@ -482,7 +482,7 @@ _player_button_add(Evas_Object *obj, bt = elm_button_add(obj); if (ic) evas_object_data_set(bt, "icon", ic); - elm_widget_mirrored_automatic_set(bt, EINA_FALSE); + efl_ui_mirrored_automatic_set(bt, EINA_FALSE); elm_object_content_set(bt, ic); evas_object_show(ic); diff --git a/src/lib/elementary/elc_popup.c b/src/lib/elementary/elc_popup.c index 0691eaba08..a14773c93e 100644 --- a/src/lib/elementary/elc_popup.c +++ b/src/lib/elementary/elc_popup.c @@ -699,7 +699,7 @@ _create_scroller(Evas_Object *obj) elm_scroller_bounce_set(sd->scr, EINA_FALSE, EINA_TRUE); evas_object_event_callback_add(sd->scr, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _size_hints_changed_cb, obj); - elm_widget_mirrored_automatic_set(sd->scr, EINA_FALSE); + efl_ui_mirrored_automatic_set(sd->scr, EINA_FALSE); elm_object_mirrored_set(sd->scr, elm_object_mirrored_get(obj)); elm_table_pack(sd->tbl, sd->scr, 0, 0, 1, 1); evas_object_show(sd->scr); @@ -928,7 +928,7 @@ _item_new(Elm_Popup_Item_Data *it) VIEW(it) = elm_layout_add(WIDGET(it)); elm_object_focus_allow_set(VIEW(it), EINA_TRUE); - elm_widget_mirrored_automatic_set(VIEW(it), EINA_FALSE); + efl_ui_mirrored_automatic_set(VIEW(it), EINA_FALSE); elm_object_mirrored_set(VIEW(it), elm_object_mirrored_get(WIDGET(it))); snprintf(style, sizeof(style), "popup/%s", elm_widget_style_get(WIDGET(it))); @@ -1210,7 +1210,7 @@ _action_button_set(Evas_Object *obj, evas_object_event_callback_add (sd->action_area, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _size_hints_changed_cb, sd->main_layout); - elm_widget_mirrored_automatic_set(sd->action_area, EINA_FALSE); + efl_ui_mirrored_automatic_set(sd->action_area, EINA_FALSE); elm_object_mirrored_set(sd->action_area, elm_object_mirrored_get(obj)); efl_content_set(efl_part(sd->main_layout, "elm.swallow.action_area"), sd->action_area); @@ -1530,7 +1530,7 @@ _elm_popup_efl_canvas_group_group_add(Eo *obj, Elm_Popup_Data *priv) evas_object_size_hint_align_set (priv->notify, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_smart_member_add(priv->notify, obj); - elm_widget_mirrored_automatic_set(priv->notify, EINA_FALSE); + efl_ui_mirrored_automatic_set(priv->notify, EINA_FALSE); elm_object_mirrored_set(priv->notify, elm_object_mirrored_get(obj)); evas_object_event_callback_add(priv->notify, EVAS_CALLBACK_RESIZE, _notify_resize_cb, obj); @@ -1543,7 +1543,7 @@ _elm_popup_efl_canvas_group_group_add(Eo *obj, Elm_Popup_Data *priv) elm_object_content_set(priv->notify, priv->main_layout); evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW, _on_show, NULL); - elm_widget_mirrored_automatic_set(priv->main_layout, EINA_FALSE); + efl_ui_mirrored_automatic_set(priv->main_layout, EINA_FALSE); elm_object_mirrored_set(priv->main_layout, elm_object_mirrored_get(obj)); elm_layout_signal_callback_add diff --git a/src/lib/elementary/elm_main.c b/src/lib/elementary/elm_main.c index 774b04e568..743a9820fd 100644 --- a/src/lib/elementary/elm_main.c +++ b/src/lib/elementary/elm_main.c @@ -1415,14 +1415,14 @@ EAPI Eina_Bool elm_object_mirrored_automatic_get(const Evas_Object *obj) { EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE); - return elm_widget_mirrored_automatic_get(obj); + return efl_ui_mirrored_automatic_get(obj); } EAPI void elm_object_mirrored_automatic_set(Evas_Object *obj, Eina_Bool automatic) { EINA_SAFETY_ON_NULL_RETURN(obj); - elm_widget_mirrored_automatic_set(obj, automatic); + efl_ui_mirrored_automatic_set(obj, automatic); } /** diff --git a/src/lib/elementary/elm_scroller.c b/src/lib/elementary/elm_scroller.c index 12739a3839..22a7b855b9 100644 --- a/src/lib/elementary/elm_scroller.c +++ b/src/lib/elementary/elm_scroller.c @@ -756,7 +756,7 @@ _loop_content_set(Evas_Object *obj, Elm_Scroller_Data *sd, Evas_Object *content) elm_widget_sub_object_add(obj, sd->contents); elm_widget_on_show_region_hook_set(sd->contents, _show_region_hook, obj); - elm_widget_mirrored_automatic_set(sd->contents, EINA_FALSE); + efl_ui_mirrored_automatic_set(sd->contents, EINA_FALSE); efl_ui_mirrored_set(sd->contents, EINA_FALSE); } elm_object_part_content_set(sd->contents, "elm.swallow.content", content); diff --git a/src/lib/elementary/elm_widget.c b/src/lib/elementary/elm_widget.c index b3b88d23c7..b83bf2772b 100644 --- a/src/lib/elementary/elm_widget.c +++ b/src/lib/elementary/elm_widget.c @@ -426,7 +426,7 @@ _elm_widget_mirrored_reload(Evas_Object *obj) API_ENTRY return; Eina_Bool mirrored = elm_config_mirrored_get(); - if (elm_widget_mirrored_automatic_get(obj) && (sd->is_mirrored != mirrored)) + if (efl_ui_mirrored_automatic_get(obj) && (sd->is_mirrored != mirrored)) { sd->is_mirrored = mirrored; } @@ -1280,7 +1280,7 @@ _elm_widget_efl_ui_base_mirrored_set(Eo *obj, Elm_Widget_Smart_Data *sd, Eina_Bo * **/ EOLIAN static Eina_Bool -_elm_widget_mirrored_automatic_get(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd) +_elm_widget_efl_ui_base_mirrored_automatic_get(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd) { return sd->mirrored_auto_mode; } @@ -1295,7 +1295,7 @@ _elm_widget_mirrored_automatic_get(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *s * @param automatic EINA_TRUE for auto mirrored mode. EINA_FALSE for manual. */ EOLIAN static void -_elm_widget_mirrored_automatic_set(Eo *obj, Elm_Widget_Smart_Data *sd, Eina_Bool automatic) +_elm_widget_efl_ui_base_mirrored_automatic_set(Eo *obj, Elm_Widget_Smart_Data *sd, Eina_Bool automatic) { if (sd->mirrored_auto_mode != automatic) { @@ -4164,7 +4164,7 @@ _elm_widget_efl_object_dbg_info_get(Eo *eo_obj, Elm_Widget_Smart_Data *_pd EINA_ EFL_DBG_INFO_APPEND(group, "Tree Unfocusable", EINA_VALUE_TYPE_CHAR, elm_widget_tree_unfocusable_get(eo_obj)); EFL_DBG_INFO_APPEND(group, "Automatic mirroring", EINA_VALUE_TYPE_CHAR, - elm_widget_mirrored_automatic_get(eo_obj)); + efl_ui_mirrored_automatic_get(eo_obj)); rel = efl_ui_focus_manager_fetch(_pd->focus.manager, eo_obj); if (rel) diff --git a/src/lib/elementary/elm_widget.eo b/src/lib/elementary/elm_widget.eo index c1348c35bc..81aabea33f 100644 --- a/src/lib/elementary/elm_widget.eo +++ b/src/lib/elementary/elm_widget.eo @@ -92,12 +92,6 @@ abstract Elm.Widget (Efl.Canvas.Group, Elm.Interface.Atspi_Accessible, ignore: bool; [[$true if highlights are ignored, $false otherwise]] } } - @property mirrored_automatic { - [[Control the widget's mirrored mode setting.]] - values { - automatic: bool; [[$true if the widget uses automatic mirrored mode, $false otherwise]] - } - } @property orientation_mode_disabled { [[Orientation mode disabled or enabled]] values { @@ -815,6 +809,7 @@ abstract Elm.Widget (Efl.Canvas.Group, Elm.Interface.Atspi_Accessible, Efl.Ui.Focus.Object.focus { set; } Efl.Ui.Base.scale { get; set; } Efl.Ui.Base.mirrored { get; set; } + Efl.Ui.Base.mirrored_automatic { get; set; } } events { moved; [[Called when widget moved]] diff --git a/src/lib/elementary/elm_widget.h b/src/lib/elementary/elm_widget.h index 953718508d..7f9fd11f72 100644 --- a/src/lib/elementary/elm_widget.h +++ b/src/lib/elementary/elm_widget.h @@ -459,9 +459,7 @@ typedef struct _Elm_Widget_Smart_Data Eina_Bool access_highlight_in_theme : 1; Eina_Bool disabled : 1; Eina_Bool is_mirrored : 1; - Eina_Bool mirrored_auto_mode : 1; /* This is - * TRUE by - * default */ + Eina_Bool mirrored_auto_mode : 1; /* This is TRUE by default */ Eina_Bool still_in : 1; Eina_Bool highlighted : 1; Eina_Bool highlight_root : 1; @@ -732,8 +730,6 @@ EAPI int elm_widget_scroll_hold_get(const Evas_Object *obj); EAPI void elm_widget_scroll_freeze_push(Evas_Object *obj); EAPI void elm_widget_scroll_freeze_pop(Evas_Object *obj); EAPI int elm_widget_scroll_freeze_get(const Evas_Object *obj); -EAPI Eina_Bool elm_widget_mirrored_automatic_get(const Evas_Object *obj); -EAPI void elm_widget_mirrored_automatic_set(Evas_Object *obj, Eina_Bool automatic); EAPI void elm_widget_theme_set(Evas_Object *obj, Elm_Theme *th); EAPI Elm_Theme *elm_widget_theme_get(const Evas_Object *obj); EAPI Elm_Theme_Apply elm_widget_style_set(Evas_Object *obj, const char *style);