summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-08-10 14:55:30 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-08-10 14:58:25 +0900
commitf1a6497459678baac6a30420a27e6235a179e39a (patch)
treea2344353d3f51292a49983f75a22af91aab79969
parent8546ff727f9ee60ac0a662611d606e0d608e8c3d (diff)
ctxpopup: Remove use of Orientation API (EO)
ctxpopup belongs to legacy, some work is ongoing to provide a cleaner EO based API for popups, etc... See T5326 Revert "ctxpopup: implement Efl.Orientation interface functions" This reverts commit 736fb9d4980a7dee83ca0721d8b9b58c6c12a39d. Ref T5870
-rw-r--r--src/lib/elementary/elc_ctxpopup.c48
-rw-r--r--src/lib/elementary/elc_ctxpopup_legacy.h21
-rw-r--r--src/lib/elementary/elm_ctxpopup.eo17
-rw-r--r--src/lib/elementary/elm_widget_ctxpopup.h2
4 files changed, 32 insertions, 56 deletions
diff --git a/src/lib/elementary/elc_ctxpopup.c b/src/lib/elementary/elc_ctxpopup.c
index f2010b515f..234a9be46d 100644
--- a/src/lib/elementary/elc_ctxpopup.c
+++ b/src/lib/elementary/elc_ctxpopup.c
@@ -310,7 +310,7 @@ _base_geometry_calc(Evas_Object *obj,
310 { 310 {
311 Evas_Coord length[2]; 311 Evas_Coord length[2];
312 312
313 if (sd->orient == EFL_ORIENT_VERTICAL) 313 if (!sd->horizontal)
314 { 314 {
315 length[0] = pos.y - hover_area.y; 315 length[0] = pos.y - hover_area.y;
316 length[1] = (hover_area.y + hover_area.h) - pos.y; 316 length[1] = (hover_area.y + hover_area.h) - pos.y;
@@ -1157,8 +1157,6 @@ _elm_ctxpopup_efl_canvas_group_group_add(Eo *obj, Elm_Ctxpopup_Data *priv)
1157 priv->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN; 1157 priv->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
1158 priv->auto_hide = EINA_TRUE; 1158 priv->auto_hide = EINA_TRUE;
1159 1159
1160 priv->orient = EFL_ORIENT_VERTICAL;
1161
1162 priv->box = elm_box_add(obj); 1160 priv->box = elm_box_add(obj);
1163 evas_object_size_hint_weight_set 1161 evas_object_size_hint_weight_set
1164 (priv->box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 1162 (priv->box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
@@ -1268,18 +1266,24 @@ _elm_ctxpopup_clear(Eo *obj EINA_UNUSED, Elm_Ctxpopup_Data *sd)
1268 sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN; 1266 sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
1269} 1267}
1270 1268
1271EAPI void 1269EOLIAN static void
1272elm_ctxpopup_horizontal_set(Evas_Object *obj, Eina_Bool horizontal) 1270_elm_ctxpopup_horizontal_set(Eo *obj, Elm_Ctxpopup_Data *sd, Eina_Bool horizontal)
1273{ 1271{
1274 efl_orientation_set(obj, horizontal ? EFL_ORIENT_HORIZONTAL : EFL_ORIENT_VERTICAL); 1272 sd->horizontal = !!horizontal;
1273
1274 if (!sd->list) return;
1275
1276 elm_list_horizontal_set(sd->list, sd->horizontal);
1277
1278 sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
1279
1280 if (sd->visible) elm_layout_sizing_eval(obj);
1275} 1281}
1276 1282
1277EAPI Eina_Bool 1283EOLIAN static Eina_Bool
1278elm_ctxpopup_horizontal_get(const Evas_Object *obj) 1284_elm_ctxpopup_horizontal_get(Eo *obj EINA_UNUSED, Elm_Ctxpopup_Data *sd)
1279{ 1285{
1280 ELM_CTXPOPUP_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE); 1286 return sd->horizontal;
1281
1282 return sd->orient == EFL_ORIENT_HORIZONTAL ? EINA_TRUE : EINA_FALSE;
1283} 1287}
1284 1288
1285EAPI const Eina_List * 1289EAPI const Eina_List *
@@ -1605,8 +1609,7 @@ _elm_ctxpopup_item_init(Eo *eo_item,
1605 elm_object_style_set(sd->list, "ctxpopup"); 1609 elm_object_style_set(sd->list, "ctxpopup");
1606 else elm_object_style_set(sd->list, elm_object_style_get(obj)); 1610 else elm_object_style_set(sd->list, elm_object_style_get(obj));
1607 elm_list_mode_set(sd->list, ELM_LIST_EXPAND); 1611 elm_list_mode_set(sd->list, ELM_LIST_EXPAND);
1608 //TODO: use orient interface API on list when implemented 1612 elm_list_horizontal_set(sd->list, sd->horizontal);
1609 elm_list_horizontal_set(sd->list, sd->orient == EFL_ORIENT_VERTICAL ? EINA_FALSE : EINA_TRUE);
1610 evas_object_event_callback_add 1613 evas_object_event_callback_add
1611 (sd->list, EVAS_CALLBACK_RESIZE, _list_resize_cb, obj); 1614 (sd->list, EVAS_CALLBACK_RESIZE, _list_resize_cb, obj);
1612 elm_layout_content_set(obj, "default", sd->list); 1615 elm_layout_content_set(obj, "default", sd->list);
@@ -1619,25 +1622,6 @@ _elm_ctxpopup_item_init(Eo *eo_item,
1619 sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN; 1622 sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
1620} 1623}
1621 1624
1622EOLIAN static Efl_Orient
1623_elm_ctxpopup_efl_orientation_orientation_get(Eo *obj EINA_UNUSED, Elm_Ctxpopup_Data *pd)
1624{
1625 return pd->orient;
1626}
1627
1628EOLIAN static void
1629_elm_ctxpopup_efl_orientation_orientation_set(Eo *obj, Elm_Ctxpopup_Data *pd, Efl_Orient orient)
1630{
1631 if (pd->orient == orient) return;
1632 if (pd->orient != EFL_ORIENT_HORIZONTAL && pd->orient != EFL_ORIENT_VERTICAL) return;
1633
1634 pd->orient = orient;
1635 //TODO: use orient API on list when its implemented
1636 elm_list_horizontal_set(pd->list, pd->orient == EFL_ORIENT_HORIZONTAL ? EINA_TRUE : EINA_FALSE);
1637 pd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
1638 if (pd->visible) elm_layout_sizing_eval(obj);
1639}
1640
1641EOLIAN static const Elm_Atspi_Action* 1625EOLIAN static const Elm_Atspi_Action*
1642_elm_ctxpopup_elm_interface_atspi_widget_action_elm_actions_get(Eo *obj EINA_UNUSED, Elm_Ctxpopup_Data *sd EINA_UNUSED) 1626_elm_ctxpopup_elm_interface_atspi_widget_action_elm_actions_get(Eo *obj EINA_UNUSED, Elm_Ctxpopup_Data *sd EINA_UNUSED)
1643{ 1627{
diff --git a/src/lib/elementary/elc_ctxpopup_legacy.h b/src/lib/elementary/elc_ctxpopup_legacy.h
index 629401f8c0..caf95a844a 100644
--- a/src/lib/elementary/elc_ctxpopup_legacy.h
+++ b/src/lib/elementary/elc_ctxpopup_legacy.h
@@ -9,27 +9,6 @@
9EAPI Evas_Object *elm_ctxpopup_add(Evas_Object *parent); 9EAPI Evas_Object *elm_ctxpopup_add(Evas_Object *parent);
10 10
11/** 11/**
12 * @brief Change the ctxpopup's orientation to horizontal or vertical.
13 *
14 * @param obj Elm Ctxpopup object
15 * @param horizontal @c EINA_TRUE for horizontal mode, @c EINA_FALSE for vertical.
16 *
17 * @ingroup Elm_Ctxpopup
18 */
19EAPI void elm_ctxpopup_horizontal_set(Evas_Object *obj, Eina_Bool horizontal);
20
21/**
22 * @brief Get the value of current ctxpopup object's orientation.
23 *
24 * @param obj Elm Ctxpopup object
25 * return @c EINA_TRUE for horizontal mode, @c EINA_FALSE for vertical.
26 * See also @ref elm_ctxpopup_horizontal_set
27 *
28 * @ingroup Elm_Ctxpopup
29 */
30EAPI Eina_Bool elm_ctxpopup_horizontal_get(const Evas_Object *obj);
31
32/**
33 * @brief Get the internal list of items in a given ctxpopup widget. 12 * @brief Get the internal list of items in a given ctxpopup widget.
34 * 13 *
35 * This list is not to be modified in any way and must not be freed. Use the 14 * This list is not to be modified in any way and must not be freed. Use the
diff --git a/src/lib/elementary/elm_ctxpopup.eo b/src/lib/elementary/elm_ctxpopup.eo
index 69615eecd6..2f3740f8c7 100644
--- a/src/lib/elementary/elm_ctxpopup.eo
+++ b/src/lib/elementary/elm_ctxpopup.eo
@@ -9,13 +9,27 @@ enum Elm.Ctxpopup.Direction
9} 9}
10 10
11class Elm.Ctxpopup (Efl.Ui.Layout, Elm.Interface.Atspi_Widget_Action, 11class Elm.Ctxpopup (Efl.Ui.Layout, Elm.Interface.Atspi_Widget_Action,
12 Efl.Orientation, Efl.Ui.Menu) 12 Efl.Ui.Menu)
13{ 13{
14 [[Elementary context popup class]] 14 [[Elementary context popup class]]
15 legacy_prefix: elm_ctxpopup; 15 legacy_prefix: elm_ctxpopup;
16 eo_prefix: elm_obj_ctxpopup; 16 eo_prefix: elm_obj_ctxpopup;
17 event_prefix: elm_ctxpopup; 17 event_prefix: elm_ctxpopup;
18 methods { 18 methods {
19 @property horizontal {
20 set {
21 [[Change the ctxpopup's orientation to horizontal or vertical.]]
22 }
23 get {
24 [[Get the value of current ctxpopup object's orientation.
25
26 See also @.horizontal.set.
27 ]]
28 }
29 values {
30 horizontal: bool; [[$true for horizontal mode, $false for vertical.]]
31 }
32 }
19 @property auto_hide_disabled { 33 @property auto_hide_disabled {
20 set { 34 set {
21 [[Set ctxpopup auto hide mode triggered by ctxpopup policy. 35 [[Set ctxpopup auto hide mode triggered by ctxpopup policy.
@@ -203,7 +217,6 @@ class Elm.Ctxpopup (Efl.Ui.Layout, Elm.Interface.Atspi_Widget_Action,
203 Efl.Ui.Menu.items { get; } 217 Efl.Ui.Menu.items { get; }
204 Elm.Interface.Atspi_Widget_Action.elm_actions { get; } 218 Elm.Interface.Atspi_Widget_Action.elm_actions { get; }
205 Elm.Interface.Atspi_Accessible.state_set { get; } 219 Elm.Interface.Atspi_Accessible.state_set { get; }
206 Efl.Orientation.orientation { get; set; }
207 Efl.Part.part; 220 Efl.Part.part;
208 } 221 }
209 events { 222 events {
diff --git a/src/lib/elementary/elm_widget_ctxpopup.h b/src/lib/elementary/elm_widget_ctxpopup.h
index b9342e1264..aa50b29c3b 100644
--- a/src/lib/elementary/elm_widget_ctxpopup.h
+++ b/src/lib/elementary/elm_widget_ctxpopup.h
@@ -55,9 +55,9 @@ struct _Elm_Ctxpopup_Data
55 55
56 Elm_Ctxpopup_Direction dir; 56 Elm_Ctxpopup_Direction dir;
57 Elm_Ctxpopup_Direction dir_priority[4]; 57 Elm_Ctxpopup_Direction dir_priority[4];
58 Efl_Orient orient;
59 58
60 Eina_Bool list_visible : 1; 59 Eina_Bool list_visible : 1;
60 Eina_Bool horizontal : 1;
61 Eina_Bool finished : 1; 61 Eina_Bool finished : 1;
62 Eina_Bool emitted : 1; 62 Eina_Bool emitted : 1;
63 Eina_Bool visible : 1; 63 Eina_Bool visible : 1;