summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYeshwanth Reddivari <r.yeshwanth@samsung.com>2016-05-27 10:11:12 +0530
committerAmitesh Singh <amitesh.sh@samsung.com>2016-05-27 10:11:13 +0530
commitf043c3be617f7257001b9fc779b64cebf4370781 (patch)
tree67662400946ee3b813ea3dadf1a71491644d8508
parent058f07e7596ae04a3594bb1b941298e9a22e45aa (diff)
downloadefl-devs/ami/gfx-video.tar.gz
Separtor: use orientation APIsdevs/ami/gfx-video
Summary: Use orientation APIs instead of horizontal get/set apis. Test Plan: elementary_test -to separator Reviewers: jpeg, cedric, Hermet, raster, singh.amitesh Reviewed By: singh.amitesh Differential Revision: https://phab.enlightenment.org/D3984
-rw-r--r--src/bin/elementary/test_separator.c4
-rw-r--r--src/lib/elementary/elm_separator.c47
-rw-r--r--src/lib/elementary/elm_separator.eo16
-rw-r--r--src/lib/elementary/elm_separator_legacy.h20
-rw-r--r--src/lib/elementary/elm_widget_separator.h2
5 files changed, 63 insertions, 26 deletions
diff --git a/src/bin/elementary/test_separator.c b/src/bin/elementary/test_separator.c
index 00d9985c42..40aff1947c 100644
--- a/src/bin/elementary/test_separator.c
+++ b/src/bin/elementary/test_separator.c
@@ -28,7 +28,7 @@ test_separator(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event
evas_object_show(bt);
sp = elm_separator_add(win);
- elm_separator_horizontal_set(sp, EINA_TRUE); // by default, separator is vertical, we must set it horizontal
+ efl_orientation_set(sp, EFL_ORIENT_HORIZONTAL);
elm_box_pack_end(bx, sp);
evas_object_show(sp);
@@ -54,7 +54,7 @@ test_separator(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event
evas_object_show(bt);
sp = elm_separator_add(win);
- elm_separator_horizontal_set(sp, EINA_TRUE);
+ efl_orientation_set(sp, EFL_ORIENT_HORIZONTAL);
elm_box_pack_end(bx, sp);
evas_object_show(sp);
diff --git a/src/lib/elementary/elm_separator.c b/src/lib/elementary/elm_separator.c
index 2e940d9784..6c5ca2fb2e 100644
--- a/src/lib/elementary/elm_separator.c
+++ b/src/lib/elementary/elm_separator.c
@@ -21,7 +21,7 @@ _elm_separator_elm_widget_theme_apply(Eo *obj, Elm_Separator_Data *sd EINA_UNUSE
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");
@@ -51,6 +51,8 @@ _elm_separator_evas_object_smart_add(Eo *obj, Elm_Separator_Data *sd EINA_UNUSED
elm_widget_sub_object_parent_add(obj);
elm_widget_can_focus_set(obj, EINA_FALSE);
+ sd->orientation = EFL_ORIENT_VERTICAL;
+
if (!elm_layout_theme_set
(obj, "separator", "vertical", elm_widget_style_get(obj)))
CRI("Failed to set layout!");
@@ -66,6 +68,32 @@ elm_separator_add(Evas_Object *parent)
return obj;
}
+EAPI void
+elm_separator_horizontal_set(Evas_Object *obj, Eina_Bool horizontal)
+{
+ Efl_Orient orient;
+
+ if (horizontal)
+ orient = EFL_ORIENT_HORIZONTAL;
+ else
+ orient = EFL_ORIENT_VERTICAL;
+
+ if (orient == efl_orientation_get(obj)) return;
+
+ efl_orientation_set(obj, orient);
+}
+
+EAPI Eina_Bool
+elm_separator_horizontal_get(const Evas_Object *obj)
+{
+ ELM_SEPARATOR_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
+
+ if (sd->orientation == EFL_ORIENT_VERTICAL)
+ return EINA_FALSE;
+ else
+ return EINA_TRUE;
+}
+
EOLIAN static Eo *
_elm_separator_eo_base_constructor(Eo *obj, Elm_Separator_Data *sd EINA_UNUSED)
{
@@ -77,20 +105,23 @@ _elm_separator_eo_base_constructor(Eo *obj, Elm_Separator_Data *sd EINA_UNUSED)
}
EOLIAN static void
-_elm_separator_horizontal_set(Eo *obj, Elm_Separator_Data *sd, Eina_Bool horizontal)
+_elm_separator_efl_orientation_orientation_set(Eo *obj, Elm_Separator_Data *sd, Efl_Orient dir)
{
- horizontal = !!horizontal;
- if (sd->horizontal == horizontal) return;
+ if (dir != EFL_ORIENT_VERTICAL &&
+ dir != EFL_ORIENT_HORIZONTAL)
+ return;
+
+ if (sd->orientation == dir) return;
- sd->horizontal = horizontal;
+ sd->orientation = dir;
elm_obj_widget_theme_apply(obj);
}
-EOLIAN static Eina_Bool
-_elm_separator_horizontal_get(Eo *obj EINA_UNUSED, Elm_Separator_Data *sd)
+EOLIAN static Efl_Orient
+_elm_separator_efl_orientation_orientation_get(Eo *obj EINA_UNUSED, Elm_Separator_Data *sd)
{
- return sd->horizontal;
+ return sd->orientation;
}
EOLIAN static Eina_Bool
diff --git a/src/lib/elementary/elm_separator.eo b/src/lib/elementary/elm_separator.eo
index c190c20e90..a0cbf516d1 100644
--- a/src/lib/elementary/elm_separator.eo
+++ b/src/lib/elementary/elm_separator.eo
@@ -1,20 +1,7 @@
-class Elm.Separator (Elm.Layout)
+class Elm.Separator (Elm.Layout, Efl.Orientation)
{
legacy_prefix: elm_separator;
eo_prefix: elm_obj_separator;
- methods {
- @property horizontal {
- set {
- [[Set the horizontal mode of a separator object]]
- }
- get {
- [[Get the horizontal mode of a separator object]]
- }
- values {
- horizontal: bool; [[If true, the separator is horizontal]]
- }
- }
- }
implements {
class.constructor;
Eo.Base.constructor;
@@ -22,6 +9,7 @@ class Elm.Separator (Elm.Layout)
Elm.Widget.focus_next_manager_is;
Elm.Widget.focus_direction_manager_is;
Elm.Widget.theme_apply;
+ Efl.Orientation.orientation;
Elm.Layout.sizing_eval;
}
diff --git a/src/lib/elementary/elm_separator_legacy.h b/src/lib/elementary/elm_separator_legacy.h
index 82cf44ee0b..6581d53f2d 100644
--- a/src/lib/elementary/elm_separator_legacy.h
+++ b/src/lib/elementary/elm_separator_legacy.h
@@ -9,4 +9,22 @@
*/
EAPI Evas_Object *elm_separator_add(Evas_Object *parent);
-#include "elm_separator.eo.legacy.h" \ No newline at end of file
+/**
+ * @brief Set the horizontal mode of a separator object
+ *
+ * @param[in] horizontal If true, the separator is horizontal
+ *
+ * @ingroup Elm_Separator
+ */
+EAPI void elm_separator_horizontal_set(Evas_Object *obj, Eina_Bool horizontal);
+
+/**
+ * @brief Get the horizontal mode of a separator object
+ *
+ * @return If true, the separator is horizontal
+ *
+ * @ingroup Elm_Separator
+ */
+EAPI Eina_Bool elm_separator_horizontal_get(const Evas_Object *obj);
+
+#include "elm_separator.eo.legacy.h"
diff --git a/src/lib/elementary/elm_widget_separator.h b/src/lib/elementary/elm_widget_separator.h
index 9d9af33bb0..2b0d44c96a 100644
--- a/src/lib/elementary/elm_widget_separator.h
+++ b/src/lib/elementary/elm_widget_separator.h
@@ -26,7 +26,7 @@
typedef struct _Elm_Separator_Data Elm_Separator_Data;
struct _Elm_Separator_Data
{
- Eina_Bool horizontal : 1;
+ Efl_Orient orientation;
};
/**