summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmitesh Singh <amitesh.sh@samsung.com>2017-08-09 20:45:02 +0900
committerAmitesh Singh <amitesh.sh@samsung.com>2017-08-10 14:13:05 +0900
commita849d9695d877ada27d86b751122451957fcecdf (patch)
tree180b2f6849dbe53b6528b85393392fafd646a407
parentbb95c9f4d3820fc5ed1cb8a23fe2bb2c6a8fcc05 (diff)
downloadefl-devs/ami/panes2.tar.gz
Efl.Ui.Panes: rename left/right_size_set to split_ratiodevs/ami/panes2
This name makes more sense and one api does the job of two. We never needed two apis at first place though. Mark left/right_size_set as legacy apis too. @feature refer T5359
-rw-r--r--src/bin/elementary/test_panes.c3
-rw-r--r--src/lib/elementary/efl_ui_panes.c164
-rw-r--r--src/lib/elementary/efl_ui_panes.eo80
-rw-r--r--src/lib/elementary/efl_ui_panes_internal_part.eo11
-rw-r--r--src/lib/elementary/efl_ui_panes_private.h2
-rw-r--r--src/lib/elementary/elm_panes_legacy.h139
6 files changed, 281 insertions, 118 deletions
diff --git a/src/bin/elementary/test_panes.c b/src/bin/elementary/test_panes.c
index 925bc79ed3..c184575489 100644
--- a/src/bin/elementary/test_panes.c
+++ b/src/bin/elementary/test_panes.c
@@ -117,7 +117,8 @@ test_panes_minsize(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *e
panes = efl_add(EFL_UI_PANES_CLASS, win,
efl_gfx_size_hint_weight_set(efl_added, EFL_GFX_SIZE_HINT_EXPAND, EFL_GFX_SIZE_HINT_EXPAND),
- efl_content_set(win, efl_added)
+ efl_content_set(win, efl_added),
+ efl_ui_panes_split_ratio_set(efl_added, 0.7)
);
efl_add(EFL_UI_BUTTON_CLASS, win,
diff --git a/src/lib/elementary/efl_ui_panes.c b/src/lib/elementary/efl_ui_panes.c
index 0308f2acd7..e05b2fb648 100644
--- a/src/lib/elementary/efl_ui_panes.c
+++ b/src/lib/elementary/efl_ui_panes.c
@@ -251,6 +251,10 @@ _set_min_size_new(void *data)
second_min_relative_size = second_minh/(double)h;
}
}
+
+ first_min_relative_size = MAX(sd->first_min_split_ratio, first_min_relative_size);
+ second_min_relative_size = MAX(sd->second_min_split_ratio, second_min_relative_size);
+
edje_object_part_drag_value_set(wd->resize_obj, "right_constraint",
0.0, 1.0 - second_min_relative_size);
edje_object_part_drag_value_set(wd->resize_obj, "left_constraint",
@@ -271,6 +275,10 @@ _set_min_size_new(void *data)
second_min_relative_size = second_minw/(double)w;
}
}
+
+ first_min_relative_size = MAX(sd->first_min_split_ratio, first_min_relative_size);
+ second_min_relative_size = MAX(sd->second_min_split_ratio, second_min_relative_size);
+
edje_object_part_drag_value_set(wd->resize_obj, "right_constraint",
1.0 - second_min_relative_size, 0.0);
edje_object_part_drag_value_set(wd->resize_obj, "left_constraint",
@@ -485,14 +493,12 @@ elm_panes_content_right_unset(Evas_Object *obj)
}
EOLIAN static double
-_efl_ui_panes_content_left_size_get(Eo *obj, Efl_Ui_Panes_Data *sd)
+_efl_ui_panes_split_ratio_get(Eo *obj, Efl_Ui_Panes_Data *sd)
{
double w, h;
-
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, 0.0);
- edje_object_part_drag_value_get
- (wd->resize_obj, "elm.bar", &w, &h);
+ edje_object_part_drag_value_get(wd->resize_obj, "elm.bar", &w, &h);
if (sd->orientation == EFL_ORIENT_HORIZONTAL)
return h;
@@ -500,31 +506,17 @@ _efl_ui_panes_content_left_size_get(Eo *obj, Efl_Ui_Panes_Data *sd)
}
EOLIAN static void
-_efl_ui_panes_content_left_size_set(Eo *obj, Efl_Ui_Panes_Data *sd, double size)
+_efl_ui_panes_split_ratio_set(Eo *obj, Efl_Ui_Panes_Data *sd, double ratio)
{
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
- if (size < 0.0) size = 0.0;
- else if (size > 1.0) size = 1.0;
+ if (ratio < 0.0) ratio = 0.0;
+ else if (ratio > 1.0) ratio = 1.0;
if (sd->orientation == EFL_ORIENT_HORIZONTAL)
- edje_object_part_drag_value_set
- (wd->resize_obj, "elm.bar", 0.0, size);
+ edje_object_part_drag_value_set(wd->resize_obj, "elm.bar", 0.0, ratio);
else
- edje_object_part_drag_value_set
- (wd->resize_obj, "elm.bar", size, 0.0);
-}
-
-EOLIAN static double
-_efl_ui_panes_content_right_size_get(Eo *obj, Efl_Ui_Panes_Data *_pd EINA_UNUSED)
-{
- return 1.0 - elm_panes_content_left_size_get(obj);
-}
-
-EOLIAN static void
-_efl_ui_panes_content_right_size_set(Eo *obj, Efl_Ui_Panes_Data *_pd EINA_UNUSED, double size)
-{
- elm_panes_content_left_size_set(obj, (1.0 - size));
+ edje_object_part_drag_value_set(wd->resize_obj, "elm.bar", ratio, 0.0);
}
EOLIAN static void
@@ -601,36 +593,6 @@ _efl_ui_panes_fixed_get(Eo *obj EINA_UNUSED, Efl_Ui_Panes_Data *sd)
return sd->fixed;
}
-EOLIAN static void
-_efl_ui_panes_content_left_min_relative_size_set(Eo *obj, Efl_Ui_Panes_Data *_pd, double size)
-{
- _pd->left_min_relative_size = size;
- if (_pd->left_min_relative_size < 0) _pd->left_min_relative_size = 0;
- _pd->left_min_size_is_relative = EINA_TRUE;
- _update_fixed_sides(obj);
-}
-
-EOLIAN static double
-_efl_ui_panes_content_left_min_relative_size_get(Eo *obj EINA_UNUSED, Efl_Ui_Panes_Data *_pd)
-{
- return _pd->left_min_relative_size;
-}
-
-EOLIAN static void
-_efl_ui_panes_content_right_min_relative_size_set(Eo *obj, Efl_Ui_Panes_Data *_pd, double size)
-{
- _pd->right_min_relative_size = size;
- if (_pd->right_min_relative_size < 0) _pd->right_min_relative_size = 0;
- _pd->right_min_size_is_relative = EINA_TRUE;
- _update_fixed_sides(obj);
-}
-
-EOLIAN static double
-_efl_ui_panes_content_right_min_relative_size_get(Eo *obj EINA_UNUSED, Efl_Ui_Panes_Data *_pd)
-{
- return _pd->right_min_relative_size;
-}
-
EOLIAN static Eina_Bool
_efl_ui_panes_elm_widget_focus_next_manager_is(Eo *obj EINA_UNUSED, Efl_Ui_Panes_Data *_pd EINA_UNUSED)
{
@@ -673,7 +635,7 @@ _efl_ui_panes_internal_part_allow_user_size_hints_get(Eo *obj, Elm_Part_Data *_p
Eina_Bool ret = EINA_FALSE;
Elm_Part_Data *pd = efl_data_scope_get(obj, ELM_LAYOUT_INTERNAL_PART_CLASS);
Efl_Ui_Panes_Data *sd = efl_data_scope_get(pd->obj, EFL_UI_PANES_CLASS);
-
+
if (!strcmp(pd->part, "first"))
{
ret = sd->first_allow_user_hints;
@@ -686,6 +648,41 @@ _efl_ui_panes_internal_part_allow_user_size_hints_get(Eo *obj, Elm_Part_Data *_p
return ret;
}
+EOLIAN static double
+_efl_ui_panes_internal_part_min_split_ratio_get(Eo *obj, Elm_Part_Data *_pd EINA_UNUSED)
+{
+ Elm_Part_Data *pd = efl_data_scope_get(obj, ELM_LAYOUT_INTERNAL_PART_CLASS);
+ Efl_Ui_Panes_Data *sd = efl_data_scope_get(pd->obj, EFL_UI_PANES_CLASS);
+ double ret = 0.0;
+
+ if (!strcmp(pd->part, "first"))
+ ret = sd->first_min_split_ratio;
+ else if (!strcmp(pd->part, "second"))
+ ret = sd->second_min_split_ratio;
+
+ return ret;
+}
+
+EOLIAN static void
+_efl_ui_panes_internal_part_min_split_ratio_set(Eo *obj, Elm_Part_Data *_pd EINA_UNUSED, double ratio)
+{
+ Elm_Part_Data *pd = efl_data_scope_get(obj, ELM_LAYOUT_INTERNAL_PART_CLASS);
+ Efl_Ui_Panes_Data *sd = efl_data_scope_get(pd->obj, EFL_UI_PANES_CLASS);
+
+ if (!strcmp(pd->part, "first"))
+ {
+ sd->first_min_split_ratio = ratio;
+ if (sd->first_min_split_ratio < 0) sd->first_min_split_ratio = 0;
+ _set_min_size_new(pd->obj);
+ }
+ else if (!strcmp(pd->part, "second"))
+ {
+ sd->second_min_split_ratio = ratio;
+ if (sd->second_min_split_ratio < 0) sd->second_min_split_ratio = 0;
+ _set_min_size_new(pd->obj);
+ }
+}
+
#include "efl_ui_panes_internal_part.eo.c"
/* Efl.Part end */
@@ -735,6 +732,65 @@ elm_panes_content_right_min_size_get(const Evas_Object *obj)
return sd->right_min_size;
}
+EAPI double
+elm_panes_content_left_size_get(const Evas_Object *obj)
+{
+ return efl_ui_panes_split_ratio_get(obj);
+}
+
+EAPI void
+elm_panes_content_left_size_set(Evas_Object *obj, double size)
+{
+ efl_ui_panes_split_ratio_set(obj, size);
+}
+
+EAPI double
+elm_panes_content_right_size_get(const Evas_Object *obj)
+{
+ return 1.0 - elm_panes_content_left_size_get(obj);
+}
+
+EAPI void
+elm_panes_content_right_size_set(Evas_Object *obj, double size)
+{
+ elm_panes_content_left_size_set(obj, (1.0 - size));
+}
+
+EAPI void
+elm_panes_content_left_min_relative_size_set(Evas_Object *obj, double size)
+{
+ EFL_UI_PANES_DATA_GET(obj, sd);
+ sd->left_min_relative_size = size;
+ if (sd->left_min_relative_size < 0) sd->left_min_relative_size = 0;
+ sd->left_min_size_is_relative = EINA_TRUE;
+ _update_fixed_sides(obj);
+}
+
+EAPI double
+elm_panes_content_left_min_relative_size_get(const Evas_Object *obj)
+{
+ EFL_UI_PANES_DATA_GET(obj, sd);
+ return sd->left_min_relative_size;
+}
+
+EAPI void
+elm_panes_content_right_min_relative_size_set(Evas_Object *obj, double size)
+{
+ EFL_UI_PANES_DATA_GET(obj, sd);
+
+ sd->right_min_relative_size = size;
+ if (sd->right_min_relative_size < 0) sd->right_min_relative_size = 0;
+ sd->right_min_size_is_relative = EINA_TRUE;
+ _update_fixed_sides(obj);
+}
+
+EAPI double
+elm_panes_content_right_min_relative_size_get(const Evas_Object *obj)
+{
+ EFL_UI_PANES_DATA_GET(obj, sd);
+ return sd->right_min_relative_size;
+}
+
/* Legacy APIs end */
#include "efl_ui_panes.eo.c"
diff --git a/src/lib/elementary/efl_ui_panes.eo b/src/lib/elementary/efl_ui_panes.eo
index 474f6aca9d..fed0a577b5 100644
--- a/src/lib/elementary/efl_ui_panes.eo
+++ b/src/lib/elementary/efl_ui_panes.eo
@@ -5,26 +5,28 @@ class Efl.Ui.Panes (Elm.Layout, Efl.Orientation,
legacy_prefix: elm_panes;
event_prefix: elm_panes;
methods {
- @property content_left_size {
- [[Set the size proportion of panes widget's left side.
+ @property split_ratio {
+ [[Set the split ratio between panes widget first and second parts.
By default it's homogeneous, i.e., both sides have the same size.
If something different is required, it can be set with this function.
- For example, if the left content should be displayed over
- 75% of the panes size, $size should be passed as 0.75.
- This way, right content will be resized to 25% of panes size.
-
- If displayed vertically, left content is displayed at top, and
- right content at bottom.
-
- Note: This proportion will change when user drags the panes bar.]]
- set {
- }
- get {
- }
+ For example, if the first content should be displayed over
+ 75% of the panes size, $ratio should be passed as 0.75.
+ This way, second content will be resized to 25% of panes size.
+
+ If displayed vertically, first content is displayed at top, and
+ second content at bottom.
+
+ Note: This ratio will change when user drags the panes bar.]]
+ set {
+ legacy: null;
+ }
+ get {
+ legacy: null;
+ }
values {
- size: double; [[Value between 0.0 and 1.0 representing size proportion of left side.]]
+ ratio: double; [[Value between 0.0 and 1.0 representing split ratio between panes first and second parts.]]
}
}
@property fixed {
@@ -41,54 +43,6 @@ class Efl.Ui.Panes (Elm.Layout, Efl.Orientation,
resizable.]]
}
}
- @property content_right_size {
- [[Set the size proportion of panes widget's right side.
-
- By default it's homogeneous, i.e., both sides have the same size.
-
- If something different is required, it can be set with this function.
- For example, if the right content should be displayed over
- 75% of the panes size, $size should be passed as 0.75.
- This way, left content will be resized to 25% of panes size.
-
- If displayed vertically, left content is displayed at top, and
- right content at bottom.
-
- Note: This proportion will change when user drags the panes bar.]]
- set {
- }
- get {
- }
- values {
- size: double; [[Value between 0.0 and 1.0 representing size proportion of right side.]]
- }
- }
- @property content_left_min_relative_size {
- [[Controls the relative minimum size of panes widget's left side.
-
- proportion of minimum size of left side.
-
- Note: If displayed vertically, left content is displayed at top.]]
- set {
- }
- get {
- }
- values {
- size: double; [[Value between 0.0 and 1.0 representing size proportion of minimum size of left side.]]
- }
- }
- @property content_right_min_relative_size {
- [[Set the relative minimum size of panes widget's right side.
-
- Note: If displayed vertically, right content is displayed at bottom.]]
- set {
- }
- get {
- }
- values {
- size: double; [[Value between 0.0 and 1.0 representing size proportion of minimum size of right side.]]
- }
- }
}
implements {
class.constructor;
diff --git a/src/lib/elementary/efl_ui_panes_internal_part.eo b/src/lib/elementary/efl_ui_panes_internal_part.eo
index f4466734c3..73f4c4a7ca 100644
--- a/src/lib/elementary/efl_ui_panes_internal_part.eo
+++ b/src/lib/elementary/efl_ui_panes_internal_part.eo
@@ -11,6 +11,17 @@ class Efl.Ui.Panes.Internal.Part (Elm.Layout.Internal.Part)
allow: bool;
}
}
+ @property min_split_ratio {
+ [[Controls the relative minimum size of panes widget's part.
+
+ If @Efl.Gfx.Size.Hint.hint_min.set is also used along with @.min_split_ratio.set, maximum value is set as
+ minimum size to part.
+
+ ]]
+ values {
+ size: double; [[Value between 0.0 and 1.0 representing size proportion of first part's minimum size.]]
+ }
+ }
}
implements {
}
diff --git a/src/lib/elementary/efl_ui_panes_private.h b/src/lib/elementary/efl_ui_panes_private.h
index b2242c7fcf..69e06246b0 100644
--- a/src/lib/elementary/efl_ui_panes_private.h
+++ b/src/lib/elementary/efl_ui_panes_private.h
@@ -39,6 +39,8 @@ struct _Efl_Ui_Panes_Data
double right_min_relative_size;
int first_minw, first_minh;
int second_minw, second_minh;
+ double first_min_split_ratio, second_min_split_ratio;
+
Evas_Coord left_min_size;
Evas_Coord right_min_size;
Eina_Bool double_clicked : 1;
diff --git a/src/lib/elementary/elm_panes_legacy.h b/src/lib/elementary/elm_panes_legacy.h
index 36502a1fac..251c6ff5b3 100644
--- a/src/lib/elementary/elm_panes_legacy.h
+++ b/src/lib/elementary/elm_panes_legacy.h
@@ -89,4 +89,143 @@ EAPI void elm_panes_content_right_min_size_set(Evas_Object *obj, int size);
*/
EAPI int elm_panes_content_right_min_size_get(const Evas_Object *obj);
+/**
+ * @brief Set the size proportion of panes widget's right side.
+ *
+ * By default it's homogeneous, i.e., both sides have the same size.
+ *
+ * If something different is required, it can be set with this function. For
+ * example, if the right content should be displayed over 75% of the panes
+ * size, @c size should be passed as 0.75. This way, left content will be
+ * resized to 25% of panes size.
+ *
+ * If displayed vertically, left content is displayed at top, and right content
+ * at bottom.
+ *
+ * @note This proportion will change when user drags the panes bar.
+ *
+ * @param[in] size Value between 0.0 and 1.0 representing size proportion of
+ * right side.
+ *
+ * @ingroup Efl_Ui_Panes
+ */
+EAPI void elm_panes_content_right_size_set(Evas_Object *obj, double size);
+
+/**
+ * @brief Set the size proportion of panes widget's right side.
+ *
+ * By default it's homogeneous, i.e., both sides have the same size.
+ *
+ * If something different is required, it can be set with this function. For
+ * example, if the right content should be displayed over 75% of the panes
+ * size, @c size should be passed as 0.75. This way, left content will be
+ * resized to 25% of panes size.
+ *
+ * If displayed vertically, left content is displayed at top, and right content
+ * at bottom.
+ *
+ * @note This proportion will change when user drags the panes bar.
+ *
+ * @return Value between 0.0 and 1.0 representing size proportion of right
+ * side.
+ *
+ * @ingroup Efl_Ui_Panes
+ */
+EAPI double elm_panes_content_right_size_get(const Evas_Object *obj);
+
+/**
+ * @brief Set the size proportion of panes widget's left side.
+ *
+ * By default it's homogeneous, i.e., both sides have the same size.
+ *
+ * If something different is required, it can be set with this function. For
+ * example, if the left content should be displayed over 75% of the panes size,
+ * @c size should be passed as 0.75. This way, right content will be resized to
+ * 25% of panes size.
+ *
+ * If displayed vertically, left content is displayed at top, and right content
+ * at bottom.
+ *
+ * @note This proportion will change when user drags the panes bar.
+ *
+ * @param[in] size Value between 0.0 and 1.0 representing size proportion of
+ * left side.
+ *
+ * @ingroup Efl_Ui_Panes
+ */
+EAPI void elm_panes_content_left_size_set(Evas_Object *obj, double size);
+
+/**
+ * @brief Set the size proportion of panes widget's left side.
+ *
+ * By default it's homogeneous, i.e., both sides have the same size.
+ *
+ * If something different is required, it can be set with this function. For
+ * example, if the left content should be displayed over 75% of the panes size,
+ * @c size should be passed as 0.75. This way, right content will be resized to
+ * 25% of panes size.
+ *
+ * If displayed vertically, left content is displayed at top, and right content
+ * at bottom.
+ *
+ * @note This proportion will change when user drags the panes bar.
+ *
+ * @return Value between 0.0 and 1.0 representing size proportion of left side.
+ *
+ * @ingroup Efl_Ui_Panes
+ */
+EAPI double elm_panes_content_left_size_get(const Evas_Object *obj);
+
+/**
+ * @brief Controls the relative minimum size of panes widget's left side.
+ *
+ * proportion of minimum size of left side.
+ *
+ * @note If displayed vertically, left content is displayed at top.
+ *
+ * @param[in] size Value between 0.0 and 1.0 representing size proportion of
+ * minimum size of left side.
+ *
+ * @ingroup Efl_Ui_Panes
+ */
+EAPI void elm_panes_content_left_min_relative_size_set(Evas_Object *obj, double size);
+
+/**
+ * @brief Controls the relative minimum size of panes widget's left side.
+ *
+ * proportion of minimum size of left side.
+ *
+ * @note If displayed vertically, left content is displayed at top.
+ *
+ * @return Value between 0.0 and 1.0 representing size proportion of minimum
+ * size of left side.
+ *
+ * @ingroup Efl_Ui_Panes
+ */
+EAPI double elm_panes_content_left_min_relative_size_get(const Evas_Object *obj);
+
+/**
+ * @brief Set the relative minimum size of panes widget's right side.
+ *
+ * @note If displayed vertically, right content is displayed at bottom.
+ *
+ * @param[in] size Value between 0.0 and 1.0 representing size proportion of
+ * minimum size of right side.
+ *
+ * @ingroup Efl_Ui_Panes
+ */
+EAPI void elm_panes_content_right_min_relative_size_set(Evas_Object *obj, double size);
+
+/**
+ * @brief Set the relative minimum size of panes widget's right side.
+ *
+ * @note If displayed vertically, right content is displayed at bottom.
+ *
+ * @return Value between 0.0 and 1.0 representing size proportion of minimum
+ * size of right side.
+ *
+ * @ingroup Efl_Ui_Panes
+ */
+EAPI double elm_panes_content_right_min_relative_size_get(const Evas_Object *obj);
+
#include "efl_ui_panes.eo.legacy.h"