tizen 2.4 release
[framework/uifw/elementary.git] / src / lib / elm_widget_dayselector.h
1 #ifndef ELM_WIDGET_DAYSELECTOR_H
2 #define ELM_WIDGET_DAYSELECTOR_H
3
4 #include "Elementary.h"
5 #include "elm_dayselector_item.eo.h"
6
7
8 /* DO NOT USE THIS HEADER UNLESS YOU ARE PREPARED FOR BREAKING OF YOUR
9  * CODE. THIS IS ELEMENTARY'S INTERNAL WIDGET API (for now) AND IS NOT
10  * FINAL. CALL elm_widget_api_check(ELM_INTERNAL_API_VERSION) TO CHECK
11  * IT AT RUNTIME.
12  */
13
14 /**
15  * @internal
16  * @addtogroup Widget
17  * @{
18  *
19  * @section elm-dayselector-class The Elementary Dayselector Class
20  *
21  * Elementary, besides having the @ref Dayselector widget, exposes its
22  * foundation -- the Elementary Dayselector Class -- in order to create other
23  * widgets which are a dayselector with some more logic on top.
24  */
25
26 /**
27  * Base layout smart data extended with dayselector instance data.
28  */
29 typedef struct _Elm_Dayselector_Data Elm_Dayselector_Data;
30 struct _Elm_Dayselector_Data
31 {
32    Eina_List            *items;
33    Elm_Dayselector_Day   week_start;
34    Elm_Dayselector_Day   weekend_start;
35    unsigned int          weekend_len;
36    Eina_Bool weekdays_names_set : 1;
37 };
38
39 typedef struct _Elm_Dayselector_Item_Data       Elm_Dayselector_Item_Data;
40 struct _Elm_Dayselector_Item_Data
41 {
42    Elm_Widget_Item_Data *base;
43    Elm_Dayselector_Day day;
44    const char         *day_style;
45 };
46
47 /**
48  * @}
49  */
50
51 #define ELM_DAYSELECTOR_DATA_GET(o, sd) \
52   Elm_Dayselector_Data * sd = eo_data_scope_get(o, ELM_DAYSELECTOR_CLASS)
53
54 #define ELM_DAYSELECTOR_DATA_GET_OR_RETURN(o, ptr)   \
55   ELM_DAYSELECTOR_DATA_GET(o, ptr);                  \
56   if (EINA_UNLIKELY(!ptr))                           \
57     {                                                \
58        CRI("No widget data for object %p (%s)",      \
59            o, evas_object_type_get(o));              \
60        return;                                       \
61     }
62
63 #define ELM_DAYSELECTOR_DATA_GET_OR_RETURN_VAL(o, ptr, val) \
64   ELM_DAYSELECTOR_DATA_GET(o, ptr);                         \
65   if (EINA_UNLIKELY(!ptr))                                  \
66     {                                                       \
67        CRI("No widget data for object %p (%s)",             \
68            o, evas_object_type_get(o));                     \
69        return val;                                          \
70     }
71
72 #define ELM_DAYSELECTOR_CHECK(obj)                              \
73   if (EINA_UNLIKELY(!eo_isa((obj), ELM_DAYSELECTOR_CLASS))) \
74     return
75
76 #define ELM_DAYSELECTOR_ITEM_DATA_GET(o, sd) \
77   Elm_Dayselector_Item_Data * sd = eo_data_scope_get(o, ELM_DAYSELECTOR_ITEM_CLASS)
78
79 #endif