forked from enlightenment/efl
Efl.Ui.Panes: rename left/right_size_set to split_ratio
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. This patch also implements min_split_ratio on parts. @feature refer T5359
This commit is contained in:
parent
aaaf1a282a
commit
599bb616ec
|
@ -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,
|
||||
|
|
|
@ -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",
|
||||
|
@ -484,14 +492,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;
|
||||
|
@ -499,31 +505,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
|
||||
|
@ -600,36 +592,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)
|
||||
{
|
||||
|
@ -685,6 +647,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, EFL_UI_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, EFL_UI_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"
|
||||
|
|
|
@ -5,26 +5,28 @@ class Efl.Ui.Panes (Efl.Ui.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.
|
||||
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, left content is displayed at top, and
|
||||
right content at bottom.
|
||||
If displayed vertically, first content is displayed at top, and
|
||||
second content at bottom.
|
||||
|
||||
Note: This proportion will change when user drags the panes bar.]]
|
||||
set {
|
||||
}
|
||||
get {
|
||||
}
|
||||
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 (Efl.Ui.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;
|
||||
|
|
|
@ -11,6 +11,17 @@ class Efl.Ui.Panes.Internal.Part (Efl.Ui.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 {
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue