summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmitesh Singh <amitesh.sh@samsung.com>2016-05-18 00:00:03 +0900
committerJean-Philippe ANDRE <jpeg@videolan.org>2016-05-18 00:36:09 +0900
commitf007380fb948f426d04778965ec4d192fe953cc2 (patch)
tree24ee83969ace22e4fecd421c0696c54cf24d29a8
parent546ff7bbba788ec834c5608361c0834853f2d5d7 (diff)
downloadefl-f007380fb948f426d04778965ec4d192fe953cc2.tar.gz
Panes: Use orientation interface APIs instead of horizontal set/get APIs
Differential Revision: https://phab.enlightenment.org/D3919
-rw-r--r--src/bin/elementary/test_panes.c2
-rw-r--r--src/lib/elementary/elm_panes.c61
-rw-r--r--src/lib/elementary/elm_panes.eo23
-rw-r--r--src/lib/elementary/elm_panes_legacy.h34
-rw-r--r--src/lib/elementary/elm_widget_panes.h2
5 files changed, 84 insertions, 38 deletions
diff --git a/src/bin/elementary/test_panes.c b/src/bin/elementary/test_panes.c
index 27d9535045..6b60516b3f 100644
--- a/src/bin/elementary/test_panes.c
+++ b/src/bin/elementary/test_panes.c
@@ -76,7 +76,7 @@ test_panes(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_inf
// add panes
panes_h = elm_panes_add(win);
- elm_panes_horizontal_set(panes_h, EINA_TRUE);
+ efl_orientation_set(panes_h, EFL_ORIENT_HORIZONTAL);
elm_panes_content_right_min_size_set(panes_h, 100);
elm_panes_content_right_size_set(panes_h, 0.3);
evas_object_show(panes_h);
diff --git a/src/lib/elementary/elm_panes.c b/src/lib/elementary/elm_panes.c
index 350be38bca..1c322235ff 100644
--- a/src/lib/elementary/elm_panes.c
+++ b/src/lib/elementary/elm_panes.c
@@ -52,7 +52,7 @@ _elm_panes_elm_widget_theme_apply(Eo *obj, Elm_Panes_Data *sd)
Eina_Bool int_ret = EINA_FALSE;
ELM_LAYOUT_DATA_GET(obj, ld);
- if (sd->horizontal)
+ if (sd->orientation == EFL_ORIENT_HORIZONTAL)
eina_stringshare_replace(&ld->group, "horizontal");
else
eina_stringshare_replace(&ld->group, "vertical");
@@ -100,7 +100,8 @@ _elm_panes_elm_widget_focus_next(Eo *obj, Elm_Panes_Data *sd, Elm_Focus_Directio
left = elm_layout_content_get(obj, "left");
right = elm_layout_content_get(obj, "right");
- if (((sd->horizontal) && (h == 0.0)) || ((!sd->horizontal) && (w == 0.0)))
+ if (((sd->orientation == EFL_ORIENT_HORIZONTAL) && (h == 0.0)) ||
+ ((sd->orientation == EFL_ORIENT_VERTICAL) && (w == 0.0)))
{
return elm_widget_focus_next_get(right, dir, next, next_item);
}
@@ -193,7 +194,7 @@ _set_min_size(void *data)
sizer = sizer / sum;
sizel = sizel / sum;
}
- if (sd->horizontal)
+ if (sd->orientation == EFL_ORIENT_HORIZONTAL)
{
edje_object_part_drag_value_set
(wd->resize_obj, "right_constraint", 0.0, (1 - sizer));
@@ -219,7 +220,7 @@ _update_fixed_sides(void *data)
if (sd->right_min_size_is_relative)
{
- if (sd->horizontal)
+ if (sd->orientation == EFL_ORIENT_HORIZONTAL)
sd->right_min_size = (int)(h * sd->right_min_relative_size);
else
sd->right_min_size =(int)(w * sd->right_min_relative_size);
@@ -227,15 +228,15 @@ _update_fixed_sides(void *data)
else
{
sd->right_min_relative_size = 0;
- if (sd->horizontal && (h > 0))
+ if (sd->orientation == EFL_ORIENT_HORIZONTAL && (h > 0))
sd->right_min_relative_size = sd->right_min_size / (double)h;
- if (!sd->horizontal && (w > 0))
+ if (sd->orientation == EFL_ORIENT_VERTICAL && (w > 0))
sd->right_min_relative_size = sd->right_min_size / (double)w;
}
if(sd->left_min_size_is_relative)
{
- if (sd->horizontal)
+ if (sd->orientation == EFL_ORIENT_HORIZONTAL)
sd->left_min_size = (int)(h * sd->left_min_relative_size);
else
sd->left_min_size = (int)(w * sd->left_min_relative_size);
@@ -243,9 +244,9 @@ _update_fixed_sides(void *data)
else
{
sd->left_min_relative_size = 0;
- if (sd->horizontal && (h > 0))
+ if (sd->orientation == EFL_ORIENT_HORIZONTAL && (h > 0))
sd->left_min_relative_size = sd->left_min_size / (double)h;
- if (!sd->horizontal && (w > 0))
+ if (sd->orientation == EFL_ORIENT_VERTICAL && (w > 0))
sd->left_min_relative_size = sd->left_min_size / (double)w;
}
_set_min_size(data);
@@ -385,7 +386,8 @@ _elm_panes_content_left_size_get(Eo *obj, Elm_Panes_Data *sd)
edje_object_part_drag_value_get
(wd->resize_obj, "elm.bar", &w, &h);
- if (sd->horizontal) return h;
+ if (sd->orientation == EFL_ORIENT_HORIZONTAL)
+ return h;
else return w;
}
@@ -397,7 +399,7 @@ _elm_panes_content_left_size_set(Eo *obj, Elm_Panes_Data *sd, double size)
if (size < 0.0) size = 0.0;
else if (size > 1.0) size = 1.0;
- if (sd->horizontal)
+ if (sd->orientation == EFL_ORIENT_HORIZONTAL)
edje_object_part_drag_value_set
(wd->resize_obj, "elm.bar", 0.0, size);
else
@@ -418,19 +420,46 @@ _elm_panes_content_right_size_set(Eo *obj, Elm_Panes_Data *_pd EINA_UNUSED, doub
}
EOLIAN static void
-_elm_panes_horizontal_set(Eo *obj, Elm_Panes_Data *sd, Eina_Bool horizontal)
+_elm_panes_efl_orientation_orientation_set(Eo *obj, Elm_Panes_Data *sd, Efl_Orient dir)
{
- sd->horizontal = horizontal;
+ if ((dir != EFL_ORIENT_HORIZONTAL) && (dir != EFL_ORIENT_VERTICAL))
+ return;
+
+ sd->orientation = dir;
elm_obj_widget_theme_apply(obj);
_update_fixed_sides(obj);
elm_panes_content_left_size_set(obj, 0.5);
}
-EOLIAN static Eina_Bool
-_elm_panes_horizontal_get(Eo *obj EINA_UNUSED, Elm_Panes_Data *sd)
+EOLIAN static Efl_Orient
+_elm_panes_efl_orientation_orientation_get(Eo *obj EINA_UNUSED, Elm_Panes_Data *sd)
+{
+ return sd->orientation;
+}
+
+EAPI void
+elm_panes_horizontal_set(Evas_Object *obj, Eina_Bool horizontal)
+{
+ Efl_Orient orient;
+
+ if (horizontal)
+ orient = EFL_ORIENT_HORIZONTAL;
+ else
+ orient = EFL_ORIENT_VERTICAL;
+
+ efl_orientation_set(obj, orient);
+}
+
+EAPI Eina_Bool
+elm_panes_horizontal_get(const Evas_Object *obj)
{
- return sd->horizontal;
+ Efl_Orient orient = efl_orientation_get(obj);
+
+ if (orient == EFL_ORIENT_HORIZONTAL)
+ return EINA_TRUE;
+
+ return EINA_FALSE;
}
EOLIAN static void
diff --git a/src/lib/elementary/elm_panes.eo b/src/lib/elementary/elm_panes.eo
index f057b68076..d9c3402789 100644
--- a/src/lib/elementary/elm_panes.eo
+++ b/src/lib/elementary/elm_panes.eo
@@ -1,4 +1,5 @@
-class Elm.Panes (Elm.Layout, Evas.Clickable_Interface)
+class Elm.Panes (Elm.Layout, Efl.Orientation,
+ Evas.Clickable_Interface)
{
legacy_prefix: elm_panes;
eo_prefix: elm_obj_panes;
@@ -25,25 +26,6 @@ class Elm.Panes (Elm.Layout, Evas.Clickable_Interface)
size: double; [[Value between 0.0 and 1.0 representing size proportion of left side.]]
}
}
- @property horizontal {
- [[Set how to split and dispose each content.
-
- Use this function to change how your panes is to be disposed:
- vertically or horizontally.
- Horizontal panes have "top" and "bottom" contents, vertical panes have
- "left" and "right" contents.
-
- By default panes is in a vertical mode.]]
- set {
- }
- get {
- }
- values {
- horizontal: bool; [[Use $true to make $obj to split panes
- horizontally ("top" and "bottom" contents). $false to make it
- vertically ("left" and "right" contents).]]
- }
- }
@property fixed {
[[Set whether the left and right panes can be resized by user interaction.
@@ -139,6 +121,7 @@ class Elm.Panes (Elm.Layout, Evas.Clickable_Interface)
Elm.Widget.focus_next;
Elm.Widget.theme_apply;
Elm.Layout.content_aliases.get;
+ Efl.Orientation.orientation;
}
events {
press;
diff --git a/src/lib/elementary/elm_panes_legacy.h b/src/lib/elementary/elm_panes_legacy.h
index c6c2d3878c..40c5b4db80 100644
--- a/src/lib/elementary/elm_panes_legacy.h
+++ b/src/lib/elementary/elm_panes_legacy.h
@@ -11,4 +11,38 @@
*/
EAPI Evas_Object *elm_panes_add(Evas_Object *parent);
+/**
+ * @brief Set how to split and dispose each content.
+ *
+ * Use this function to change how your panes is to be disposed: vertically or
+ * horizontally. Horizontal panes have "top" and "bottom" contents, vertical
+ * panes have "left" and "right" contents.
+ *
+ * By default panes is in a vertical mode.
+ *
+ * @param[in] horizontal Use @c true to make @c obj to split panes horizontally
+ * ("top" and "bottom" contents). @c false to make it vertically ("left" and
+ * "right" contents).
+ *
+ * @ingroup Elm_Panes
+ */
+EAPI void elm_panes_horizontal_set(Evas_Object *obj, Eina_Bool horizontal);
+
+/**
+ * @brief Set how to split and dispose each content.
+ *
+ * Use this function to change how your panes is to be disposed: vertically or
+ * horizontally. Horizontal panes have "top" and "bottom" contents, vertical
+ * panes have "left" and "right" contents.
+ *
+ * By default panes is in a vertical mode.
+ *
+ * @return Use @c true to make @c obj to split panes horizontally ("top" and
+ * "bottom" contents). @c false to make it vertically ("left" and "right"
+ * contents).
+ *
+ * @ingroup Elm_Panes
+ */
+EAPI Eina_Bool elm_panes_horizontal_get(const Evas_Object *obj);
+
#include "elm_panes.eo.legacy.h"
diff --git a/src/lib/elementary/elm_widget_panes.h b/src/lib/elementary/elm_widget_panes.h
index c4625aa174..6528354c27 100644
--- a/src/lib/elementary/elm_widget_panes.h
+++ b/src/lib/elementary/elm_widget_panes.h
@@ -34,12 +34,12 @@ struct _Elm_Panes_Data
Eina_Bool move;
} move;
+ Efl_Orient orientation;
double left_min_relative_size;
double right_min_relative_size;
Evas_Coord left_min_size;
Evas_Coord right_min_size;
Eina_Bool double_clicked : 1;
- Eina_Bool horizontal : 1;
Eina_Bool fixed : 1;
Eina_Bool left_min_size_is_relative : 1;
Eina_Bool right_min_size_is_relative : 1;