summaryrefslogtreecommitdiff
path: root/src/lib/elementary/elm_clock.c
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel-hollerbach@t-online.de>2017-09-29 22:45:30 +0200
committerMarcel Hollerbach <marcel-hollerbach@t-online.de>2017-10-10 19:28:47 +0200
commit5b015aa8816a8a37cca5c5b1195137938f1bb9e2 (patch)
treea9f608e41c9155a79d077f1c259784cf0d2a9c17 /src/lib/elementary/elm_clock.c
parent35a01340d3ed53960d6283e8f5f4e86c0d5be72e (diff)
elm_clock: convert to composition!
Diffstat (limited to 'src/lib/elementary/elm_clock.c')
-rw-r--r--src/lib/elementary/elm_clock.c110
1 files changed, 45 insertions, 65 deletions
diff --git a/src/lib/elementary/elm_clock.c b/src/lib/elementary/elm_clock.c
index ce57663..c7b940c 100644
--- a/src/lib/elementary/elm_clock.c
+++ b/src/lib/elementary/elm_clock.c
@@ -3,10 +3,12 @@
3#endif 3#endif
4 4
5#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED 5#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED
6#define EFL_UI_FOCUS_COMPOSITION_PROTECTED
6 7
7#include <Elementary.h> 8#include <Elementary.h>
8#include "elm_priv.h" 9#include "elm_priv.h"
9#include "elm_widget_clock.h" 10#include "elm_widget_clock.h"
11#include "efl_ui_focus_composition.eo.h"
10 12
11#define MY_CLASS ELM_CLOCK_CLASS 13#define MY_CLASS ELM_CLOCK_CLASS
12 14
@@ -338,6 +340,48 @@ _access_time_register(Evas_Object *obj, Eina_Bool is_access)
338 340
339} 341}
340 342
343static Evas_Object*
344_part_get(Evas_Object *part, const char *part_name)
345{
346 Evas_Object *po;
347
348 po = (Evas_Object *)edje_object_part_object_get
349 (part, part_name);
350
351 if (_elm_config->access_mode != ELM_ACCESS_MODE_ON)
352 return po;
353
354 return evas_object_data_get(po, "_part_access_obj");
355}
356
357static void
358_flush_clock_composite_elements(Evas_Object *obj, Elm_Clock_Data *sd)
359{
360 Eina_List *items = NULL;
361 int i;
362
363 if (sd->edit)
364 {
365 for (i = 0; i < 6; i++)
366 {
367 if ((!sd->seconds) && (i >= 4)) break;
368 if (sd->digedit & (1 << i))
369 {
370 items = eina_list_append(items, _part_get(sd->digit[i], "access.t"));
371 items = eina_list_append(items, _part_get(sd->digit[i], "access.b"));
372 }
373 }
374
375 if (sd->am_pm)
376 {
377 items = eina_list_append(items, _part_get(sd->am_pm_obj, "access.t"));
378 items = eina_list_append(items, _part_get(sd->am_pm_obj, "access.b"));
379 }
380 }
381
382 efl_ui_focus_composition_elements_set(obj, items);
383}
384
341static void 385static void
342_time_update(Evas_Object *obj, Eina_Bool theme_update) 386_time_update(Evas_Object *obj, Eina_Bool theme_update)
343{ 387{
@@ -468,6 +512,7 @@ _time_update(Evas_Object *obj, Eina_Bool theme_update)
468 sd->cur.am_pm = sd->am_pm; 512 sd->cur.am_pm = sd->am_pm;
469 sd->cur.edit = sd->edit; 513 sd->cur.edit = sd->edit;
470 sd->cur.digedit = sd->digedit; 514 sd->cur.digedit = sd->digedit;
515 _flush_clock_composite_elements(obj, sd);
471 } 516 }
472 if (sd->hrs != sd->cur.hrs) 517 if (sd->hrs != sd->cur.hrs)
473 { 518 {
@@ -701,65 +746,6 @@ _elm_clock_efl_canvas_group_group_del(Eo *obj, Elm_Clock_Data *sd)
701 746
702static Eina_Bool _elm_clock_smart_focus_next_enable = EINA_FALSE; 747static Eina_Bool _elm_clock_smart_focus_next_enable = EINA_FALSE;
703 748
704EOLIAN static Eina_Bool
705_elm_clock_elm_widget_focus_next_manager_is(Eo *obj EINA_UNUSED, Elm_Clock_Data *_pd EINA_UNUSED)
706{
707 return _elm_clock_smart_focus_next_enable;
708}
709
710EOLIAN static Eina_Bool
711_elm_clock_elm_widget_focus_next(Eo *obj, Elm_Clock_Data *sd, Elm_Focus_Direction dir, Evas_Object **next, Elm_Object_Item **next_item)
712{
713 Evas_Object *ao, *po;
714 Eina_List *items = NULL;
715
716
717 if (!sd->edit)
718 {
719 *next = (Evas_Object *)obj;
720 return !elm_widget_highlight_get(obj);
721 }
722 else if (!elm_widget_highlight_get(obj))
723 {
724 *next = (Evas_Object *)obj;
725 return EINA_TRUE;
726 }
727
728 int i;
729 for (i = 0; i < 6; i++)
730 {
731 if ((!sd->seconds) && (i >= 4)) break;
732 if (sd->digedit & (1 << i))
733 {
734 po = (Evas_Object *)edje_object_part_object_get
735 (sd->digit[i], "access.t");
736 ao = evas_object_data_get(po, "_part_access_obj");
737 items = eina_list_append(items, ao);
738
739 po = (Evas_Object *)edje_object_part_object_get
740 (sd->digit[i], "access.b");
741 ao = evas_object_data_get(po, "_part_access_obj");
742 items = eina_list_append(items, ao);
743 }
744 }
745
746 if (sd->am_pm)
747 {
748 po = (Evas_Object *)edje_object_part_object_get
749 (sd->am_pm_obj, "access.t");
750 ao = evas_object_data_get(po, "_part_access_obj");
751 items = eina_list_append(items, ao);
752
753 po = (Evas_Object *)edje_object_part_object_get
754 (sd->am_pm_obj, "access.b");
755 ao = evas_object_data_get(po, "_part_access_obj");
756 items = eina_list_append(items, ao);
757 }
758
759 return elm_widget_focus_list_next_get
760 (obj, items, eina_list_data_get, dir, next, next_item);
761}
762
763static void 749static void
764_access_obj_process(Evas_Object *obj, Eina_Bool is_access) 750_access_obj_process(Evas_Object *obj, Eina_Bool is_access)
765{ 751{
@@ -941,12 +927,6 @@ _elm_clock_pause_get(Eo *obj EINA_UNUSED, Elm_Clock_Data *sd)
941 return sd->paused; 927 return sd->paused;
942} 928}
943 929
944EOLIAN static Eina_Bool
945_elm_clock_elm_widget_focus_direction_manager_is(Eo *obj EINA_UNUSED, Elm_Clock_Data *_pd EINA_UNUSED)
946{
947 return EINA_FALSE;
948}
949
950static void 930static void
951_elm_clock_class_constructor(Efl_Class *klass) 931_elm_clock_class_constructor(Efl_Class *klass)
952{ 932{