From 58de55418a57e9b65b4fa1dfea4217a525d1285f Mon Sep 17 00:00:00 2001 From: Amitesh Singh Date: Wed, 2 Aug 2017 10:34:34 +0900 Subject: Efl.Ui.Panes: implement panes internal part. --- src/Makefile_Elementary.am | 1 + src/lib/elementary/efl_ui_panes.c | 128 +++++++++++++++++------ src/lib/elementary/efl_ui_panes.eo | 25 +---- src/lib/elementary/efl_ui_panes_internal_part.eo | 8 ++ src/lib/elementary/efl_ui_panes_private.h | 2 + src/lib/elementary/elm_panes_legacy.h | 44 ++++++++ 6 files changed, 154 insertions(+), 54 deletions(-) create mode 100644 src/lib/elementary/efl_ui_panes_internal_part.eo diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am index eb90c53541..16f5e8abd9 100644 --- a/src/Makefile_Elementary.am +++ b/src/Makefile_Elementary.am @@ -95,6 +95,7 @@ elm_public_eolian_files = \ lib/elementary/efl_ui_layout_internal_box.eo \ lib/elementary/efl_ui_layout_internal_table.eo \ lib/elementary/efl_ui_button_internal_part.eo \ + lib/elementary/efl_ui_panes_internal_part.eo \ lib/elementary/elm_ctxpopup_internal_part.eo \ lib/elementary/elm_dayselector_internal_part.eo \ lib/elementary/elm_entry_internal_part.eo \ diff --git a/src/lib/elementary/efl_ui_panes.c b/src/lib/elementary/efl_ui_panes.c index c7a7792cf9..83bbdcdf33 100644 --- a/src/lib/elementary/efl_ui_panes.c +++ b/src/lib/elementary/efl_ui_panes.c @@ -11,6 +11,9 @@ #include "elm_widget_layout.h" #include "efl_ui_panes_private.h" +#include "efl_ui_panes_internal_part.eo.h" +#include "elm_part_helper.h" + #define MY_CLASS EFL_UI_PANES_CLASS #define MY_CLASS_NAME "Efl.Ui.Panes" @@ -510,36 +513,6 @@ _efl_ui_panes_content_right_min_relative_size_get(Eo *obj EINA_UNUSED, Efl_Ui_Pa return _pd->right_min_relative_size; } -EOLIAN static void -_efl_ui_panes_content_left_min_size_set(Eo *obj, Efl_Ui_Panes_Data *_pd, Evas_Coord size) -{ - _pd->left_min_size = size; - if (_pd->left_min_size < 0) _pd->left_min_size = 0; - _pd->left_min_size_is_relative = EINA_FALSE; - _update_fixed_sides(obj); -} - -EOLIAN static Evas_Coord -_efl_ui_panes_content_left_min_size_get(Eo *obj EINA_UNUSED, Efl_Ui_Panes_Data *_pd) -{ - return _pd->left_min_size; -} - -EOLIAN static void -_efl_ui_panes_content_right_min_size_set(Eo *obj, Efl_Ui_Panes_Data *_pd, Evas_Coord size) -{ - _pd->right_min_size = size; - if (_pd->right_min_size < 0) _pd->right_min_size = 0; - _pd->right_min_size_is_relative = EINA_FALSE; - _update_fixed_sides(obj); -} - -EOLIAN static Evas_Coord -_efl_ui_panes_content_right_min_size_get(Eo *obj EINA_UNUSED, Efl_Ui_Panes_Data *_pd) -{ - return _pd->right_min_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) { @@ -563,4 +536,99 @@ _efl_ui_panes_class_constructor(Efl_Class *klass) #define EFL_UI_PANES_EXTRA_OPS \ EFL_CANVAS_GROUP_ADD_OPS(efl_ui_panes) +/* Efl.Part begin */ + +ELM_PART_OVERRIDE(efl_ui_panes, EFL_UI_PANES, ELM_LAYOUT, Efl_Ui_Panes_Data, Elm_Part_Data) + +EOLIAN void +_efl_ui_panes_internal_part_efl_gfx_size_hint_min_set(Eo *obj, Elm_Part_Data *_pd EINA_UNUSED, int w, int h) +{ + 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, "left")) + { + sd->first_minw = w; + sd->first_minh = h; + + if (sd->orientation == EFL_ORIENT_HORIZONTAL) + { + sd->left_min_size = h; + } + else + { + sd->left_min_size = w; + } + if (sd->left_min_size < 0) sd->left_min_size = 0; + sd->left_min_relative_size = EINA_FALSE; + } + else if (!strcmp(pd->part, "right")) + { + sd->second_minw = w; + sd->second_minh = h; + + if (sd->orientation == EFL_ORIENT_HORIZONTAL) + { + sd->right_min_size = h; + } + else + { + sd->right_min_size = w; + } + if (sd->right_min_size < 0) sd->right_min_size = 0; + sd->right_min_size_is_relative = EINA_FALSE; + } + _update_fixed_sides(pd->obj); +} + +EOLIAN void +_efl_ui_panes_internal_part_efl_gfx_size_hint_min_get(Eo *obj, Elm_Part_Data *_pd EINA_UNUSED, int *w, int *h) +{ + 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, "left")) + { + if (w) *w = sd->first_minw; + if (h) *h = sd->first_minh; + } + else if (!strcmp(pd->part, "right")) + { + if (w) *w = sd->second_minw; + if (h) *h = sd->second_minh; + } +} + +#include "efl_ui_panes_internal_part.eo.h" +/* Efl.Part end */ + +/* Legacy APIs */ +void +elm_panes_content_left_min_size_set(Evas_Object *obj, int size) +{ + efl_gfx_size_hint_min_set(efl_part(obj, "left"), size, size); +} + +int +elm_panes_content_left_min_size_get(const Evas_Object *obj) +{ + EFL_UI_PANES_DATA_GET_OR_RETURN_VAL(obj, sd, -1); + return sd->left_min_size; +} + +void +elm_panes_content_right_min_size_set(Evas_Object *obj, int size) +{ + efl_gfx_size_hint_min_set(efl_part(obj, "right"), size, size); +} + +int +elm_panes_content_right_min_size_get(const Evas_Object *obj) +{ + EFL_UI_PANES_DATA_GET_OR_RETURN_VAL(obj, sd, -1); + return sd->right_min_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 07ce977d4b..8ea80dab9b 100644 --- a/src/lib/elementary/efl_ui_panes.eo +++ b/src/lib/elementary/efl_ui_panes.eo @@ -89,30 +89,6 @@ class Efl.Ui.Panes (Elm.Layout, Efl.Orientation, size: double; [[Value between 0.0 and 1.0 representing size proportion of minimum size of right side.]] } } - @property content_left_min_size { - [[Set the absolute minimum size of panes widget's left side. - - Note: If displayed vertically, left content is displayed at top.]] - set { - } - get { - } - values { - size: int; [[Value representing minimum size of left side in pixels.]] - } - } - @property content_right_min_size { - [[Control the absolute minimum size of panes widget's right side. - - Note: If displayed vertically, right content is displayed at bottom.]] - set { - } - get { - } - values { - size: int; [[Value representing minimum size of right side in pixels.]] - } - } } implements { class.constructor; @@ -122,6 +98,7 @@ class Efl.Ui.Panes (Elm.Layout, Efl.Orientation, Elm.Widget.theme_apply; Elm.Layout.content_aliases { get; } Efl.Orientation.orientation { get; set; } + Efl.Part.part; } events { press; [[Called when panes got pressed]] diff --git a/src/lib/elementary/efl_ui_panes_internal_part.eo b/src/lib/elementary/efl_ui_panes_internal_part.eo new file mode 100644 index 0000000000..84f974c484 --- /dev/null +++ b/src/lib/elementary/efl_ui_panes_internal_part.eo @@ -0,0 +1,8 @@ +class Efl.Ui.Panes.Internal.Part (Elm.Layout.Internal.Part, Efl.Gfx.Size.Hint) +{ + [[Elementary Panes internal part class]] + data: Elm_Part_Data; + implements { + Efl.Gfx.Size.Hint.hint_min { set; get; } + } +} diff --git a/src/lib/elementary/efl_ui_panes_private.h b/src/lib/elementary/efl_ui_panes_private.h index d82bdc48a4..f8822f4cd6 100644 --- a/src/lib/elementary/efl_ui_panes_private.h +++ b/src/lib/elementary/efl_ui_panes_private.h @@ -37,6 +37,8 @@ struct _Efl_Ui_Panes_Data Efl_Orient orientation; double left_min_relative_size; double right_min_relative_size; + int first_minw, first_minh; + int second_minw, second_minh; 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 3ebf8b7f5b..2febd31ab2 100644 --- a/src/lib/elementary/elm_panes_legacy.h +++ b/src/lib/elementary/elm_panes_legacy.h @@ -45,4 +45,48 @@ EAPI void elm_panes_horizontal_set(Evas_Object *obj, Eina_Bool horizontal); */ EAPI Eina_Bool elm_panes_horizontal_get(const Evas_Object *obj); +/** + * @brief Set the absolute minimum size of panes widget's left side. + * + * @note If displayed vertically, left content is displayed at top. + * + * @param[in] size Value representing minimum size of left side in pixels. + * + * @ingroup Elm_Panes + */ +EAPI void elm_panes_content_left_min_size_set(Evas_Object *obj, int size); + +/** + * @brief Set the absolute minimum size of panes widget's left side. + * + * @note If displayed vertically, left content is displayed at top. + * + * @return Value representing minimum size of left side in pixels. + * + * @ingroup Elm_Panes + */ +EAPI int elm_panes_content_left_min_size_get(const Evas_Object *obj); + +/** + * @brief Control the absolute minimum size of panes widget's right side. + * + * @note If displayed vertically, right content is displayed at bottom. + * + * @param[in] size Value representing minimum size of right side in pixels. + * + * @ingroup Elm_Panes + */ +EAPI void elm_panes_content_right_min_size_set(Evas_Object *obj, int size); + +/** + * @brief Control the absolute minimum size of panes widget's right side. + * + * @note If displayed vertically, right content is displayed at bottom. + * + * @return Value representing minimum size of right side in pixels. + * + * @ingroup Elm_Panes + */ +EAPI int elm_panes_content_right_min_size_get(const Evas_Object *obj); + #include "efl_ui_panes.eo.legacy.h" -- cgit v1.2.1