summaryrefslogtreecommitdiff
path: root/legacy/elementary/src/lib/elm_access.c
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2011-08-24 06:29:13 +0000
committerCarsten Haitzler <raster@rasterman.com>2011-08-24 06:29:13 +0000
commitdbb4cbed9336dd561ba1bf8c5b94896dd47a2ece (patch)
treedc096c515dcf3f03c04d8404076c915d4d936639 /legacy/elementary/src/lib/elm_access.c
parent9589706ff958fcb7761eca7440e5d55e9994aeb1 (diff)
and now do toolbar - showing how to add access stuff to items in a
widget SVN revision: 62733
Diffstat (limited to 'legacy/elementary/src/lib/elm_access.c')
-rw-r--r--legacy/elementary/src/lib/elm_access.c121
1 files changed, 102 insertions, 19 deletions
diff --git a/legacy/elementary/src/lib/elm_access.c b/legacy/elementary/src/lib/elm_access.c
index 2e48d16..2964d97 100644
--- a/legacy/elementary/src/lib/elm_access.c
+++ b/legacy/elementary/src/lib/elm_access.c
@@ -133,6 +133,31 @@ static void
133_access_read_done(void *data __UNUSED__) 133_access_read_done(void *data __UNUSED__)
134{ 134{
135 printf("read done\n"); 135 printf("read done\n");
136 // FIXME: produce event here
137}
138
139static void
140_access_2nd_click_del_cb(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
141{
142 Ecore_Timer *t;
143
144 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
145 _access_2nd_click_del_cb, NULL);
146 t = evas_object_data_get(obj, "_elm_2nd_timeout");
147 if (t)
148 {
149 ecore_timer_del(t);
150 evas_object_data_del(obj, "_elm_2nd_timeout");
151 }
152}
153
154static Eina_Bool
155_access_2nd_click_timeout_cb(void *data)
156{
157 evas_object_event_callback_del_full(data, EVAS_CALLBACK_DEL,
158 _access_2nd_click_del_cb, NULL);
159 evas_object_data_del(data, "_elm_2nd_timeout");
160 return EINA_FALSE;
136} 161}
137 162
138static void 163static void
@@ -286,6 +311,12 @@ _elm_access_object_get(Evas_Object *obj)
286 return evas_object_data_get(obj, "_elm_access"); 311 return evas_object_data_get(obj, "_elm_access");
287} 312}
288 313
314EAPI Elm_Access_Info *
315_elm_access_item_get(Elm_Widget_Item *it)
316{
317 return it->access;
318}
319
289EAPI void 320EAPI void
290_elm_access_object_hilight(Evas_Object *obj) 321_elm_access_object_hilight(Evas_Object *obj)
291{ 322{
@@ -391,28 +422,86 @@ _elm_access_object_register(Evas_Object *obj, Evas_Object *hoverobj)
391 evas_object_data_set(obj, "_elm_access", ac); 422 evas_object_data_set(obj, "_elm_access", ac);
392} 423}
393 424
425static Eina_Bool
426_access_item_over_timeout_cb(void *data)
427{
428 Elm_Access_Info *ac = ((Elm_Widget_Item *)data)->access;
429 if (!ac) return EINA_FALSE;
430 if (_elm_config->access_mode != ELM_ACCESS_MODE_OFF)
431 {
432 _elm_access_object_hilight(((Elm_Widget_Item *)data)->view);
433 _elm_access_read(ac, ELM_ACCESS_CANCEL, NULL, data);
434 _elm_access_read(ac, ELM_ACCESS_TYPE, NULL, data);
435 _elm_access_read(ac, ELM_ACCESS_INFO, NULL, data);
436 _elm_access_read(ac, ELM_ACCESS_STATE, NULL, data);
437 _elm_access_read(ac, ELM_ACCESS_DONE, NULL, data);
438 }
439 ac->delay_timer = NULL;
440 return EINA_FALSE;
441}
442
394static void 443static void
395_access_2nd_click_del_cb(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) 444_access_item_mouse_in_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
396{ 445{
397 Ecore_Timer *t; 446 Elm_Access_Info *ac = ((Elm_Widget_Item *)data)->access;
447 if (!ac) return;
448
449 if (ac->delay_timer)
450 {
451 ecore_timer_del(ac->delay_timer);
452 ac->delay_timer = NULL;
453 }
454 if (_elm_config->access_mode != ELM_ACCESS_MODE_OFF)
455 ac->delay_timer = ecore_timer_add(0.2, _access_item_over_timeout_cb, data);
456}
457
458static void
459_access_item_mouse_out_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
460{
461 Elm_Access_Info *ac = ((Elm_Widget_Item *)data)->access;
462 if (!ac) return;
463
464 _elm_access_object_unhilight(((Elm_Widget_Item *)data)->view);
465 if (ac->delay_timer)
466 {
467 ecore_timer_del(ac->delay_timer);
468 ac->delay_timer = NULL;
469 }
470}
398 471
472static void
473_access_item_del_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
474{
475 Elm_Access_Info *ac;
476
477 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOUSE_IN,
478 _access_item_mouse_in_cb, data);
479 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOUSE_OUT,
480 _access_item_mouse_out_cb, data);
399 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL, 481 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
400 _access_2nd_click_del_cb, NULL); 482 _access_item_del_cb, data);
401 t = evas_object_data_get(obj, "_elm_2nd_timeout"); 483 ac = ((Elm_Widget_Item *)data)->access;
402 if (t) 484 ((Elm_Widget_Item *)data)->access = NULL;
485 if (ac)
403 { 486 {
404 ecore_timer_del(t); 487 _elm_access_clear(ac);
405 evas_object_data_del(obj, "_elm_2nd_timeout"); 488 free(ac);
406 } 489 }
407} 490}
408 491
409static Eina_Bool 492EAPI void
410_access_2nd_click_timeout_cb(void *data) 493_elm_access_item_register(Elm_Widget_Item *item, Evas_Object *hoverobj)
411{ 494{
412 evas_object_event_callback_del_full(data, EVAS_CALLBACK_DEL, 495 Elm_Access_Info *ac;
413 _access_2nd_click_del_cb, NULL); 496
414 evas_object_data_del(data, "_elm_2nd_timeout"); 497 evas_object_event_callback_add(hoverobj, EVAS_CALLBACK_MOUSE_IN,
415 return EINA_FALSE; 498 _access_item_mouse_in_cb, item);
499 evas_object_event_callback_add(hoverobj, EVAS_CALLBACK_MOUSE_OUT,
500 _access_item_mouse_out_cb, item);
501 evas_object_event_callback_add(hoverobj, EVAS_CALLBACK_DEL,
502 _access_item_del_cb, item);
503 ac = calloc(1, sizeof(Elm_Access_Info));
504 item->access = ac;
416} 505}
417 506
418EAPI Eina_Bool 507EAPI Eina_Bool
@@ -435,9 +524,3 @@ _elm_access_2nd_click_timeout(Evas_Object *obj)
435 _access_2nd_click_del_cb, NULL); 524 _access_2nd_click_del_cb, NULL);
436 return EINA_FALSE; 525 return EINA_FALSE;
437} 526}
438
439// XXX special version for items
440//EAPI void
441//_elm_access_item_hover_register(Elm_Widget_Item *item, Evas_Object *hoverobj)
442//{
443//}