summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmitesh Singh <amitesh.sh@samsung.com>2017-08-09 10:49:21 +0900
committerAmitesh Singh <amitesh.sh@samsung.com>2017-08-10 15:15:50 +0900
commitaaaf1a282a82f2f10b01f561ea210d5643707a1a (patch)
treeda6b5e00cb6b9942615c4521e53480344db8fcba
parent0ca98280d4b041e277d071ecfbcbc77db2eaa7cd (diff)
Efl.Ui.Panes: implement allow_user_size_hints on parts
This allows user to set size hints to be respected and request panes to ignore combined min size. If this flag is set, the minimum size set by efl_gfx_size_hint_min_set() is respected forcefully. @feature refer T5359
-rw-r--r--src/Makefile_Elementary.am1
-rw-r--r--src/bin/elementary/test_panes.c6
-rw-r--r--src/lib/elementary/efl_ui_panes.c150
-rw-r--r--src/lib/elementary/efl_ui_panes.eo25
-rw-r--r--src/lib/elementary/efl_ui_panes_internal_part.eo18
-rw-r--r--src/lib/elementary/efl_ui_panes_private.h3
-rw-r--r--src/lib/elementary/elm_panes.h1
-rw-r--r--src/lib/elementary/elm_panes_legacy.h44
8 files changed, 183 insertions, 65 deletions
diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am
index ea7ef0603d..be81e9bf54 100644
--- a/src/Makefile_Elementary.am
+++ b/src/Makefile_Elementary.am
@@ -97,6 +97,7 @@ elm_public_eolian_files = \
97 lib/elementary/efl_ui_layout_internal_table.eo \ 97 lib/elementary/efl_ui_layout_internal_table.eo \
98 lib/elementary/efl_ui_button_internal_part.eo \ 98 lib/elementary/efl_ui_button_internal_part.eo \
99 lib/elementary/elm_ctxpopup_internal_part.eo \ 99 lib/elementary/elm_ctxpopup_internal_part.eo \
100 lib/elementary/efl_ui_panes_internal_part.eo \
100 lib/elementary/elm_dayselector_internal_part.eo \ 101 lib/elementary/elm_dayselector_internal_part.eo \
101 lib/elementary/elm_entry_internal_part.eo \ 102 lib/elementary/elm_entry_internal_part.eo \
102 lib/elementary/elm_fileselector_entry_internal_part.eo \ 103 lib/elementary/elm_fileselector_entry_internal_part.eo \
diff --git a/src/bin/elementary/test_panes.c b/src/bin/elementary/test_panes.c
index da7255c15b..bf772dcc54 100644
--- a/src/bin/elementary/test_panes.c
+++ b/src/bin/elementary/test_panes.c
@@ -121,7 +121,7 @@ test_panes_minsize(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *e
121 ); 121 );
122 122
123 efl_add(EFL_UI_BUTTON_CLASS, win, 123 efl_add(EFL_UI_BUTTON_CLASS, win,
124 efl_text_set(efl_added, "Left - min size 110, 110"), 124 efl_text_set(efl_added, "Left - combined min size 110, 110"),
125 efl_gfx_size_hint_min_set(efl_added, 110, 110), 125 efl_gfx_size_hint_min_set(efl_added, 110, 110),
126 efl_content_set(efl_part(panes, "first"), efl_added) 126 efl_content_set(efl_part(panes, "first"), efl_added)
127 ); 127 );
@@ -131,9 +131,11 @@ test_panes_minsize(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *e
131 efl_content_set(efl_part(panes, "second"), efl_added) 131 efl_content_set(efl_part(panes, "second"), efl_added)
132 ); 132 );
133 efl_add(EFL_UI_BUTTON_CLASS, win, 133 efl_add(EFL_UI_BUTTON_CLASS, win,
134 efl_text_set(efl_added, "Up - no min size"), 134 efl_text_set(efl_added, "Up - user set min size"),
135 efl_gfx_size_hint_min_set(efl_added, 10, 0),
135 efl_content_set(efl_part(panes_h, "first"), efl_added) 136 efl_content_set(efl_part(panes_h, "first"), efl_added)
136 ); 137 );
138 efl_ui_panes_internal_part_allow_user_size_hints_set(efl_part(panes_h, "first"), EINA_TRUE);
137 139
138 efl_add(EFL_UI_BUTTON_CLASS, win, 140 efl_add(EFL_UI_BUTTON_CLASS, win,
139 efl_text_set(efl_added, "Down - min size 50 40"), 141 efl_text_set(efl_added, "Down - min size 50 40"),
diff --git a/src/lib/elementary/efl_ui_panes.c b/src/lib/elementary/efl_ui_panes.c
index 3e7954fcfd..fa9d706eef 100644
--- a/src/lib/elementary/efl_ui_panes.c
+++ b/src/lib/elementary/efl_ui_panes.c
@@ -11,6 +11,9 @@
11#include "elm_widget_layout.h" 11#include "elm_widget_layout.h"
12#include "efl_ui_panes_private.h" 12#include "efl_ui_panes_private.h"
13 13
14#include "efl_ui_panes_internal_part.eo.h"
15#include "elm_part_helper.h"
16
14#define MY_CLASS EFL_UI_PANES_CLASS 17#define MY_CLASS EFL_UI_PANES_CLASS
15#define MY_CLASS_PFX efl_ui_panes 18#define MY_CLASS_PFX efl_ui_panes
16 19
@@ -187,13 +190,20 @@ _efl_ui_panes_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Panes_Data *sd)
187 second_content = efl_content_get(efl_part(obj, "second")); 190 second_content = efl_content_get(efl_part(obj, "second"));
188 191
189 if (first_content) 192 if (first_content)
190 efl_gfx_size_hint_combined_min_get(first_content, &sd->first_minw, &sd->first_minh); 193 {
191 //TODO: use this for allow cropping? 194 if (!sd->first_allow_user_hints)
192 //efl_gfx_size_hint_min_get(first_content, &sd->first_minw, &sd->first_minh); 195 efl_gfx_size_hint_combined_min_get(first_content, &sd->first_minw, &sd->first_minh);
196 else
197 efl_gfx_size_hint_min_get(first_content, &sd->first_minw, &sd->first_minh);
198 }
199
193 if (second_content) 200 if (second_content)
194 efl_gfx_size_hint_combined_min_get(second_content, &sd->second_minw, &sd->second_minh); 201 {
195 //TODO: use this for allow cropping 202 if (!sd->second_allow_user_hints)
196 //efl_gfx_size_hint_min_get(second_content, &sd->second_minw, &sd->second_minh); 203 efl_gfx_size_hint_combined_min_get(second_content, &sd->second_minw, &sd->second_minh);
204 else
205 efl_gfx_size_hint_min_get(second_content, &sd->second_minw, &sd->second_minh);
206 }
197 207
198 if (sd->orientation == EFL_ORIENT_HORIZONTAL) 208 if (sd->orientation == EFL_ORIENT_HORIZONTAL)
199 { 209 {
@@ -298,7 +308,6 @@ _set_min_size(void *data)
298 } 308 }
299} 309}
300 310
301//TODO: call this in legacy api implementation
302static void 311static void
303_update_fixed_sides(void *data) 312_update_fixed_sides(void *data)
304{ 313{
@@ -348,9 +357,10 @@ _on_resize(void *data,
348 Evas_Object *obj EINA_UNUSED, 357 Evas_Object *obj EINA_UNUSED,
349 void *event_info EINA_UNUSED) 358 void *event_info EINA_UNUSED)
350{ 359{
351 //TODO: needs a flag to enable the old behaviour 360 EFL_UI_PANES_DATA_GET(data, sd);
352 //_update_fixed_sides(data); 361
353 _set_min_size_new(data); 362 if (sd->legacy_use) _update_fixed_sides(data);
363 else _set_min_size_new(data);
354} 364}
355 365
356EOLIAN static void 366EOLIAN static void
@@ -390,7 +400,8 @@ _efl_ui_panes_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Panes_Data *_pd EINA_UN
390 sd->left_min_size = 0; 400 sd->left_min_size = 0;
391 sd->right_min_relative_size = 0; 401 sd->right_min_relative_size = 0;
392 sd->left_min_relative_size = 0; 402 sd->left_min_relative_size = 0;
393 _update_fixed_sides(obj); 403 if (sd->legacy_use) _update_fixed_sides(obj);
404 else _set_min_size_new(obj);
394 405
395 elm_widget_can_focus_set(obj, EINA_FALSE); 406 elm_widget_can_focus_set(obj, EINA_FALSE);
396 407
@@ -415,7 +426,12 @@ EAPI Evas_Object *
415elm_panes_add(Evas_Object *parent) 426elm_panes_add(Evas_Object *parent)
416{ 427{
417 EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); 428 EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
418 return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); 429 Evas_Object *obj = efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added));
430 EFL_UI_PANES_DATA_GET(obj, sd);
431
432 sd->legacy_use = EINA_TRUE;
433
434 return obj;
419} 435}
420 436
421EOLIAN static Eo * 437EOLIAN static Eo *
@@ -520,7 +536,8 @@ _efl_ui_panes_efl_orientation_orientation_set(Eo *obj, Efl_Ui_Panes_Data *sd, Ef
520 536
521 sd->orientation = dir; 537 sd->orientation = dir;
522 elm_obj_widget_theme_apply(obj); 538 elm_obj_widget_theme_apply(obj);
523 _update_fixed_sides(obj); 539 if (sd->legacy_use) _update_fixed_sides(obj);
540 else _set_min_size_new(obj);
524 541
525 elm_panes_content_left_size_set(obj, size); 542 elm_panes_content_left_size_set(obj, size);
526} 543}
@@ -613,48 +630,65 @@ _efl_ui_panes_content_right_min_relative_size_get(Eo *obj EINA_UNUSED, Efl_Ui_Pa
613 return _pd->right_min_relative_size; 630 return _pd->right_min_relative_size;
614} 631}
615 632
616EOLIAN static void 633EOLIAN static Eina_Bool
617_efl_ui_panes_content_left_min_size_set(Eo *obj, Efl_Ui_Panes_Data *_pd, Evas_Coord size) 634_efl_ui_panes_elm_widget_focus_next_manager_is(Eo *obj EINA_UNUSED, Efl_Ui_Panes_Data *_pd EINA_UNUSED)
618{ 635{
619 _pd->left_min_size = size; 636 return EINA_TRUE;
620 if (_pd->left_min_size < 0) _pd->left_min_size = 0;
621 _pd->left_min_size_is_relative = EINA_FALSE;
622 _update_fixed_sides(obj);
623} 637}
624 638
625EOLIAN static Evas_Coord 639static void
626_efl_ui_panes_content_left_min_size_get(Eo *obj EINA_UNUSED, Efl_Ui_Panes_Data *_pd) 640_efl_ui_panes_class_constructor(Efl_Class *klass)
627{ 641{
628 return _pd->left_min_size; 642 evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
629} 643}
630 644
645/* Efl.Part begin */
646
647ELM_PART_OVERRIDE(efl_ui_panes, EFL_UI_PANES, EFL_UI_LAYOUT, Efl_Ui_Panes_Data, Elm_Part_Data)
648
631EOLIAN static void 649EOLIAN static void
632_efl_ui_panes_content_right_min_size_set(Eo *obj, Efl_Ui_Panes_Data *_pd, Evas_Coord size) 650_efl_ui_panes_internal_part_allow_user_size_hints_set(Eo *obj, Elm_Part_Data *_pd EINA_UNUSED, Eina_Bool allow)
633{ 651{
634 _pd->right_min_size = size; 652 Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_LAYOUT_INTERNAL_PART_CLASS);
635 if (_pd->right_min_size < 0) _pd->right_min_size = 0; 653 Efl_Ui_Panes_Data *sd = efl_data_scope_get(pd->obj, EFL_UI_PANES_CLASS);
636 _pd->right_min_size_is_relative = EINA_FALSE;
637 _update_fixed_sides(obj);
638}
639 654
640EOLIAN static Evas_Coord 655 if (!strcmp(pd->part, "first"))
641_efl_ui_panes_content_right_min_size_get(Eo *obj EINA_UNUSED, Efl_Ui_Panes_Data *_pd) 656 {
642{ 657 if (sd->first_allow_user_hints == allow) return;
643 return _pd->right_min_size; 658 sd->first_allow_user_hints = allow;
659 _set_min_size_new(pd->obj);
660 }
661 else if (!strcmp(pd->part, "second"))
662 {
663 if (sd->second_allow_user_hints == allow) return;
664 sd->second_allow_user_hints = allow;
665 _set_min_size_new(pd->obj);
666 }
644} 667}
645 668
646EOLIAN static Eina_Bool 669EOLIAN static Eina_Bool
647_efl_ui_panes_elm_widget_focus_next_manager_is(Eo *obj EINA_UNUSED, Efl_Ui_Panes_Data *_pd EINA_UNUSED) 670_efl_ui_panes_internal_part_allow_user_size_hints_get(Eo *obj, Elm_Part_Data *_pd EINA_UNUSED)
648{ 671{
649 return EINA_TRUE; 672 Eina_Bool ret = EINA_FALSE;
650} 673 Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_LAYOUT_INTERNAL_PART_CLASS);
674 Efl_Ui_Panes_Data *sd = efl_data_scope_get(pd->obj, EFL_UI_PANES_CLASS);
651 675
652static void 676 if (!strcmp(pd->part, "first"))
653_efl_ui_panes_class_constructor(Efl_Class *klass) 677 {
654{ 678 ret = sd->first_allow_user_hints;
655 evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass); 679 }
680 else if (!strcmp(pd->part, "second"))
681 {
682 ret = sd->second_allow_user_hints;
683 }
684
685 return ret;
656} 686}
657 687
688#include "efl_ui_panes_internal_part.eo.c"
689
690/* Efl.Part end */
691
658/* Internal EO APIs and hidden overrides */ 692/* Internal EO APIs and hidden overrides */
659 693
660ELM_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX); 694ELM_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX);
@@ -664,5 +698,43 @@ ELM_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX);
664 ELM_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX), \ 698 ELM_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX), \
665 ELM_LAYOUT_SIZING_EVAL_OPS(efl_ui_panes) 699 ELM_LAYOUT_SIZING_EVAL_OPS(efl_ui_panes)
666 700
701/* Legacy APIs */
702EAPI void
703elm_panes_content_left_min_size_set(Evas_Object *obj, int size)
704{
705 EFL_UI_PANES_DATA_GET(obj, sd);
706
707 sd->left_min_size = size;
708 if (sd->left_min_size < 0) sd->left_min_size = 0;
709 sd->left_min_size_is_relative = EINA_FALSE;
710 _update_fixed_sides(obj);
711}
712
713EAPI int
714elm_panes_content_left_min_size_get(const Evas_Object *obj)
715{
716 EFL_UI_PANES_DATA_GET(obj, sd);
717 return sd->left_min_size;
718}
719
720EAPI void
721elm_panes_content_right_min_size_set(Evas_Object *obj, int size)
722{
723 EFL_UI_PANES_DATA_GET(obj, sd);
724
725 sd->right_min_size = size;
726 if (sd->right_min_size < 0) sd->right_min_size = 0;
727 sd->right_min_size_is_relative = EINA_FALSE;
728 _update_fixed_sides(obj);
729}
730
731EAPI int
732elm_panes_content_right_min_size_get(const Evas_Object *obj)
733{
734 EFL_UI_PANES_DATA_GET(obj, sd);
735 return sd->right_min_size;
736}
737
738/* Legacy APIs end */
667 739
668#include "efl_ui_panes.eo.c" 740#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 fa92db06d6..6c1300868e 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 (Efl.Ui.Layout, Efl.Orientation,
89 size: double; [[Value between 0.0 and 1.0 representing size proportion of minimum size of right side.]] 89 size: double; [[Value between 0.0 and 1.0 representing size proportion of minimum size of right side.]]
90 } 90 }
91 } 91 }
92 @property content_left_min_size {
93 [[Set the absolute minimum size of panes widget's left side.
94
95 Note: If displayed vertically, left content is displayed at top.]]
96 set {
97 }
98 get {
99 }
100 values {
101 size: int; [[Value representing minimum size of left side in pixels.]]
102 }
103 }
104 @property content_right_min_size {
105 [[Control the absolute minimum size of panes widget's right side.
106
107 Note: If displayed vertically, right content is displayed at bottom.]]
108 set {
109 }
110 get {
111 }
112 values {
113 size: int; [[Value representing minimum size of right side in pixels.]]
114 }
115 }
116 } 92 }
117 implements { 93 implements {
118 class.constructor; 94 class.constructor;
@@ -121,6 +97,7 @@ class Efl.Ui.Panes (Efl.Ui.Layout, Efl.Orientation,
121 Elm.Widget.focus_next; 97 Elm.Widget.focus_next;
122 Elm.Widget.theme_apply; 98 Elm.Widget.theme_apply;
123 Efl.Orientation.orientation { get; set; } 99 Efl.Orientation.orientation { get; set; }
100 Efl.Part.part;
124 } 101 }
125 events { 102 events {
126 press; [[Called when panes got pressed]] 103 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..320d51e3d4
--- /dev/null
+++ b/src/lib/elementary/efl_ui_panes_internal_part.eo
@@ -0,0 +1,18 @@
1class Efl.Ui.Panes.Internal.Part (Efl.Ui.Layout.Internal.Part)
2{
3 [[Elementary Panes internal part class]]
4 data: Elm_Part_Data;
5 methods {
6 @property allow_user_size_hints {
7 [[allow user to set size hints to be respected and ignore combined min size.
8 If this flag is set, the minimum size set by @Efl.Gfx.Size.Hint.hint_min.set is respected forcefully.
9 ]]
10 values {
11 allow: bool;
12 }
13 }
14 }
15 implements {
16 }
17}
18
diff --git a/src/lib/elementary/efl_ui_panes_private.h b/src/lib/elementary/efl_ui_panes_private.h
index f8822f4cd6..b2242c7fcf 100644
--- a/src/lib/elementary/efl_ui_panes_private.h
+++ b/src/lib/elementary/efl_ui_panes_private.h
@@ -45,6 +45,9 @@ struct _Efl_Ui_Panes_Data
45 Eina_Bool fixed : 1; 45 Eina_Bool fixed : 1;
46 Eina_Bool left_min_size_is_relative : 1; 46 Eina_Bool left_min_size_is_relative : 1;
47 Eina_Bool right_min_size_is_relative : 1; 47 Eina_Bool right_min_size_is_relative : 1;
48 Eina_Bool first_allow_user_hints : 1;
49 Eina_Bool second_allow_user_hints : 1;
50 Eina_Bool legacy_use : 1;
48}; 51};
49 52
50/** 53/**
diff --git a/src/lib/elementary/elm_panes.h b/src/lib/elementary/elm_panes.h
index 1f5a6a81ae..02d0c03da4 100644
--- a/src/lib/elementary/elm_panes.h
+++ b/src/lib/elementary/elm_panes.h
@@ -56,6 +56,7 @@
56 56
57#ifdef EFL_EO_API_SUPPORT 57#ifdef EFL_EO_API_SUPPORT
58#include "efl_ui_panes_eo.h" 58#include "efl_ui_panes_eo.h"
59#include "efl_ui_panes_internal_part.eo.h"
59#endif 60#endif
60#ifndef EFL_NOLEGACY_API_SUPPORT 61#ifndef EFL_NOLEGACY_API_SUPPORT
61#include "elm_panes_legacy.h" 62#include "elm_panes_legacy.h"
diff --git a/src/lib/elementary/elm_panes_legacy.h b/src/lib/elementary/elm_panes_legacy.h
index 3ebf8b7f5b..36502a1fac 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);
45 */ 45 */
46EAPI Eina_Bool elm_panes_horizontal_get(const Evas_Object *obj); 46EAPI Eina_Bool elm_panes_horizontal_get(const Evas_Object *obj);
47 47
48/**
49 * @brief Set the absolute minimum size of panes widget's left side.
50 *
51 * @note If displayed vertically, left content is displayed at top.
52 *
53 * @param[in] size Value representing minimum size of left side in pixels.
54 *
55 * @ingroup Efl_Ui_Panes
56 */
57EAPI void elm_panes_content_left_min_size_set(Evas_Object *obj, int size);
58
59/**
60 * @brief Set the absolute minimum size of panes widget's left side.
61 *
62 * @note If displayed vertically, left content is displayed at top.
63 *
64 * @return Value representing minimum size of left side in pixels.
65 *
66 * @ingroup Efl_Ui_Panes
67 */
68EAPI int elm_panes_content_left_min_size_get(const Evas_Object *obj);
69
70/**
71 * @brief Control the absolute minimum size of panes widget's right side.
72 *
73 * @note If displayed vertically, right content is displayed at bottom.
74 *
75 * @param[in] size Value representing minimum size of right side in pixels.
76 *
77 * @ingroup Efl_Ui_Panes
78 */
79EAPI void elm_panes_content_right_min_size_set(Evas_Object *obj, int size);
80
81/**
82 * @brief Control the absolute minimum size of panes widget's right side.
83 *
84 * @note If displayed vertically, right content is displayed at bottom.
85 *
86 * @return Value representing minimum size of right side in pixels.
87 *
88 * @ingroup Efl_Ui_Panes
89 */
90EAPI int elm_panes_content_right_min_size_get(const Evas_Object *obj);
91
48#include "efl_ui_panes.eo.legacy.h" 92#include "efl_ui_panes.eo.legacy.h"