summaryrefslogtreecommitdiff
path: root/src/lib/elementary
diff options
context:
space:
mode:
authorWooHyun Jung <wh0705.jung@samsung.com>2017-11-06 16:28:29 +0900
committerWooHyun Jung <wh0705.jung@samsung.com>2017-11-06 16:28:29 +0900
commit68b366c83175458a67c0655519a44d1ea1a48419 (patch)
tree55496edccf8b4d34ba938842685ca47061d26d89 /src/lib/elementary
parenta386597ad92a1022ba41f94afdb28bdf9136d551 (diff)
efl_ui_calendar: apply efl_ui_focus_composition
Diffstat (limited to 'src/lib/elementary')
-rw-r--r--src/lib/elementary/efl_ui_calendar.c81
-rw-r--r--src/lib/elementary/efl_ui_calendar_item.eo14
2 files changed, 95 insertions, 0 deletions
diff --git a/src/lib/elementary/efl_ui_calendar.c b/src/lib/elementary/efl_ui_calendar.c
index 605f8274ff..a76688d569 100644
--- a/src/lib/elementary/efl_ui_calendar.c
+++ b/src/lib/elementary/efl_ui_calendar.c
@@ -4,10 +4,12 @@
4 4
5#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED 5#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED
6#define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED 6#define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED
7#define EFL_UI_FOCUS_COMPOSITION_PROTECTED
7 8
8#include <Elementary.h> 9#include <Elementary.h>
9#include "elm_priv.h" 10#include "elm_priv.h"
10#include "efl_ui_calendar_private.h" 11#include "efl_ui_calendar_private.h"
12#include "efl_ui_calendar_item.eo.h"
11 13
12#define MY_CLASS EFL_UI_CALENDAR_CLASS 14#define MY_CLASS EFL_UI_CALENDAR_CLASS
13 15
@@ -294,6 +296,28 @@ _access_calendar_register(Evas_Object *obj)
294} 296}
295 297
296static void 298static void
299_flush_calendar_composite_elements(Evas_Object *obj, Efl_Ui_Calendar_Data *sd)
300{
301 Eina_List *items = NULL;
302 int max_day = _maxdays_get(&sd->shown_date, 0);
303
304#define EXTEND(v) \
305 if (v) items = eina_list_append(items, v); \
306
307 EXTEND(sd->month_access);
308 EXTEND(sd->dec_btn_month);
309 EXTEND(sd->inc_btn_month);
310 EXTEND(sd->year_access);
311
312#undef EXTEND
313
314 for (int i = sd->first_day_it; i <= max_day; ++i)
315 items = eina_list_append(items, sd->items[i]);
316
317 efl_ui_focus_composition_elements_set(obj, items);
318}
319
320static void
297_populate(Evas_Object *obj) 321_populate(Evas_Object *obj)
298{ 322{
299 int maxdays, prev_month_maxdays, day, mon, yr, i; 323 int maxdays, prev_month_maxdays, day, mon, yr, i;
@@ -381,6 +405,8 @@ _populate(Evas_Object *obj)
381 405
382 elm_layout_thaw(obj); 406 elm_layout_thaw(obj);
383 edje_object_message_signal_process(elm_layout_edje_get(obj)); 407 edje_object_message_signal_process(elm_layout_edje_get(obj));
408
409 _flush_calendar_composite_elements(obj, sd);
384} 410}
385 411
386static void 412static void
@@ -986,6 +1012,13 @@ _efl_ui_calendar_constructor_internal(Eo *obj, Efl_Ui_Calendar_Data *priv)
986 if ((_elm_config->access_mode != ELM_ACCESS_MODE_OFF)) 1012 if ((_elm_config->access_mode != ELM_ACCESS_MODE_OFF))
987 _access_calendar_spinner_register(obj); 1013 _access_calendar_spinner_register(obj);
988 1014
1015 // Items for composition
1016 for (int i = 0; i < 42; ++i)
1017 {
1018 priv->items[i] = efl_add(EFL_UI_CALENDAR_ITEM_CLASS, obj,
1019 efl_ui_calendar_item_day_number_set(efl_added, i));
1020 }
1021
989 return obj; 1022 return obj;
990} 1023}
991 1024
@@ -1239,3 +1272,51 @@ ELM_WIDGET_KEY_DOWN_DEFAULT_IMPLEMENT(efl_ui_calendar, Efl_Ui_Calendar_Data)
1239 ELM_LAYOUT_SIZING_EVAL_OPS(efl_ui_calendar) 1272 ELM_LAYOUT_SIZING_EVAL_OPS(efl_ui_calendar)
1240 1273
1241#include "efl_ui_calendar.eo.c" 1274#include "efl_ui_calendar.eo.c"
1275
1276typedef struct {
1277 int v;
1278 Evas_Object *part;
1279} Efl_Ui_Calendar_Item_Data;
1280
1281EOLIAN static void
1282_efl_ui_calendar_item_day_number_set(Eo *obj, Efl_Ui_Calendar_Item_Data *pd, int i)
1283{
1284 char pname[14];
1285 Evas_Object *po;
1286
1287 pd->v = i;
1288 snprintf(pname, sizeof(pname), "cit_%i.access", i);
1289
1290 po = (Evas_Object *)edje_object_part_object_get
1291 (elm_layout_edje_get(efl_parent_get(obj)), pname);
1292
1293 if (_elm_config->access_mode != ELM_ACCESS_MODE_ON)
1294 pd->part = po;
1295 else
1296 pd->part = evas_object_data_get(po, "_part_access_obj");
1297
1298 EINA_SAFETY_ON_NULL_RETURN(pd->part);
1299}
1300
1301EOLIAN static int
1302_efl_ui_calendar_item_day_number_get(Eo *obj EINA_UNUSED, Efl_Ui_Calendar_Item_Data *pd)
1303{
1304 return pd->v;
1305}
1306
1307EOLIAN static void
1308_efl_ui_calendar_item_efl_ui_focus_object_focus_set(Eo *obj, Efl_Ui_Calendar_Item_Data *pd, Eina_Bool focus)
1309{
1310 efl_ui_focus_object_focus_set(efl_super(obj, EFL_UI_CALENDAR_ITEM_CLASS), focus);
1311
1312 _update_focused_it(efl_parent_get(obj), pd->v);
1313 evas_object_focus_set(pd->part, efl_ui_focus_object_focus_get(obj));
1314}
1315
1316EOLIAN static Eina_Rect
1317_efl_ui_calendar_item_efl_ui_focus_object_focus_geometry_get(Eo *obj EINA_UNUSED, Efl_Ui_Calendar_Item_Data *pd)
1318{
1319 return efl_gfx_geometry_get(pd->part);
1320}
1321
1322#include "efl_ui_calendar_item.eo.c"
diff --git a/src/lib/elementary/efl_ui_calendar_item.eo b/src/lib/elementary/efl_ui_calendar_item.eo
new file mode 100644
index 0000000000..4a4fd78907
--- /dev/null
+++ b/src/lib/elementary/efl_ui_calendar_item.eo
@@ -0,0 +1,14 @@
1class Efl.Ui.Calendar.Item (Efl.Object, Efl.Ui.Focus.Object)
2{
3 methods {
4 @property day_number {
5 values {
6 i : int;
7 }
8 }
9 }
10 implements {
11 Efl.Ui.Focus.Object.focus {set;}
12 Efl.Ui.Focus.Object.focus_geometry {get;}
13 }
14}