summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2021-04-18 00:57:00 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2021-04-18 00:59:09 +0100
commit7c16765e1be277ec47698f2b12a6856ea8d2a700 (patch)
tree430de6be841c8defb0148fe12fe4a2e3f42cee34 /src
parent6a657acf13ac6ec48fafb132ee536a8ee3ec8925 (diff)
elm frame - add more styles (icon, border and overlay variants)
this shoulpd have been day 0, but now add new styles that add an elm.swallow.icon spot for an icon in the frame and a style that looks like a border (also with icon as borders have them) and a close button too. overlay variants are for overlaying so might be semi-transparent
Diffstat (limited to 'src')
-rw-r--r--src/bin/elementary/test_scaling.c44
-rw-r--r--src/lib/elementary/efl_ui_frame.c12
-rw-r--r--src/lib/elementary/elm_frame.h1
3 files changed, 57 insertions, 0 deletions
diff --git a/src/bin/elementary/test_scaling.c b/src/bin/elementary/test_scaling.c
index 84b20c6130..d616fe12fb 100644
--- a/src/bin/elementary/test_scaling.c
+++ b/src/bin/elementary/test_scaling.c
@@ -89,6 +89,21 @@ test_scaling2(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_
89 evas_object_show(fr); 89 evas_object_show(fr);
90 90
91 fr = elm_frame_add(win); 91 fr = elm_frame_add(win);
92 elm_object_style_set(fr, "icon");
93 elm_object_text_set(fr, "Scale: 0.75");
94 lb = elm_label_add(win);
95 elm_object_text_set(lb,
96 "Parent frame scale<br/>"
97 "is 0.75. Child should<br/>"
98 "inherit it.");
99 elm_object_content_set(fr, lb);
100 elm_object_scale_set(fr, 0.75);
101 evas_object_show(lb);
102 elm_box_pack_end(bx, fr);
103 evas_object_show(fr);
104
105 fr = elm_frame_add(win);
106 elm_object_style_set(fr, "border");
92 elm_object_text_set(fr, "Scale: 1.0"); 107 elm_object_text_set(fr, "Scale: 1.0");
93 lb = elm_label_add(win); 108 lb = elm_label_add(win);
94 elm_object_text_set(lb, 109 elm_object_text_set(lb,
@@ -102,6 +117,21 @@ test_scaling2(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_
102 evas_object_show(fr); 117 evas_object_show(fr);
103 118
104 fr = elm_frame_add(win); 119 fr = elm_frame_add(win);
120 elm_object_style_set(fr, "overlay");
121 elm_object_text_set(fr, "Scale: 1.5");
122 lb = elm_label_add(win);
123 elm_object_text_set(lb,
124 "Parent frame scale<br/>"
125 "is 1.5. Child should<br/>"
126 "inherit it.");
127 elm_object_content_set(fr, lb);
128 evas_object_show(lb);
129 elm_object_scale_set(fr, 1.5);
130 elm_box_pack_end(bx, fr);
131 evas_object_show(fr);
132
133 fr = elm_frame_add(win);
134 elm_object_style_set(fr, "icon_overlay");
105 elm_object_text_set(fr, "Scale: 2.0"); 135 elm_object_text_set(fr, "Scale: 2.0");
106 lb = elm_label_add(win); 136 lb = elm_label_add(win);
107 elm_object_text_set(lb, 137 elm_object_text_set(lb,
@@ -114,6 +144,20 @@ test_scaling2(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_
114 elm_box_pack_end(bx, fr); 144 elm_box_pack_end(bx, fr);
115 evas_object_show(fr); 145 evas_object_show(fr);
116 146
147 fr = elm_frame_add(win);
148 elm_object_style_set(fr, "border_overlay");
149 elm_object_text_set(fr, "Scale: 3.0");
150 lb = elm_label_add(win);
151 elm_object_text_set(lb,
152 "Parent frame scale<br/>"
153 "is 3.0. Child should<br/>"
154 "inherit it.");
155 elm_object_content_set(fr, lb);
156 evas_object_show(lb);
157 elm_object_scale_set(fr, 3.0);
158 elm_box_pack_end(bx, fr);
159 evas_object_show(fr);
160
117 evas_object_resize(win, 320, 320); 161 evas_object_resize(win, 320, 320);
118 evas_object_show(win); 162 evas_object_show(win);
119} 163}
diff --git a/src/lib/elementary/efl_ui_frame.c b/src/lib/elementary/efl_ui_frame.c
index 0e6f230d5b..c7ac5c2232 100644
--- a/src/lib/elementary/efl_ui_frame.c
+++ b/src/lib/elementary/efl_ui_frame.c
@@ -94,6 +94,15 @@ _on_frame_clicked(void *data,
94 evas_object_smart_callback_call(data, "clicked", NULL); 94 evas_object_smart_callback_call(data, "clicked", NULL);
95} 95}
96 96
97static void
98_on_frame_close(void *data,
99 Evas_Object *obj EINA_UNUSED,
100 const char *sig EINA_UNUSED,
101 const char *src EINA_UNUSED)
102{
103 evas_object_smart_callback_call(data, "close", NULL);
104}
105
97/* using deferred sizing evaluation, just like the parent */ 106/* using deferred sizing evaluation, just like the parent */
98EOLIAN static void 107EOLIAN static void
99_efl_ui_frame_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Frame_Data *sd) 108_efl_ui_frame_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Frame_Data *sd)
@@ -139,6 +148,9 @@ _efl_ui_frame_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Frame_Data *_pd EINA_UN
139 edje_object_signal_callback_add 148 edje_object_signal_callback_add
140 (wd->resize_obj, "elm,action,click", "elm", 149 (wd->resize_obj, "elm,action,click", "elm",
141 _on_frame_clicked, obj); 150 _on_frame_clicked, obj);
151 edje_object_signal_callback_add
152 (wd->resize_obj, "elm,action,close", "elm",
153 _on_frame_close, obj);
142 } 154 }
143 else 155 else
144 { 156 {
diff --git a/src/lib/elementary/elm_frame.h b/src/lib/elementary/elm_frame.h
index a5c3c921c0..f57ae667ba 100644
--- a/src/lib/elementary/elm_frame.h
+++ b/src/lib/elementary/elm_frame.h
@@ -29,6 +29,7 @@
29 * @ref Elm_Layout : 29 * @ref Elm_Layout :
30 * - @c "clicked" - The user has clicked the frame's label 30 * - @c "clicked" - The user has clicked the frame's label
31 * - @c "language,changed" - the program's language changed (since 1.9) 31 * - @c "language,changed" - the program's language changed (since 1.9)
32 * - @c "close" - The user has clicked the close button if there is one
32 * 33 *
33 * Default content parts of the frame widget that you can use for are: 34 * Default content parts of the frame widget that you can use for are:
34 * @li "default" - A content of the frame 35 * @li "default" - A content of the frame