summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaeun Choi <jaeun12.choi@samsung.com>2014-06-26 14:33:41 +0900
committerJaeun Choi <jaeun12.choi@samsung.com>2014-06-26 14:33:41 +0900
commit1b6247fb1cea6cf9b8f857fb64cbe475a6866f09 (patch)
tree38652473f9c6fc53677a013cd693926ad9e93db3
parenta47eef78c4f8e41708d54ddea96fe7e7f5511df4 (diff)
Revert "panel: add scrollable feature"
This reverts commit a47eef78c4f8e41708d54ddea96fe7e7f5511df4. This will be added after second merge window opens.
-rw-r--r--data/themes/edc/elm/panel.edc381
-rw-r--r--src/bin/test.c2
-rw-r--r--src/bin/test_panel.c73
-rw-r--r--src/lib/elm_panel.c953
-rw-r--r--src/lib/elm_panel.eo29
-rw-r--r--src/lib/elm_panel.h3
-rw-r--r--src/lib/elm_panel_common.h6
-rw-r--r--src/lib/elm_widget_panel.h12
8 files changed, 27 insertions, 1432 deletions
diff --git a/data/themes/edc/elm/panel.edc b/data/themes/edc/elm/panel.edc
index 7a99dbb73..7dab212da 100644
--- a/data/themes/edc/elm/panel.edc
+++ b/data/themes/edc/elm/panel.edc
@@ -1,384 +1,3 @@
1group { name: "elm/scroller/panel/default";
2 data {
3 item: "handler_size" "30";
4 }
5 parts {
6 part { name: "elm.swallow.content";
7 type: SWALLOW;
8 description { state: "default" 0.0;
9 }
10 }
11 }
12}
13
14group { name: "elm/scroller/panel/left/default";
15 parts {
16 part { name: "panel_area";
17 type: SWALLOW;
18 description { state: "default" 0.0;
19 rel2.relative: 0.0 1.0;
20 align: 0.0 0.5;
21 fixed: 1 1;
22 visible: 0;
23 }
24 description { state: "visible" 0.0;
25 inherit: "default" 0.0;
26 visible: 1;
27 }
28 }
29 part { name: "event_area";
30 type: SWALLOW;
31 description { state: "default" 0.0;
32 rel1 {
33 relative: 1.0 0.0;
34 to: "panel_area";
35 }
36 rel2 {
37 relative: 1.0 1.0;
38 to: "panel_area";
39 }
40 align: 0.0 0.5;
41 fixed: 1 1;
42 visible: 0;
43 }
44 description { state: "visible" 0.0;
45 inherit: "default" 0.0;
46 visible: 1;
47 }
48 }
49 part { name: "access.outline";
50 type: RECT;
51 repeat_events: 1;
52 description { state: "default" 0.0;
53 rel1.to: "panel_area";
54 rel2.to: "panel_area";
55 color: 0 0 0 0;
56 }
57 }
58 part { name: "bg";
59 type: RECT;
60 description { state: "default" 0.0;
61 rel1.to: "panel_area";
62 rel2.to: "panel_area";
63 color: 64 64 64 255;
64 visible: 0;
65 }
66 description { state: "visible" 0.0;
67 inherit: "default" 0.0;
68 visible: 1;
69 }
70 }
71 part { name: "elm.swallow.content";
72 type: SWALLOW;
73 description { state: "default" 0.0;
74 rel1.to: "panel_area";
75 rel2.to: "panel_area";
76 visible: 0;
77 }
78 description { state: "visible" 0.0;
79 inherit: "default" 0.0;
80 visible: 1;
81 }
82 }
83 }
84 programs {
85 program { name: "active";
86 signal: "elm,state,content,visible";
87 source: "elm";
88 action: STATE_SET "visible" 0.0;
89 target: "panel_area";
90 target: "event_area";
91 target: "bg";
92 target: "elm.swallow.content";
93 }
94 program { name: "inactive";
95 signal: "elm,state,content,hidden";
96 source: "elm";
97 action: STATE_SET "default" 0.0;
98 target: "panel_area";
99 target: "event_area";
100 target: "bg";
101 target: "elm.swallow.content";
102 }
103 }
104}
105
106group { name: "elm/scroller/panel/right/default";
107 parts {
108 part { name: "event_area";
109 type: SWALLOW;
110 description { state: "default" 0.0;
111 rel2.relative: 0.0 1.0;
112 align: 0.0 0.5;
113 fixed: 1 1;
114 visible: 0;
115 }
116 description { state: "visible" 0.0;
117 inherit: "default" 0.0;
118 visible: 1;
119 }
120 }
121 part { name: "panel_area";
122 type: SWALLOW;
123 description { state: "default" 0.0;
124 rel1 {
125 relative: 1.0 0.0;
126 to: "event_area";
127 }
128 rel2 {
129 relative: 1.0 1.0;
130 to: "event_area";
131 }
132 align: 0.0 0.5;
133 fixed: 1 1;
134 visible: 0;
135 }
136 description { state: "visible" 0.0;
137 inherit: "default" 0.0;
138 visible: 1;
139 }
140 }
141 part { name: "access.outline";
142 type: RECT;
143 repeat_events: 1;
144 description { state: "default" 0.0;
145 rel1.to: "panel_area";
146 rel2.to: "panel_area";
147 color: 0 0 0 0;
148 }
149 }
150 part { name: "bg";
151 type: RECT;
152 description { state: "default" 0.0;
153 rel1.to: "panel_area";
154 rel2.to: "panel_area";
155 color: 64 64 64 255;
156 visible: 0;
157 }
158 description { state: "visible" 0.0;
159 inherit: "default" 0.0;
160 visible: 1;
161 }
162 }
163 part { name: "elm.swallow.content";
164 type: SWALLOW;
165 description { state: "default" 0.0;
166 rel1.to: "panel_area";
167 rel2.to: "panel_area";
168 visible: 0;
169 }
170 description { state: "visible" 0.0;
171 inherit: "default" 0.0;
172 visible: 1;
173 }
174 }
175 }
176 programs {
177 program { name: "active";
178 signal: "elm,state,content,visible";
179 source: "elm";
180 action: STATE_SET "visible" 0.0;
181 target: "panel_area";
182 target: "event_area";
183 target: "bg";
184 target: "elm.swallow.content";
185 }
186 program { name: "inactive";
187 signal: "elm,state,content,hidden";
188 source: "elm";
189 action: STATE_SET "default" 0.0;
190 target: "panel_area";
191 target: "event_area";
192 target: "bg";
193 target: "elm.swallow.content";
194 }
195 }
196}
197
198group { name: "elm/scroller/panel/top/default";
199 parts {
200 part { name: "panel_area";
201 type: SWALLOW;
202 description { state: "default" 0.0;
203 rel2.relative: 1.0 0.0;
204 align: 0.5 0.0;
205 fixed: 1 1;
206 visible: 0;
207 }
208 description { state: "visible" 0.0;
209 inherit: "default" 0.0;
210 visible: 1;
211 }
212 }
213 part { name: "event_area";
214 type: SWALLOW;
215 description { state: "default" 0.0;
216 rel1 {
217 relative: 0.0 1.0;
218 to: "panel_area";
219 }
220 rel2 {
221 relative: 1.0 1.0;
222 to: "panel_area";
223 }
224 align: 0.5 0.0;
225 fixed: 1 1;
226 visible: 0;
227 }
228 description { state: "visible" 0.0;
229 inherit: "default" 0.0;
230 visible: 1;
231 }
232 }
233 part { name: "access.outline";
234 type: RECT;
235 repeat_events: 1;
236 description { state: "default" 0.0;
237 rel1.to: "panel_area";
238 rel2.to: "panel_area";
239 color: 0 0 0 0;
240 }
241 }
242 part { name: "bg";
243 type: RECT;
244 description { state: "default" 0.0;
245 rel1.to: "panel_area";
246 rel2.to: "panel_area";
247 color: 64 64 64 255;
248 visible: 0;
249 }
250 description { state: "visible" 0.0;
251 inherit: "default" 0.0;
252 visible: 1;
253 }
254 }
255 part { name: "elm.swallow.content";
256 type: SWALLOW;
257 description { state: "default" 0.0;
258 rel1.to: "panel_area";
259 rel2.to: "panel_area";
260 visible: 0;
261 }
262 description { state: "visible" 0.0;
263 inherit: "default" 0.0;
264 visible: 1;
265 }
266 }
267 }
268 programs {
269 program { name: "active";
270 signal: "elm,state,content,visible";
271 source: "elm";
272 action: STATE_SET "visible" 0.0;
273 target: "panel_area";
274 target: "event_area";
275 target: "bg";
276 target: "elm.swallow.content";
277 }
278 program { name: "inactive";
279 signal: "elm,state,content,hidden";
280 source: "elm";
281 action: STATE_SET "default" 0.0;
282 target: "panel_area";
283 target: "event_area";
284 target: "bg";
285 target: "elm.swallow.content";
286 }
287 }
288}
289
290group { name: "elm/scroller/panel/bottom/default";
291 parts {
292 part { name: "event_area";
293 type: SWALLOW;
294 description { state: "default" 0.0;
295 rel2.relative: 1.0 0.0;
296 align: 0.5 0.0;
297 fixed: 1 1;
298 visible: 0;
299 }
300 description { state: "visible" 0.0;
301 inherit: "default" 0.0;
302 visible: 1;
303 }
304 }
305 part { name: "panel_area";
306 type: SWALLOW;
307 description { state: "default" 0.0;
308 rel1 {
309 relative: 0.0 1.0;
310 to: "event_area";
311 }
312 rel2 {
313 relative: 1.0 1.0;
314 to: "event_area";
315 }
316 align: 0.5 0.0;
317 fixed: 1 1;
318 visible: 0;
319 }
320 description { state: "visible" 0.0;
321 inherit: "default" 0.0;
322 visible: 1;
323 }
324 }
325 part { name: "access.outline";
326 type: RECT;
327 repeat_events: 1;
328 description { state: "default" 0.0;
329 rel1.to: "panel_area";
330 rel2.to: "panel_area";
331 color: 0 0 0 0;
332 }
333 }
334 part { name: "bg";
335 type: RECT;
336 description { state: "default" 0.0;
337 rel1.to: "panel_area";
338 rel2.to: "panel_area";
339 color: 64 64 64 255;
340 visible: 0;
341 }
342 description { state: "visible" 0.0;
343 inherit: "default" 0.0;
344 visible: 1;
345 }
346 }
347 part { name: "elm.swallow.content";
348 type: SWALLOW;
349 description { state: "default" 0.0;
350 rel1.to: "panel_area";
351 rel2.to: "panel_area";
352 visible: 0;
353 }
354 description { state: "visible" 0.0;
355 inherit: "default" 0.0;
356 visible: 1;
357 }
358 }
359 }
360 programs {
361 program { name: "active";
362 signal: "elm,state,content,visible";
363 source: "elm";
364 action: STATE_SET "visible" 0.0;
365 target: "panel_area";
366 target: "event_area";
367 target: "bg";
368 target: "elm.swallow.content";
369 }
370 program { name: "inactive";
371 signal: "elm,state,content,hidden";
372 source: "elm";
373 action: STATE_SET "default" 0.0;
374 target: "panel_area";
375 target: "event_area";
376 target: "bg";
377 target: "elm.swallow.content";
378 }
379 }
380}
381
382group { name: "elm/panel/left/default"; 1group { name: "elm/panel/left/default";
383 images.image: "bevel_out.png" COMP; 2 images.image: "bevel_out.png" COMP;
384 images.image: "shine.png" COMP; 3 images.image: "shine.png" COMP;
diff --git a/src/bin/test.c b/src/bin/test.c
index ae3976c19..ada5c2516 100644
--- a/src/bin/test.c
+++ b/src/bin/test.c
@@ -158,7 +158,6 @@ void test_slideshow(void *data, Evas_Object *obj, void *event_info);
158void test_menu(void *data, Evas_Object *obj, void *event_info); 158void test_menu(void *data, Evas_Object *obj, void *event_info);
159void test_menu2(void *data, Evas_Object *obj, void *event_info); 159void test_menu2(void *data, Evas_Object *obj, void *event_info);
160void test_panel(void *data, Evas_Object *obj, void *event_info); 160void test_panel(void *data, Evas_Object *obj, void *event_info);
161void test_panel2(void *data, Evas_Object *obj, void *event_info);
162void test_panes(void *data, Evas_Object *obj, void *event_info); 161void test_panes(void *data, Evas_Object *obj, void *event_info);
163void test_calendar(void *data, Evas_Object *obj, void *event_info); 162void test_calendar(void *data, Evas_Object *obj, void *event_info);
164void test_calendar2(void *data, Evas_Object *obj, void *event_info); 163void test_calendar2(void *data, Evas_Object *obj, void *event_info);
@@ -786,7 +785,6 @@ add_tests:
786 785
787 //------------------------------// 786 //------------------------------//
788 ADD_TEST(NULL, "Dividers", "Panel", test_panel); 787 ADD_TEST(NULL, "Dividers", "Panel", test_panel);
789 ADD_TEST(NULL, "Dividers", "Panel Scrollable", test_panel2);
790 ADD_TEST(NULL, "Dividers", "Panes", test_panes); 788 ADD_TEST(NULL, "Dividers", "Panes", test_panes);
791 789
792 //------------------------------// 790 //------------------------------//
diff --git a/src/bin/test_panel.c b/src/bin/test_panel.c
index 7743174ce..d0b7f6b3f 100644
--- a/src/bin/test_panel.c
+++ b/src/bin/test_panel.c
@@ -270,76 +270,3 @@ test_panel(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_inf
270 evas_object_resize(win, 320, 400); 270 evas_object_resize(win, 320, 400);
271 evas_object_show(win); 271 evas_object_show(win);
272} 272}
273
274static void
275_clicked_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
276{
277 Evas_Object *panel = data;
278 elm_panel_toggle(panel);
279}
280
281void
282test_panel2(void *data EINA_UNUSED,
283 Evas_Object *obj EINA_UNUSED,
284 void *event_info EINA_UNUSED)
285{
286 Evas_Object *win, *box, *table, *panel, *list, *button;
287 int i;
288
289 // Left Panel
290 win = elm_win_util_standard_add("panel", "Left Panel");
291 elm_win_autodel_set(win, EINA_TRUE);
292 evas_object_resize(win, 320, 400);
293 evas_object_show(win);
294
295 // box for button and table
296 box = elm_box_add(win);
297 evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
298 evas_object_show(box);
299 elm_win_resize_object_add(win, box);
300
301 // toggle button
302 button = elm_button_add(box);
303 evas_object_size_hint_weight_set(button, EVAS_HINT_EXPAND, 0);
304 evas_object_size_hint_align_set(button, EVAS_HINT_FILL, EVAS_HINT_FILL);
305 evas_object_show(button);
306 elm_object_text_set(button, "Toggle");
307 elm_box_pack_end(box, button);
308
309 // table for panel and center content
310 table = elm_table_add(win);
311 evas_object_size_hint_weight_set(table, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
312 evas_object_size_hint_align_set(table, EVAS_HINT_FILL, EVAS_HINT_FILL);
313 evas_object_show(table);
314 elm_box_pack_end(box, table);
315
316 // center content
317 list = elm_list_add(table);
318 evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
319 evas_object_size_hint_align_set(list, EVAS_HINT_FILL, EVAS_HINT_FILL);
320 evas_object_show(list);
321 for (i = 0; i < 20; i++)
322 elm_list_item_append(list, "center list item", NULL, NULL, NULL, NULL);
323 elm_table_pack(table, list, 0, 0, 1, 1);
324
325 // panel
326 panel = elm_panel_add(table);
327 evas_object_size_hint_weight_set(panel, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
328 evas_object_size_hint_align_set(panel, EVAS_HINT_FILL, EVAS_HINT_FILL);
329 evas_object_show(panel);
330 elm_table_pack(table, panel, 0, 0, 1, 1);
331
332 elm_panel_scrollable_set(panel, EINA_TRUE);
333 elm_panel_orient_set(panel, ELM_PANEL_ORIENT_LEFT);
334 elm_panel_hidden_set(panel, EINA_TRUE);
335 elm_panel_scrollable_content_size_set(panel, 0.75);
336
337 list = elm_list_add(panel);
338 evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
339 evas_object_size_hint_align_set(list, EVAS_HINT_FILL, EVAS_HINT_FILL);
340 for (i = 0; i < 7; i++)
341 elm_list_item_append(list, "panel list item", NULL, NULL, NULL, NULL);
342 elm_object_content_set(panel, list);
343
344 evas_object_smart_callback_add(button, "clicked", _clicked_cb, panel);
345}
diff --git a/src/lib/elm_panel.c b/src/lib/elm_panel.c
index 8a48e1e2a..6da13f975 100644
--- a/src/lib/elm_panel.c
+++ b/src/lib/elm_panel.c
@@ -18,12 +18,7 @@
18#define MY_CLASS_NAME "Elm_Panel" 18#define MY_CLASS_NAME "Elm_Panel"
19#define MY_CLASS_NAME_LEGACY "elm_panel" 19#define MY_CLASS_NAME_LEGACY "elm_panel"
20 20
21static const char ACCESS_OUTLINE_PART[] = "access.outline";
22
23static const char SIG_SCROLL[] = "scroll";
24
25static const Evas_Smart_Cb_Description _smart_callbacks[] = { 21static const Evas_Smart_Cb_Description _smart_callbacks[] = {
26 {SIG_SCROLL, ""},
27 {SIG_LAYOUT_FOCUSED, ""}, /**< handled by elm_layout */ 22 {SIG_LAYOUT_FOCUSED, ""}, /**< handled by elm_layout */
28 {SIG_LAYOUT_UNFOCUSED, ""}, /**< handled by elm_layout */ 23 {SIG_LAYOUT_UNFOCUSED, ""}, /**< handled by elm_layout */
29 {NULL, NULL} 24 {NULL, NULL}
@@ -73,55 +68,6 @@ _access_state_cb(void *data, Evas_Object *obj EINA_UNUSED)
73 return NULL; 68 return NULL;
74} 69}
75 70
76static Evas_Object *
77_access_object_get(const Evas_Object *obj, const char *part)
78{
79 Evas_Object *po, *ao;
80 ELM_PANEL_DATA_GET(obj, sd);
81
82 po = (Evas_Object *)edje_object_part_object_get
83 (elm_layout_edje_get(sd->scr_ly), part);
84 ao = evas_object_data_get(po, "_part_access_obj");
85
86 return ao;
87}
88
89static void
90_access_activate_cb(void *data,
91 Evas_Object *part_obj EINA_UNUSED,
92 Elm_Object_Item *item EINA_UNUSED)
93{
94 elm_panel_hidden_set(data, EINA_TRUE);
95}
96
97static void
98_access_obj_process(Evas_Object *obj, Eina_Bool is_access)
99{
100 Evas_Object *ao;
101 ELM_PANEL_DATA_GET(obj, sd);
102
103 if (is_access)
104 {
105 ao = _access_object_get(obj, ACCESS_OUTLINE_PART);
106 if (!ao)
107 {
108 ao = _elm_access_edje_object_part_object_register
109 (obj, elm_layout_edje_get(sd->scr_ly), ACCESS_OUTLINE_PART);
110 _elm_access_text_set(_elm_access_info_get(ao),
111 ELM_ACCESS_TYPE, E_("A drawer is open"));
112 _elm_access_text_set(_elm_access_info_get(ao),
113 ELM_ACCESS_CONTEXT_INFO, E_("Double tap to close drawer menu"));
114 _elm_access_activate_callback_set
115 (_elm_access_info_get(ao), _access_activate_cb, obj);
116 }
117 }
118 else
119 {
120 _elm_access_edje_object_part_object_unregister
121 (obj, elm_layout_edje_get(sd->scr_ly), ACCESS_OUTLINE_PART);
122 }
123}
124
125static void 71static void
126_orient_set_do(Evas_Object *obj) 72_orient_set_do(Evas_Object *obj)
127{ 73{
@@ -186,38 +132,6 @@ _orient_set_do(Evas_Object *obj)
186 } 132 }
187} 133}
188 134
189static void
190_scrollable_layout_theme_set(Eo *obj, Elm_Panel_Data *sd)
191{
192 switch (sd->orient)
193 {
194 case ELM_PANEL_ORIENT_TOP:
195 if (!elm_layout_theme_set(sd->scr_ly, "scroller", "panel/top",
196 elm_widget_style_get(obj)))
197 CRI("Failed to set layout!");
198 break;
199 case ELM_PANEL_ORIENT_BOTTOM:
200 if (!elm_layout_theme_set(sd->scr_ly, "scroller", "panel/bottom",
201 elm_widget_style_get(obj)))
202 CRI("Failed to set layout!");
203 break;
204 case ELM_PANEL_ORIENT_LEFT:
205 if (!elm_layout_theme_set(sd->scr_ly, "scroller", "panel/left",
206 elm_widget_style_get(obj)))
207 CRI("Failed to set layout!");
208 break;
209 case ELM_PANEL_ORIENT_RIGHT:
210 if (!elm_layout_theme_set(sd->scr_ly, "scroller", "panel/right",
211 elm_widget_style_get(obj)))
212 CRI("Failed to set layout!");
213 break;
214 }
215
216 /* access */
217 if (_elm_config->access_mode == ELM_ACCESS_MODE_ON)
218 _access_obj_process(obj, EINA_TRUE);
219}
220
221EOLIAN static Eina_Bool 135EOLIAN static Eina_Bool
222_elm_panel_elm_widget_theme_apply(Eo *obj, Elm_Panel_Data *sd) 136_elm_panel_elm_widget_theme_apply(Eo *obj, Elm_Panel_Data *sd)
223{ 137{
@@ -233,36 +147,22 @@ _elm_panel_elm_widget_theme_apply(Eo *obj, Elm_Panel_Data *sd)
233 147
234 _mirrored_set(obj, elm_widget_mirrored_get(obj)); 148 _mirrored_set(obj, elm_widget_mirrored_get(obj));
235 149
236 if (sd->scrollable) 150 str = edje_object_data_get
237 { 151 (wd->resize_obj, "focus_highlight");
238 const char *handler_size; 152 if ((str) && (!strcmp(str, "on")))
239 elm_widget_theme_object_set(obj, sd->scr_edje, "scroller", "panel", 153 elm_widget_highlight_in_theme_set(obj, EINA_TRUE);
240 elm_widget_style_get(obj));
241 _scrollable_layout_theme_set(obj, sd);
242
243 handler_size = edje_object_data_get(sd->scr_edje, "handler_size");
244 if (handler_size)
245 sd->handler_size = (int) (elm_object_scale_get(obj)) * (atoi(handler_size));
246 }
247 else 154 else
248 { 155 elm_widget_highlight_in_theme_set(obj, EINA_FALSE);
249 str = edje_object_data_get
250 (wd->resize_obj, "focus_highlight");
251 if ((str) && (!strcmp(str, "on")))
252 elm_widget_highlight_in_theme_set(obj, EINA_TRUE);
253 else
254 elm_widget_highlight_in_theme_set(obj, EINA_FALSE);
255 156
256 _orient_set_do(obj); 157 _orient_set_do(obj);
257 158
258 evas_object_hide(sd->event); 159 evas_object_hide(sd->event);
259 elm_coords_finger_size_adjust(1, &minw, 1, &minh); 160 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
260 evas_object_size_hint_min_set(sd->event, minw, minh); 161 evas_object_size_hint_min_set(sd->event, minw, minh);
261 162
262 if (edje_object_part_exists 163 if (edje_object_part_exists
263 (wd->resize_obj, "elm.swallow.event")) 164 (wd->resize_obj, "elm.swallow.event"))
264 elm_layout_content_set(obj, "elm.swallow.event", sd->event); 165 elm_layout_content_set(obj, "elm.swallow.event", sd->event);
265 }
266 166
267 elm_layout_sizing_eval(obj); 167 elm_layout_sizing_eval(obj);
268 168
@@ -279,33 +179,11 @@ EOLIAN static Eina_Bool
279_elm_panel_elm_widget_focus_next(Eo *obj, Elm_Panel_Data *sd, Elm_Focus_Direction dir, Evas_Object **next) 179_elm_panel_elm_widget_focus_next(Eo *obj, Elm_Panel_Data *sd, Elm_Focus_Direction dir, Evas_Object **next)
280{ 180{
281 Evas_Object *cur; 181 Evas_Object *cur;
282 Eina_List *items = NULL;
283 Eina_Bool ret = EINA_FALSE;
284 182
285 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE); 183 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
286 184
287 if (!sd->content) return EINA_FALSE; 185 if (!sd->content) return EINA_FALSE;
288 186
289 if (sd->scrollable)
290 {
291 if (sd->hidden) return EINA_FALSE;
292
293 if (_elm_config->access_mode == ELM_ACCESS_MODE_ON)
294 {
295 Evas_Object *ao = _access_object_get(obj, ACCESS_OUTLINE_PART);
296 if (ao) items = eina_list_append(items, ao);
297 items = eina_list_append(items, sd->content);
298
299 ret = elm_widget_focus_list_next_get
300 (obj, items, eina_list_data_get, dir, next);
301 eina_list_free(items);
302
303 return ret;
304 }
305
306 return elm_widget_focus_next_get(sd->content, dir, next);
307 }
308
309 cur = sd->content; 187 cur = sd->content;
310 188
311 /* Try to Focus cycle in subitem */ 189 /* Try to Focus cycle in subitem */
@@ -335,124 +213,6 @@ _box_layout_cb(Evas_Object *o,
335} 213}
336 214
337static void 215static void
338_handler_open(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
339{
340 ELM_PANEL_DATA_GET(obj, sd);
341
342 if (sd->handler_size == 0) return;
343
344 switch (sd->orient)
345 {
346 case ELM_PANEL_ORIENT_TOP:
347 eo_do(obj, elm_interface_scrollable_region_bring_in
348 (0, (h * sd->content_size_ratio) - sd->handler_size, w, h));
349 break;
350 case ELM_PANEL_ORIENT_BOTTOM:
351 eo_do(obj, elm_interface_scrollable_region_bring_in
352 (0, sd->handler_size, w, h));
353 break;
354 case ELM_PANEL_ORIENT_LEFT:
355 eo_do(obj, elm_interface_scrollable_region_bring_in
356 ((w * sd->content_size_ratio) - sd->handler_size, 0, w, h));
357 break;
358 case ELM_PANEL_ORIENT_RIGHT:
359 eo_do(obj, elm_interface_scrollable_region_bring_in
360 (sd->handler_size, 0, w, h));
361 break;
362 }
363}
364
365static void
366_drawer_open(Evas_Object *obj, Evas_Coord w, Evas_Coord h, Eina_Bool anim)
367{
368 ELM_PANEL_DATA_GET(obj, sd);
369 int x = 0, y = 0;
370
371 if (sd->freeze)
372 {
373 eo_do(obj, elm_interface_scrollable_movement_block_set
374 (ELM_SCROLLER_MOVEMENT_NO_BLOCK));
375 sd->freeze = EINA_FALSE;
376 elm_layout_signal_emit(sd->scr_ly, "elm,state,content,visible", "elm");
377 }
378
379 switch (sd->orient)
380 {
381 case ELM_PANEL_ORIENT_TOP:
382 case ELM_PANEL_ORIENT_LEFT:
383 break;
384
385 case ELM_PANEL_ORIENT_BOTTOM:
386 y = h * sd->content_size_ratio;
387 break;
388
389 case ELM_PANEL_ORIENT_RIGHT:
390 x = w * sd->content_size_ratio;
391 break;
392 }
393
394 if (anim)
395 eo_do(obj, elm_interface_scrollable_region_bring_in
396 (x, y, w, h));
397 else
398 eo_do(obj, elm_interface_scrollable_content_region_show
399 (x, y, w, h));
400}
401
402static void
403_drawer_close(Evas_Object *obj, Evas_Coord w, Evas_Coord h, Eina_Bool anim)
404{
405 ELM_PANEL_DATA_GET(obj, sd);
406 int x = 0, y = 0;
407 Eina_Bool horizontal = EINA_FALSE;
408
409 switch (sd->orient)
410 {
411 case ELM_PANEL_ORIENT_TOP:
412 y = h * sd->content_size_ratio;
413 break;
414
415 case ELM_PANEL_ORIENT_LEFT:
416 x = w * sd->content_size_ratio;
417 horizontal = EINA_TRUE;
418 break;
419
420 case ELM_PANEL_ORIENT_BOTTOM:
421 break;
422 case ELM_PANEL_ORIENT_RIGHT:
423 horizontal = EINA_TRUE;
424 break;
425 }
426
427 if (anim)
428 {
429 if (sd->freeze)
430 {
431 eo_do(obj, elm_interface_scrollable_movement_block_set
432 (ELM_SCROLLER_MOVEMENT_NO_BLOCK));
433 sd->freeze = EINA_FALSE;
434 elm_layout_signal_emit(sd->scr_ly, "elm,state,content,visible", "elm");
435 }
436 eo_do(obj, elm_interface_scrollable_region_bring_in(x, y, w, h));
437 }
438 else
439 {
440 eo_do(obj, elm_interface_scrollable_content_region_show(x, y, w, h));
441 if (!sd->freeze)
442 {
443 if (horizontal)
444 eo_do(obj, elm_interface_scrollable_movement_block_set
445 (ELM_SCROLLER_MOVEMENT_BLOCK_HORIZONTAL));
446 else
447 eo_do(obj, elm_interface_scrollable_movement_block_set
448 (ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL));
449 sd->freeze = EINA_TRUE;
450 elm_layout_signal_emit(sd->scr_ly, "elm,state,content,hidden", "elm");
451 }
452 }
453}
454
455static void
456_panel_toggle(void *data EINA_UNUSED, 216_panel_toggle(void *data EINA_UNUSED,
457 Evas_Object *obj, 217 Evas_Object *obj,
458 const char *emission EINA_UNUSED, 218 const char *emission EINA_UNUSED,
@@ -460,382 +220,26 @@ _panel_toggle(void *data EINA_UNUSED,
460{ 220{
461 ELM_PANEL_DATA_GET(obj, sd); 221 ELM_PANEL_DATA_GET(obj, sd);
462 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); 222 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
463 int w, h;
464 223
465 if (sd->scrollable) 224 if (sd->hidden)
466 { 225 {
467 if (elm_widget_disabled_get(obj)) return; 226 elm_layout_signal_emit(obj, "elm,action,show", "elm");
468 227 sd->hidden = EINA_FALSE;
469 evas_object_geometry_get(obj, NULL, NULL, &w, &h); 228 evas_object_repeat_events_set(obj, EINA_FALSE);
470 if (sd->hidden)
471 {
472 sd->hidden = EINA_FALSE;
473 _drawer_open(obj, w, h, EINA_TRUE);
474 }
475 else
476 {
477 sd->hidden = EINA_TRUE;
478 _drawer_close(obj, w, h, EINA_TRUE);
479 }
480 } 229 }
481 else 230 else
482 { 231 {
483 if (sd->hidden) 232 elm_layout_signal_emit(obj, "elm,action,hide", "elm");
484 { 233 sd->hidden = EINA_TRUE;
485 elm_layout_signal_emit(obj, "elm,action,show", "elm"); 234 evas_object_repeat_events_set(obj, EINA_TRUE);
486 sd->hidden = EINA_FALSE; 235 if (sd->content && elm_widget_focus_get(sd->content))
487 evas_object_repeat_events_set(obj, EINA_FALSE);
488 }
489 else
490 { 236 {
491 elm_layout_signal_emit(obj, "elm,action,hide", "elm"); 237 elm_widget_focused_object_clear(obj);
492 sd->hidden = EINA_TRUE; 238 elm_widget_focus_steal(obj);
493 evas_object_repeat_events_set(obj, EINA_TRUE);
494 if (sd->content && elm_widget_focus_get(sd->content))
495 {
496 elm_widget_focused_object_clear(obj);
497 elm_widget_focus_steal(obj);
498 }
499 } 239 }
500
501 edje_object_message_signal_process(wd->resize_obj);
502 }
503}
504
505static Eina_Bool
506_state_sync(Evas_Object *obj)
507{
508 ELM_PANEL_DATA_GET(obj, sd);
509 Evas_Object *ao;
510 Evas_Coord pos, panel_size, w, h;
511 Eina_Bool open = EINA_FALSE, horizontal = EINA_FALSE;
512 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
513
514 switch (sd->orient)
515 {
516 case ELM_PANEL_ORIENT_TOP:
517 panel_size = h * sd->content_size_ratio;
518 eo_do(obj, elm_interface_scrollable_content_pos_get(NULL, &pos));
519
520 if (pos == 0) open = EINA_TRUE;
521 else if (pos == panel_size) open = EINA_FALSE;
522 else return EINA_FALSE;
523 break;
524
525 case ELM_PANEL_ORIENT_BOTTOM:
526 panel_size = h * sd->content_size_ratio;
527 eo_do(obj, elm_interface_scrollable_content_pos_get(NULL, &pos));
528
529 if (pos == panel_size) open = EINA_TRUE;
530 else if (pos == 0) open = EINA_FALSE;
531 else return EINA_FALSE;
532 break;
533
534 case ELM_PANEL_ORIENT_LEFT:
535 panel_size = w * sd->content_size_ratio;
536 eo_do(obj, elm_interface_scrollable_content_pos_get(&pos, NULL));
537 horizontal = EINA_TRUE;
538
539 if (pos == 0) open = EINA_TRUE;
540 else if (pos == panel_size) open = EINA_FALSE;
541 else return EINA_FALSE;
542 break;
543
544 case ELM_PANEL_ORIENT_RIGHT:
545 panel_size = w * sd->content_size_ratio;
546 eo_do(obj, elm_interface_scrollable_content_pos_get(&pos, NULL));
547 horizontal = EINA_TRUE;
548
549 if (pos == panel_size) open = EINA_TRUE;
550 else if (pos == 0) open = EINA_FALSE;
551 else return EINA_FALSE;
552 break;
553 }
554
555 if (open)
556 {
557 if (sd->hidden) sd->hidden = EINA_FALSE;
558 eo_do(obj, elm_interface_scrollable_single_direction_set
559 (ELM_SCROLLER_SINGLE_DIRECTION_HARD));
560
561 //focus & access
562 elm_object_tree_focus_allow_set(obj, EINA_TRUE);
563 if (_elm_config->access_mode == ELM_ACCESS_MODE_ON)
564 {
565 ao = _access_object_get(obj, ACCESS_OUTLINE_PART);
566 evas_object_show(ao);
567 _elm_access_highlight_set(ao);
568 }
569 else
570 elm_object_focus_set(obj, EINA_TRUE);
571 }
572 else
573 {
574 if (!sd->hidden) sd->hidden = EINA_TRUE;
575
576 if (horizontal)
577 eo_do(obj, elm_interface_scrollable_movement_block_set
578 (ELM_SCROLLER_MOVEMENT_BLOCK_HORIZONTAL));
579 else
580 eo_do(obj, elm_interface_scrollable_movement_block_set
581 (ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL));
582 sd->freeze = EINA_TRUE;
583 elm_layout_signal_emit(sd->scr_ly, "elm,state,content,hidden", "elm");
584
585 eo_do(obj, elm_interface_scrollable_single_direction_set
586 (ELM_SCROLLER_SINGLE_DIRECTION_NONE));
587
588 //focus & access
589 elm_object_tree_focus_allow_set(obj, EINA_FALSE);
590 if (_elm_config->access_mode == ELM_ACCESS_MODE_ON)
591 {
592 ao = _access_object_get(obj, ACCESS_OUTLINE_PART);
593 evas_object_hide(ao);
594 }
595 }
596
597 return EINA_TRUE;
598}
599
600static Eina_Bool
601_timer_cb(void *data)
602{
603 ELM_PANEL_DATA_GET(data, sd);
604 Evas_Object *obj = data;
605 Evas_Coord w, h;
606
607 sd->timer = NULL;
608
609 if (sd->freeze)
610 {
611 eo_do(obj, elm_interface_scrollable_movement_block_set
612 (ELM_SCROLLER_MOVEMENT_NO_BLOCK));
613 sd->freeze = EINA_FALSE;
614 elm_layout_signal_emit(sd->scr_ly, "elm,state,content,visible", "elm");
615 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
616 _handler_open(obj, w, h);
617 }
618
619 return ECORE_CALLBACK_CANCEL;
620}
621
622static void
623_event_mouse_up(void *data,
624 Evas *e EINA_UNUSED,
625 Evas_Object *obj EINA_UNUSED,
626 void *event_info)
627{
628 ELM_PANEL_DATA_GET(data, sd);
629 Evas_Event_Mouse_Up *ev = event_info;
630 Evas_Coord x, y, up_x, up_y, minw = 0, minh = 0;
631 evas_object_geometry_get(data, &x, &y, NULL, NULL);
632
633 up_x = ev->output.x - x;
634 up_y = ev->output.y - y;
635
636 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
637
638 if ((!sd->hidden) && (up_x == sd->down_x) && (up_y == sd->down_y))
639 elm_panel_hidden_set(data, EINA_TRUE);
640}
641
642static void
643_on_mouse_down(void *data,
644 Evas *e EINA_UNUSED,
645 Evas_Object *obj,
646 void *event_info)
647{
648 Elm_Panel_Data *sd = data;
649 Evas_Event_Mouse_Down *ev = event_info;
650 Evas_Coord finger_size = elm_config_finger_size_get();
651 Evas_Coord x, y, w, h;
652 evas_object_geometry_get(obj, &x, &y, &w, &h);
653
654 sd->down_x = ev->output.x - x;
655 sd->down_y = ev->output.y - y;
656
657 // if freeze state & mouse down on the edge
658 // then set timer for un-freeze
659 switch (sd->orient)
660 {
661 case ELM_PANEL_ORIENT_TOP:
662 if ((sd->freeze) && (sd->down_y >= 0) && (sd->down_y < finger_size))
663 {
664 ecore_timer_del(sd->timer);
665 sd->timer = ecore_timer_add(0.2, _timer_cb, obj);
666 }
667 break;
668 case ELM_PANEL_ORIENT_BOTTOM:
669 if ((sd->freeze) && (sd->down_y <= h) && (sd->down_y > (h - finger_size)))
670 {
671 ecore_timer_del(sd->timer);
672 sd->timer = ecore_timer_add(0.2, _timer_cb, obj);
673 }
674 break;
675 case ELM_PANEL_ORIENT_LEFT:
676 if ((sd->freeze) && (sd->down_x >= 0) && (sd->down_x < finger_size))
677 {
678 ecore_timer_del(sd->timer);
679 sd->timer = ecore_timer_add(0.2, _timer_cb, obj);
680 }
681 break;
682 case ELM_PANEL_ORIENT_RIGHT:
683 if ((sd->freeze) && (sd->down_x <= w) && (sd->down_x > (w - finger_size)))
684 {
685 ecore_timer_del(sd->timer);
686 sd->timer = ecore_timer_add(0.2, _timer_cb, obj);
687 }
688 break;
689 }
690}
691
692static void
693_on_mouse_move(void *data,
694 Evas *e EINA_UNUSED,
695 Evas_Object *obj,
696 void *event_info)
697{
698 Elm_Panel_Data *sd = data;
699 Evas_Event_Mouse_Move *ev = event_info;
700 Evas_Coord x, y, w, h, cur_x, cur_y, finger_size;
701 evas_object_geometry_get(obj, &x, &y, &w, &h);
702 finger_size = elm_config_finger_size_get();
703
704 cur_x = ev->cur.canvas.x - x;
705 cur_y = ev->cur.canvas.y - y;
706
707 // if mouse down on the edge (it means sd->timer is not null)
708 // and move more than finger size
709 // then un-freeze
710 switch (sd->orient)
711 {
712 case ELM_PANEL_ORIENT_TOP:
713 if (sd->timer && ((cur_y - sd->down_y) > finger_size))
714 {
715 eo_do(obj, elm_interface_scrollable_freeze_set(EINA_FALSE));
716 sd->freeze = EINA_FALSE;
717 elm_layout_signal_emit(sd->scr_ly, "elm,state,content,visible", "elm");
718 }
719 break;
720 case ELM_PANEL_ORIENT_BOTTOM:
721 if (sd->timer && ((sd->down_y - cur_y) > finger_size))
722 {
723 eo_do(obj, elm_interface_scrollable_freeze_set(EINA_FALSE));
724 sd->freeze = EINA_FALSE;
725 elm_layout_signal_emit(sd->scr_ly, "elm,state,content,visible", "elm");
726 }
727 break;
728 case ELM_PANEL_ORIENT_LEFT:
729 if (sd->timer && ((cur_x - sd->down_x) > finger_size))
730 {
731 eo_do(obj, elm_interface_scrollable_freeze_set(EINA_FALSE));
732 sd->freeze = EINA_FALSE;
733 elm_layout_signal_emit(sd->scr_ly, "elm,state,content,visible", "elm");
734 }
735 break;
736 case ELM_PANEL_ORIENT_RIGHT:
737 if (sd->timer && ((sd->down_x - cur_x) > finger_size))
738 {
739 eo_do(obj, elm_interface_scrollable_freeze_set(EINA_FALSE));
740 sd->freeze = EINA_FALSE;
741 elm_layout_signal_emit(sd->scr_ly, "elm,state,content,visible", "elm");
742 }
743 break;
744 }
745
746 if (!sd->freeze && sd->hidden)
747 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
748}
749
750static void
751_on_mouse_up(void *data,
752 Evas *e EINA_UNUSED,
753 Evas_Object *obj,
754 void *event_info)
755{
756 Elm_Panel_Data *sd = data;
757 Evas_Event_Mouse_Up *ev = event_info;
758 Evas_Coord panel_size, threshold, pos, w, h;
759
760 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
761
762 ELM_SAFE_FREE(sd->timer, ecore_timer_del);
763
764 if (_state_sync(obj)) return;
765
766 switch (sd->orient)
767 {
768 case ELM_PANEL_ORIENT_TOP:
769 panel_size = h * sd->content_size_ratio;
770 threshold = panel_size / 4;
771 eo_do(obj, elm_interface_scrollable_content_pos_get(NULL, &pos));
772
773 if (sd->hidden)
774 {
775 if (pos < (panel_size - threshold)) _drawer_open(obj, w, h, EINA_TRUE);
776 else _drawer_close(obj, w, h, EINA_TRUE);
777 }
778 else
779 {
780 if (pos < threshold) _drawer_open(obj, w, h, EINA_TRUE);
781 else _drawer_close(obj, w, h, EINA_TRUE);
782 }
783 break;
784
785 case ELM_PANEL_ORIENT_BOTTOM:
786 panel_size = h * sd->content_size_ratio;
787 threshold = panel_size / 4;
788 eo_do(obj, elm_interface_scrollable_content_pos_get(NULL, &pos));
789
790 if (sd->hidden)
791 {
792 if (pos > threshold) _drawer_open(obj, w, h, EINA_TRUE);
793 else _drawer_close(obj, w, h, EINA_TRUE);
794 }
795 else
796 {
797 if (pos > (panel_size - threshold)) _drawer_open(obj, w, h, EINA_TRUE);
798 else _drawer_close(obj, w, h, EINA_TRUE);
799 }
800 break;
801
802 case ELM_PANEL_ORIENT_LEFT:
803 panel_size = w * sd->content_size_ratio;
804 threshold = panel_size / 4;
805 eo_do(obj, elm_interface_scrollable_content_pos_get(&pos, NULL));
806
807 if (sd->hidden)
808 {
809 if (pos < (panel_size - threshold)) _drawer_open(obj, w, h, EINA_TRUE);
810 else _drawer_close(obj, w, h, EINA_TRUE);
811 }
812 else
813 {
814 if (pos < threshold) _drawer_open(obj, w, h, EINA_TRUE);
815 else _drawer_close(obj, w, h, EINA_TRUE);
816 }
817 break;
818
819 case ELM_PANEL_ORIENT_RIGHT:
820 panel_size = w * sd->content_size_ratio;
821 threshold = panel_size / 4;
822 eo_do(obj, elm_interface_scrollable_content_pos_get(&pos, NULL));
823
824 if (sd->hidden)
825 {
826 if (pos > threshold) _drawer_open(obj, w, h, EINA_TRUE);
827 else _drawer_close(obj, w, h, EINA_TRUE);
828 }
829 else
830 {
831 if (pos > (panel_size - threshold)) _drawer_open(obj, w, h, EINA_TRUE);
832 else _drawer_close(obj, w, h, EINA_TRUE);
833 }
834 break;
835 } 240 }
836 241
837 if (!sd->freeze && sd->hidden) 242 edje_object_message_signal_process(wd->resize_obj);
838 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
839} 243}
840 244
841static Eina_Bool 245static Eina_Bool
@@ -926,8 +330,6 @@ _elm_panel_evas_object_smart_add(Eo *obj, Elm_Panel_Data *priv)
926 elm_widget_sub_object_parent_add(obj); 330 elm_widget_sub_object_parent_add(obj);
927 elm_widget_can_focus_set(obj, EINA_TRUE); 331 elm_widget_can_focus_set(obj, EINA_TRUE);
928 332
929 priv->panel_edje = wd->resize_obj;
930
931 eo_do(obj, elm_obj_widget_theme_apply()); 333 eo_do(obj, elm_obj_widget_theme_apply());
932 334
933 priv->bx = evas_object_box_add(evas_object_evas_get(obj)); 335 priv->bx = evas_object_box_add(evas_object_evas_get(obj));
@@ -976,8 +378,6 @@ _elm_panel_evas_object_smart_del(Eo *obj, Elm_Panel_Data *sd)
976 378
977 sd->delete_me = EINA_TRUE; 379 sd->delete_me = EINA_TRUE;
978 380
979 ELM_SAFE_FREE(sd->timer, ecore_timer_del);
980
981 /* let's make our box object the *last* to be processed, since it 381 /* let's make our box object the *last* to be processed, since it
982 * may (smart) parent other sub objects here */ 382 * may (smart) parent other sub objects here */
983 EINA_LIST_FOREACH(wd->subobjs, l, child) 383 EINA_LIST_FOREACH(wd->subobjs, l, child)
@@ -994,63 +394,9 @@ _elm_panel_evas_object_smart_del(Eo *obj, Elm_Panel_Data *sd)
994} 394}
995 395
996EOLIAN static void 396EOLIAN static void
997_elm_panel_evas_object_smart_move(Eo *obj, Elm_Panel_Data *sd, Evas_Coord x, Evas_Coord y) 397_elm_panel_elm_widget_access(Eo *obj, Elm_Panel_Data *_pd EINA_UNUSED, Eina_Bool is_access)
998{
999 eo_do_super(obj, MY_CLASS, evas_obj_smart_move(x, y));
1000
1001 evas_object_move(sd->hit_rect, x, y);
1002}
1003
1004EOLIAN static void
1005_elm_panel_evas_object_smart_resize(Eo *obj, Elm_Panel_Data *sd, Evas_Coord w, Evas_Coord h)
1006{
1007 eo_do_super(obj, MY_CLASS, evas_obj_smart_resize(w, h));
1008
1009 if (!sd->scrollable) return;
1010
1011 evas_object_resize(sd->hit_rect, w, h);
1012
1013 switch (sd->orient)
1014 {
1015 case ELM_PANEL_ORIENT_TOP:
1016 case ELM_PANEL_ORIENT_BOTTOM:
1017 // vertical
1018 evas_object_resize(sd->scr_ly, w, (1 + sd->content_size_ratio) * h);
1019 evas_object_size_hint_min_set(sd->scr_panel, w, (sd->content_size_ratio * h));
1020 evas_object_size_hint_min_set(sd->scr_event, w, h);
1021 break;
1022 case ELM_PANEL_ORIENT_LEFT:
1023 case ELM_PANEL_ORIENT_RIGHT:
1024 // horizontal
1025 evas_object_resize(sd->scr_ly, (1 + sd->content_size_ratio) * w, h);
1026 evas_object_size_hint_min_set(sd->scr_panel, (sd->content_size_ratio * w), h);
1027 evas_object_size_hint_min_set(sd->scr_event, w, h);
1028 break;
1029 }
1030
1031 if (sd->hidden) _drawer_close(obj, w, h, EINA_FALSE);
1032 else _drawer_open(obj, w, h, EINA_FALSE);
1033}
1034
1035EOLIAN static void
1036_elm_panel_evas_object_smart_member_add(Eo *obj, Elm_Panel_Data *sd, Evas_Object *member)
1037{
1038 eo_do_super(obj, MY_CLASS, evas_obj_smart_member_add(member));
1039
1040 if (sd->hit_rect) evas_object_raise(sd->hit_rect);
1041}
1042
1043EOLIAN static void
1044_elm_panel_elm_widget_access(Eo *obj, Elm_Panel_Data *_pd, Eina_Bool is_access)
1045{ 398{
1046 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); 399 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
1047 Elm_Panel_Data *sd = _pd;
1048
1049 if (sd->scrollable)
1050 {
1051 _access_obj_process(obj, is_access);
1052 return;
1053 }
1054 400
1055 if (is_access) 401 if (is_access)
1056 _elm_access_edje_object_part_object_register 402 _elm_access_edje_object_part_object_register
@@ -1085,8 +431,7 @@ _elm_panel_orient_set(Eo *obj, Elm_Panel_Data *sd, Elm_Panel_Orient orient)
1085 if (sd->orient == orient) return; 431 if (sd->orient == orient) return;
1086 sd->orient = orient; 432 sd->orient = orient;
1087 433
1088 if (sd->scrollable) _scrollable_layout_theme_set(obj, sd); 434 _orient_set_do(obj);
1089 else _orient_set_do(obj);
1090 435
1091 elm_layout_sizing_eval(obj); 436 elm_layout_sizing_eval(obj);
1092} 437}
@@ -1100,16 +445,7 @@ _elm_panel_orient_get(Eo *obj EINA_UNUSED, Elm_Panel_Data *sd)
1100EOLIAN static void 445EOLIAN static void
1101_elm_panel_hidden_set(Eo *obj, Elm_Panel_Data *sd, Eina_Bool hidden) 446_elm_panel_hidden_set(Eo *obj, Elm_Panel_Data *sd, Eina_Bool hidden)
1102{ 447{
1103 if (sd->hidden == !!hidden) 448 if (sd->hidden == !!hidden) return;
1104 {
1105 if (sd->scrollable && sd->hidden && !sd->freeze)
1106 {
1107 Evas_Coord w, h;
1108 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
1109 _drawer_close(obj, w, h, EINA_TRUE);
1110 }
1111 return;
1112 }
1113 449
1114 _panel_toggle(NULL, obj, NULL, NULL); 450 _panel_toggle(NULL, obj, NULL, NULL);
1115} 451}
@@ -1126,243 +462,6 @@ _elm_panel_toggle(Eo *obj, Elm_Panel_Data *_pd EINA_UNUSED)
1126 _panel_toggle(NULL, obj, NULL, NULL); 462 _panel_toggle(NULL, obj, NULL, NULL);
1127} 463}
1128 464
1129EOLIAN static Eina_Bool
1130_elm_panel_elm_widget_on_focus_region(Eo *obj,
1131 Elm_Panel_Data *sd,
1132 Evas_Coord *x,
1133 Evas_Coord *y,
1134 Evas_Coord *w,
1135 Evas_Coord *h)
1136{
1137 eo_do(obj, elm_interface_scrollable_content_pos_get(x, y));
1138 evas_object_geometry_get(obj, NULL, NULL, w, h);
1139 switch (sd->orient)
1140 {
1141 case ELM_PANEL_ORIENT_TOP:
1142 case ELM_PANEL_ORIENT_BOTTOM:
1143 *h = *h * sd->content_size_ratio;
1144 break;
1145 case ELM_PANEL_ORIENT_LEFT:
1146 case ELM_PANEL_ORIENT_RIGHT:
1147 *w = *w * sd->content_size_ratio;
1148 break;
1149 }
1150 return EINA_TRUE;
1151}
1152
1153static void
1154_anim_stop_cb(Evas_Object *obj, void *data EINA_UNUSED)
1155{
1156 if (elm_widget_disabled_get(obj)) return;
1157 _state_sync(obj);
1158}
1159
1160static void
1161_scroll_cb(Evas_Object *obj, void *data EINA_UNUSED)
1162{
1163 ELM_PANEL_DATA_GET(obj, sd);
1164 Elm_Panel_Scroll_Info event;
1165 Evas_Coord x, y, w, h;
1166
1167 if (elm_widget_disabled_get(obj)) return;
1168 // in the case of
1169 // freeze_set(FALSE) -> mouse_up -> freeze_set(TRUE) -> scroll
1170 if (sd->freeze)
1171 {
1172 eo_do(obj, elm_interface_scrollable_movement_block_set
1173 (ELM_SCROLLER_MOVEMENT_NO_BLOCK));
1174 sd->freeze = EINA_FALSE;
1175 elm_layout_signal_emit(sd->scr_ly, "elm,state,content,visible", "elm");
1176 }
1177
1178 eo_do(obj, elm_interface_scrollable_content_pos_get(&x, &y));
1179 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
1180
1181 switch (sd->orient)
1182 {
1183 case ELM_PANEL_ORIENT_TOP:
1184 event.rel_x = 1;
1185 event.rel_y = 1 - ((double) y / (double) ((sd->content_size_ratio) * h));
1186 break;
1187 case ELM_PANEL_ORIENT_BOTTOM:
1188 event.rel_x = 1;
1189 event.rel_y = (double) y / (double) ((sd->content_size_ratio) * h);
1190 break;
1191 case ELM_PANEL_ORIENT_LEFT:
1192 event.rel_x = 1 - ((double) x / (double) ((sd->content_size_ratio) * w));
1193 event.rel_y = 1;
1194 break;
1195 case ELM_PANEL_ORIENT_RIGHT:
1196 event.rel_x = (double) x / (double) ((sd->content_size_ratio) * w);
1197 event.rel_y = 1;
1198 break;
1199 }
1200 evas_object_smart_callback_call(obj, SIG_SCROLL, (void *) &event);
1201}
1202
1203EOLIAN static Eina_Bool
1204_elm_panel_elm_widget_disable(Eo *obj, Elm_Panel_Data *sd)
1205{
1206 Eina_Bool int_ret = EINA_FALSE;
1207 eo_do_super(obj, MY_CLASS, int_ret = elm_obj_widget_disable());
1208 if (!int_ret) return EINA_FALSE;
1209
1210 if (sd->scrollable)
1211 {
1212 if (elm_widget_disabled_get(obj))
1213 {
1214 evas_object_event_callback_del(obj, EVAS_CALLBACK_MOUSE_DOWN,
1215 _on_mouse_down);
1216 evas_object_event_callback_del(obj, EVAS_CALLBACK_MOUSE_MOVE,
1217 _on_mouse_move);
1218 evas_object_event_callback_del(obj, EVAS_CALLBACK_MOUSE_UP,
1219 _on_mouse_up);
1220 evas_object_event_callback_del(sd->scr_event, EVAS_CALLBACK_MOUSE_UP,
1221 _event_mouse_up);
1222 }
1223 else
1224 {
1225 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_DOWN,
1226 _on_mouse_down, sd);
1227 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_MOVE,
1228 _on_mouse_move, sd);
1229 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_UP,
1230 _on_mouse_up, sd);
1231 evas_object_event_callback_add(sd->scr_event, EVAS_CALLBACK_MOUSE_UP,
1232 _event_mouse_up, obj);
1233 }
1234 }
1235
1236 return EINA_TRUE;
1237}
1238
1239EOLIAN static void
1240_elm_panel_scrollable_content_size_set(Eo *obj EINA_UNUSED, Elm_Panel_Data *sd, double ratio)
1241{
1242 sd->content_size_ratio = ratio;
1243}
1244
1245EOLIAN static void
1246_elm_panel_scrollable_set(Eo *obj, Elm_Panel_Data *sd, Eina_Bool scrollable)
1247{
1248 scrollable = !!scrollable;
1249 if (sd->scrollable == scrollable) return;
1250 sd->scrollable = scrollable;
1251
1252 if (scrollable)
1253 {
1254 elm_layout_content_unset(obj, "elm.swallow.content");
1255
1256 elm_widget_resize_object_set(obj, NULL, EINA_TRUE);
1257 elm_widget_sub_object_add(obj, sd->panel_edje);
1258
1259 if (!sd->scr_edje)
1260 {
1261 const char *handler_size;
1262
1263 sd->scr_edje = edje_object_add(evas_object_evas_get(obj));
1264 elm_widget_theme_object_set(obj, sd->scr_edje, "scroller", "panel",
1265 elm_widget_style_get(obj));
1266 evas_object_size_hint_weight_set
1267 (sd->scr_edje, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1268 evas_object_size_hint_align_set
1269 (sd->scr_edje, EVAS_HINT_FILL, EVAS_HINT_FILL);
1270
1271 handler_size = edje_object_data_get(sd->scr_edje, "handler_size");
1272 if (handler_size)
1273 sd->handler_size = (int) (elm_object_scale_get(obj)) * (atoi(handler_size));
1274 }
1275
1276 elm_widget_resize_object_set(obj, sd->scr_edje, EINA_TRUE);
1277
1278 if (!sd->hit_rect)
1279 {
1280 sd->hit_rect = evas_object_rectangle_add(evas_object_evas_get(obj));
1281 evas_object_smart_member_add(sd->hit_rect, obj);
1282 elm_widget_sub_object_add(obj, sd->hit_rect);
1283 evas_object_color_set(sd->hit_rect, 0, 0, 0, 0);
1284 evas_object_show(sd->hit_rect);
1285 evas_object_repeat_events_set(sd->hit_rect, EINA_TRUE);
1286
1287 eo_do(obj,
1288 elm_interface_scrollable_objects_set(sd->scr_edje, sd->hit_rect),
1289 elm_interface_scrollable_animate_stop_cb_set(_anim_stop_cb),
1290 elm_interface_scrollable_scroll_cb_set(_scroll_cb));
1291 }
1292
1293 if (!sd->scr_ly)
1294 {
1295 sd->scr_ly = elm_layout_add(obj);
1296 evas_object_smart_member_add(sd->scr_ly, obj);
1297 elm_widget_sub_object_add(obj, sd->scr_ly);
1298 _scrollable_layout_theme_set(obj, sd);
1299
1300 sd->scr_panel = evas_object_rectangle_add(evas_object_evas_get(obj));
1301 evas_object_color_set(sd->scr_panel, 0, 0, 0, 0);
1302 elm_widget_sub_object_add(obj, sd->scr_panel);
1303 elm_layout_content_set(sd->scr_ly, "panel_area", sd->scr_panel);
1304
1305 sd->scr_event = evas_object_rectangle_add(evas_object_evas_get(obj));
1306 evas_object_color_set(sd->scr_event, 0, 0, 0, 0);
1307 elm_widget_sub_object_add(obj, sd->scr_event);
1308 elm_layout_content_set(sd->scr_ly, "event_area", sd->scr_event);
1309 }
1310
1311 eo_do(obj,
1312 elm_interface_scrollable_content_set(sd->scr_ly));
1313 sd->freeze = EINA_TRUE;
1314 elm_layout_content_set(sd->scr_ly, "elm.swallow.content", sd->bx);
1315
1316 switch (sd->orient)
1317 {
1318 case ELM_PANEL_ORIENT_TOP:
1319 case ELM_PANEL_ORIENT_BOTTOM:
1320 eo_do(obj, elm_interface_scrollable_movement_block_set
1321 (ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL));
1322 break;
1323 case ELM_PANEL_ORIENT_LEFT:
1324 case ELM_PANEL_ORIENT_RIGHT:
1325 eo_do(obj, elm_interface_scrollable_movement_block_set
1326 (ELM_SCROLLER_MOVEMENT_BLOCK_HORIZONTAL));
1327 break;
1328 }
1329
1330 eo_do(obj, elm_interface_scrollable_single_direction_set
1331 (ELM_SCROLLER_SINGLE_DIRECTION_NONE));
1332
1333 if (!elm_widget_disabled_get(obj))
1334 {
1335 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_DOWN,
1336 _on_mouse_down, sd);
1337 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_MOVE,
1338 _on_mouse_move, sd);
1339 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_UP,
1340 _on_mouse_up, sd);
1341 evas_object_event_callback_add(sd->scr_event, EVAS_CALLBACK_MOUSE_UP,
1342 _event_mouse_up, obj);
1343 }
1344
1345 }
1346 else
1347 {
1348 eo_do(obj, elm_interface_scrollable_content_set(NULL));
1349
1350 evas_object_event_callback_del(obj, EVAS_CALLBACK_MOUSE_DOWN, _on_mouse_down);
1351 evas_object_event_callback_del(obj, EVAS_CALLBACK_MOUSE_MOVE, _on_mouse_move);
1352 evas_object_event_callback_del(obj, EVAS_CALLBACK_MOUSE_UP, _on_mouse_up);
1353 evas_object_event_callback_del(sd->scr_event, EVAS_CALLBACK_MOUSE_UP,
1354 _event_mouse_up);
1355
1356 elm_widget_resize_object_set(obj, NULL, EINA_TRUE);
1357 elm_widget_sub_object_add(obj, sd->scr_edje);
1358
1359 elm_widget_resize_object_set(obj, sd->panel_edje, EINA_TRUE);
1360
1361 elm_layout_content_unset(sd->scr_ly, "elm.swallow.content");
1362 elm_layout_content_set(obj, "elm.swallow.content", sd->bx);
1363 }
1364}
1365
1366static void 465static void
1367_elm_panel_class_constructor(Eo_Class *klass) 466_elm_panel_class_constructor(Eo_Class *klass)
1368{ 467{
diff --git a/src/lib/elm_panel.eo b/src/lib/elm_panel.eo
index b4643298a..8a5e33a50 100644
--- a/src/lib/elm_panel.eo
+++ b/src/lib/elm_panel.eo
@@ -1,4 +1,4 @@
1class Elm_Panel (Elm_Layout, Elm_Interface_Scrollable) 1class Elm_Panel (Elm_Layout)
2{ 2{
3 eo_prefix: elm_obj_panel; 3 eo_prefix: elm_obj_panel;
4 properties { 4 properties {
@@ -45,28 +45,6 @@ class Elm_Panel (Elm_Layout, Elm_Interface_Scrollable)
45 Eina_Bool hidden; /*@ If true, the panel will run the animation to disappear. */ 45 Eina_Bool hidden; /*@ If true, the panel will run the animation to disappear. */
46 } 46 }
47 } 47 }
48 scrollable {
49 set {
50 /*@
51 @brief Set the scrollability of the panel.
52
53 @ingroup Panel */
54 }
55 values {
56 Eina_Bool scrollable;
57 }
58 }
59 scrollable_content_size {
60 set {
61 /*@
62 @brief Set the size of the scrollable panel.
63
64 @ingroup Panel */
65 }
66 values {
67 double ratio;
68 }
69 }
70 } 48 }
71 methods { 49 methods {
72 toggle { 50 toggle {
@@ -81,17 +59,12 @@ class Elm_Panel (Elm_Layout, Elm_Interface_Scrollable)
81 class.constructor; 59 class.constructor;
82 Eo_Base.constructor; 60 Eo_Base.constructor;
83 Evas_Object_Smart.add; 61 Evas_Object_Smart.add;
84 Evas_Object_Smart.member_add;
85 Evas_Object_Smart.del; 62 Evas_Object_Smart.del;
86 Evas_Object_Smart.resize;
87 Evas_Object_Smart.move;
88 Elm_Widget.theme_apply; 63 Elm_Widget.theme_apply;
89 Elm_Widget.focus_next_manager_is; 64 Elm_Widget.focus_next_manager_is;
90 Elm_Widget.focus_next; 65 Elm_Widget.focus_next;
91 Elm_Widget.disable;
92 Elm_Widget.access; 66 Elm_Widget.access;
93 Elm_Widget.event; 67 Elm_Widget.event;
94 Elm_Widget.on_focus_region;
95 Elm_Container.content_get; 68 Elm_Container.content_get;
96 Elm_Container.content_unset; 69 Elm_Container.content_unset;
97 Elm_Container.content_set; 70 Elm_Container.content_set;
diff --git a/src/lib/elm_panel.h b/src/lib/elm_panel.h
index 0e957ee5c..6bf385390 100644
--- a/src/lib/elm_panel.h
+++ b/src/lib/elm_panel.h
@@ -23,9 +23,6 @@
23 * 23 *
24 * This widget emits the following signals, besides the ones sent from 24 * This widget emits the following signals, besides the ones sent from
25 * @ref Layout: 25 * @ref Layout:
26 * @li @c "scroll" : When the content has been scrolled (moved). (since 1.10)
27 * This signal is emitted only when the panel is scrollable.
28 * Elm_Panel_Scroll_Info will be passed by @c event_info argument.
29 * @li @c "focused" : When the panel has received focus. (since 1.8) 26 * @li @c "focused" : When the panel has received focus. (since 1.8)
30 * @li @c "unfocused" : When the panel has lost focus. (since 1.8) 27 * @li @c "unfocused" : When the panel has lost focus. (since 1.8)
31 * 28 *
diff --git a/src/lib/elm_panel_common.h b/src/lib/elm_panel_common.h
index 9993b2208..8c84d1ab1 100644
--- a/src/lib/elm_panel_common.h
+++ b/src/lib/elm_panel_common.h
@@ -6,9 +6,3 @@ typedef enum
6 ELM_PANEL_ORIENT_RIGHT, /**< Panel (dis)appears from the right */ 6 ELM_PANEL_ORIENT_RIGHT, /**< Panel (dis)appears from the right */
7} Elm_Panel_Orient; 7} Elm_Panel_Orient;
8 8
9typedef struct _Elm_Panel_Scroll_Info
10{
11 double rel_x; /**<content scrolled position (0.0 ~ 1.0) in the panel>*/
12 double rel_y; /**<content scrolled position (0.0 ~ 1.0) in the panel>*/
13
14} Elm_Panel_Scroll_Info;
diff --git a/src/lib/elm_widget_panel.h b/src/lib/elm_widget_panel.h
index 38740081b..6982774d0 100644
--- a/src/lib/elm_widget_panel.h
+++ b/src/lib/elm_widget_panel.h
@@ -1,7 +1,6 @@
1#ifndef ELM_WIDGET_PANEL_H 1#ifndef ELM_WIDGET_PANEL_H
2#define ELM_WIDGET_PANEL_H 2#define ELM_WIDGET_PANEL_H
3 3
4#include "elm_interface_scrollable.h"
5#include "elm_widget_layout.h" 4#include "elm_widget_layout.h"
6 5
7/** 6/**
@@ -23,22 +22,11 @@ struct _Elm_Panel_Data
23{ 22{
24 Evas_Object *bx, *content; 23 Evas_Object *bx, *content;
25 Evas_Object *event; 24 Evas_Object *event;
26 Evas_Object *scr_ly;
27 Evas_Object *hit_rect, *panel_edje, *scr_edje;
28 Evas_Object *scr_panel, *scr_event;
29
30 25
31 Elm_Panel_Orient orient; 26 Elm_Panel_Orient orient;
32 27
33 double content_size_ratio;
34 Evas_Coord down_x, down_y;
35 Evas_Coord handler_size;
36 Ecore_Timer *timer;
37
38 Eina_Bool hidden : 1; 28 Eina_Bool hidden : 1;
39 Eina_Bool delete_me : 1; 29 Eina_Bool delete_me : 1;
40 Eina_Bool scrollable : 1;
41 Eina_Bool freeze: 1;
42}; 30};
43 31
44/** 32/**