summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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, 56 insertions, 32 deletions
diff --git a/src/lib/elementary/elc_ctxpopup.c b/src/lib/elementary/elc_ctxpopup.c
index 0faeec6ed4..803f7d7645 100644
--- a/src/lib/elementary/elc_ctxpopup.c
+++ b/src/lib/elementary/elc_ctxpopup.c
@@ -307,7 +307,7 @@ _base_geometry_calc(Evas_Object *obj,
307 { 307 {
308 Evas_Coord length[2]; 308 Evas_Coord length[2];
309 309
310 if (!sd->horizontal) 310 if (sd->orient == EFL_ORIENT_VERTICAL)
311 { 311 {
312 length[0] = pos.y - hover_area.y; 312 length[0] = pos.y - hover_area.y;
313 length[1] = (hover_area.y + hover_area.h) - pos.y; 313 length[1] = (hover_area.y + hover_area.h) - pos.y;
@@ -1129,6 +1129,8 @@ _elm_ctxpopup_evas_object_smart_add(Eo *obj, Elm_Ctxpopup_Data *priv)
1129 priv->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN; 1129 priv->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
1130 priv->auto_hide = EINA_TRUE; 1130 priv->auto_hide = EINA_TRUE;
1131 1131
1132 priv->orient = EFL_ORIENT_VERTICAL;
1133
1132 priv->box = elm_box_add(obj); 1134 priv->box = elm_box_add(obj);
1133 evas_object_size_hint_weight_set 1135 evas_object_size_hint_weight_set
1134 (priv->box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 1136 (priv->box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
@@ -1238,24 +1240,18 @@ _elm_ctxpopup_clear(Eo *obj EINA_UNUSED, Elm_Ctxpopup_Data *sd)
1238 sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN; 1240 sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
1239} 1241}
1240 1242
1241EOLIAN static void 1243EAPI void
1242_elm_ctxpopup_horizontal_set(Eo *obj, Elm_Ctxpopup_Data *sd, Eina_Bool horizontal) 1244elm_ctxpopup_horizontal_set(Evas_Object *obj, Eina_Bool horizontal)
1243{ 1245{
1244 sd->horizontal = !!horizontal; 1246 efl_orientation_set(obj, horizontal ? EFL_ORIENT_HORIZONTAL : EFL_ORIENT_VERTICAL);
1245
1246 if (!sd->list) return;
1247
1248 elm_list_horizontal_set(sd->list, sd->horizontal);
1249
1250 sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
1251
1252 if (sd->visible) elm_layout_sizing_eval(obj);
1253} 1247}
1254 1248
1255EOLIAN static Eina_Bool 1249EAPI Eina_Bool
1256_elm_ctxpopup_horizontal_get(Eo *obj EINA_UNUSED, Elm_Ctxpopup_Data *sd) 1250elm_ctxpopup_horizontal_get(Evas_Object *obj)
1257{ 1251{
1258 return sd->horizontal; 1252 ELM_CTXPOPUP_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
1253
1254 return sd->orient == EFL_ORIENT_HORIZONTAL ? EINA_TRUE : EINA_FALSE;
1259} 1255}
1260 1256
1261static void 1257static void
@@ -1434,7 +1430,8 @@ _elm_ctxpopup_item_init(Eo *eo_item,
1434 elm_object_style_set(sd->list, "ctxpopup"); 1430 elm_object_style_set(sd->list, "ctxpopup");
1435 else elm_object_style_set(sd->list, elm_object_style_get(obj)); 1431 else elm_object_style_set(sd->list, elm_object_style_get(obj));
1436 elm_list_mode_set(sd->list, ELM_LIST_EXPAND); 1432 elm_list_mode_set(sd->list, ELM_LIST_EXPAND);
1437 elm_list_horizontal_set(sd->list, sd->horizontal); 1433 //TODO: use orient interface API on list when implemented
1434 elm_list_horizontal_set(sd->list, sd->orient == EFL_ORIENT_VERTICAL ? EINA_FALSE : EINA_TRUE);
1438 evas_object_event_callback_add 1435 evas_object_event_callback_add
1439 (sd->list, EVAS_CALLBACK_RESIZE, _list_resize_cb, obj); 1436 (sd->list, EVAS_CALLBACK_RESIZE, _list_resize_cb, obj);
1440 elm_layout_content_set(obj, "default", sd->list); 1437 elm_layout_content_set(obj, "default", sd->list);
@@ -1447,6 +1444,25 @@ _elm_ctxpopup_item_init(Eo *eo_item,
1447 sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN; 1444 sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
1448} 1445}
1449 1446
1447EOLIAN static Efl_Orient
1448_elm_ctxpopup_efl_orientation_orientation_get(Eo *obj EINA_UNUSED, Elm_Ctxpopup_Data *pd)
1449{
1450 return pd->orient;
1451}
1452
1453EOLIAN static void
1454_elm_ctxpopup_efl_orientation_orientation_set(Eo *obj, Elm_Ctxpopup_Data *pd, Efl_Orient orient)
1455{
1456 if (pd->orient == orient) return;
1457 if (pd->orient != EFL_ORIENT_HORIZONTAL && pd->orient != EFL_ORIENT_VERTICAL) return;
1458
1459 pd->orient = orient;
1460 //TODO: use orient API on list when its implemented
1461 elm_list_horizontal_set(pd->list, pd->orient == EFL_ORIENT_HORIZONTAL ? EINA_TRUE : EINA_FALSE);
1462 pd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
1463 if (pd->visible) elm_layout_sizing_eval(obj);
1464}
1465
1450EOLIAN static const Elm_Atspi_Action* 1466EOLIAN static const Elm_Atspi_Action*
1451_elm_ctxpopup_elm_interface_atspi_widget_action_elm_actions_get(Eo *obj EINA_UNUSED, Elm_Ctxpopup_Data *sd EINA_UNUSED) 1467_elm_ctxpopup_elm_interface_atspi_widget_action_elm_actions_get(Eo *obj EINA_UNUSED, Elm_Ctxpopup_Data *sd EINA_UNUSED)
1452{ 1468{
diff --git a/src/lib/elementary/elc_ctxpopup_legacy.h b/src/lib/elementary/elc_ctxpopup_legacy.h
index cf3ad28371..a9837992d9 100644
--- a/src/lib/elementary/elc_ctxpopup_legacy.h
+++ b/src/lib/elementary/elc_ctxpopup_legacy.h
@@ -8,5 +8,26 @@
8 */ 8 */
9EAPI Evas_Object *elm_ctxpopup_add(Evas_Object *parent); 9EAPI Evas_Object *elm_ctxpopup_add(Evas_Object *parent);
10 10
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(Evas_Object *obj);
31
11#include "elm_ctxpopup_item.eo.legacy.h" 32#include "elm_ctxpopup_item.eo.legacy.h"
12#include "elm_ctxpopup.eo.legacy.h" 33#include "elm_ctxpopup.eo.legacy.h"
diff --git a/src/lib/elementary/elm_ctxpopup.eo b/src/lib/elementary/elm_ctxpopup.eo
index 7bc2f3a9b5..33447a2e8e 100644
--- a/src/lib/elementary/elm_ctxpopup.eo
+++ b/src/lib/elementary/elm_ctxpopup.eo
@@ -8,24 +8,10 @@ enum Elm.Ctxpopup.Direction
8 unknown [[Ctxpopup does not determine it's direction yet.]] 8 unknown [[Ctxpopup does not determine it's direction yet.]]
9} 9}
10 10
11class Elm.Ctxpopup (Elm.Layout, Elm.Interface_Atspi_Widget_Action) 11class Elm.Ctxpopup (Elm.Layout, Elm.Interface_Atspi_Widget_Action, Efl.Orientation)
12{ 12{
13 eo_prefix: elm_obj_ctxpopup; 13 eo_prefix: elm_obj_ctxpopup;
14 methods { 14 methods {
15 @property horizontal {
16 set {
17 [[Change the ctxpopup's orientation to horizontal or vertical.]]
18 }
19 get {
20 [[Get the value of current ctxpopup object's orientation.
21
22 See also @.horizontal.set.
23 ]]
24 }
25 values {
26 horizontal: bool; [[$true for horizontal mode, $false for vertical.]]
27 }
28 }
29 @property auto_hide_disabled { 15 @property auto_hide_disabled {
30 set { 16 set {
31 [[Set ctxpopup auto hide mode triggered by ctxpopup policy. 17 [[Set ctxpopup auto hide mode triggered by ctxpopup policy.
@@ -234,6 +220,7 @@ class Elm.Ctxpopup (Elm.Layout, Elm.Interface_Atspi_Widget_Action)
234 Elm.Layout.sizing_eval; 220 Elm.Layout.sizing_eval;
235 Elm.Interface_Atspi_Widget_Action.elm_actions.get; 221 Elm.Interface_Atspi_Widget_Action.elm_actions.get;
236 Elm.Interface_Atspi_Accessible.state_set.get; 222 Elm.Interface_Atspi_Accessible.state_set.get;
223 Efl.Orientation.orientation;
237 } 224 }
238 events { 225 events {
239 dismissed; 226 dismissed;
diff --git a/src/lib/elementary/elm_widget_ctxpopup.h b/src/lib/elementary/elm_widget_ctxpopup.h
index 12bd9ae395..25af380781 100644
--- a/src/lib/elementary/elm_widget_ctxpopup.h
+++ b/src/lib/elementary/elm_widget_ctxpopup.h
@@ -53,9 +53,9 @@ struct _Elm_Ctxpopup_Data
53 53
54 Elm_Ctxpopup_Direction dir; 54 Elm_Ctxpopup_Direction dir;
55 Elm_Ctxpopup_Direction dir_priority[4]; 55 Elm_Ctxpopup_Direction dir_priority[4];
56 Efl_Orient orient;
56 57
57 Eina_Bool list_visible : 1; 58 Eina_Bool list_visible : 1;
58 Eina_Bool horizontal : 1;
59 Eina_Bool finished : 1; 59 Eina_Bool finished : 1;
60 Eina_Bool emitted : 1; 60 Eina_Bool emitted : 1;
61 Eina_Bool visible : 1; 61 Eina_Bool visible : 1;