1 #ifndef ELM_WIDGET_NAVIFRAME_H
2 #define ELM_WIDGET_NAVIFRAME_H
3 
4 #include "Elementary.h"
5 
6 /* DO NOT USE THIS HEADER UNLESS YOU ARE PREPARED FOR BREAKING OF YOUR
7  * CODE. THIS IS ELEMENTARY'S INTERNAL WIDGET API (for now) AND IS NOT
8  * FINAL. CALL elm_widget_api_check(ELM_INTERNAL_API_VERSION) TO CHECK
9  * IT AT RUNTIME.
10  */
11 
12 /**
13  * @addtogroup Widget
14  * @{
15  *
16  * @section elm-naviframe-class The Elementary Naviframe Class
17  *
18  * Elementary, besides having the @ref Naviframe widget, exposes its
19  * foundation -- the Elementary Naviframe Class -- in order to create other
20  * widgets which are a naviframe with some more logic on top.
21  */
22 
23 /**
24  * Base layout smart data extended with naviframe instance data.
25  */
26 typedef struct _Elm_Naviframe_Data Elm_Naviframe_Data;
27 struct _Elm_Naviframe_Data
28 {
29    Evas_Object          *obj; /* the object itself */
30    Eina_Inlist          *stack; /* top item is the list's LAST item */
31    Eina_List            *popping;
32    Eina_List            *ops;
33    Evas_Object          *dummy_edje;
34    Evas_Display_Mode     dispmode;
35 
36    Eina_Bool             preserve : 1;
37    Eina_Bool             on_deletion : 1;
38    Eina_Bool             auto_pushed : 1;
39    Eina_Bool             freeze_events : 1;
40 };
41 
42 typedef struct _Elm_Naviframe_Item_Data Elm_Naviframe_Item_Data;
43 struct _Elm_Naviframe_Item_Data
44 {
45    Elm_Widget_Item_Data *base;
46    EINA_INLIST;
47 
48    Eina_Inlist *content_list;
49    Eina_Inlist *text_list;
50    Evas_Object *content;
51    Evas_Object *title_prev_btn;
52    Evas_Object *title_next_btn;
53    Evas_Object *title_icon;
54    Evas_Object *auto_pushed_btn;
55    Evas_Display_Mode dispmode;
56    Elm_Naviframe_Item_Pop_Cb pop_cb;
57    void        *pop_data;
58    const char  *title_label;
59    const char  *subtitle_label;
60 
61    Evas_Coord   minw;
62    Evas_Coord   minh;
63 
64    Eina_Bool    title_enabled : 1;
65    Eina_Bool    pushing : 1; /**< a flag to notify the item is on pushing. This flag is set true at the start of item push. */
66    Eina_Bool    popping : 1; /**< a flag to notify the item is on poping. this flag is set true at the start of item pop. */
67    Eina_Bool    delete_me : 1; /**< a flag to notify the item is on deletion. this flag is set true at the start of item deletion. */
68 };
69 
70 typedef struct _Elm_Naviframe_Op Elm_Naviframe_Op;
71 struct _Elm_Naviframe_Op
72 {
73    Elm_Naviframe_Item_Data *self;
74    Elm_Naviframe_Item_Data *related;
75 
76    Eina_Bool push : 1;
77 };
78 
79 typedef struct _Elm_Naviframe_Content_Item_Pair Elm_Naviframe_Content_Item_Pair;
80 struct _Elm_Naviframe_Content_Item_Pair
81 {
82    EINA_INLIST;
83    const char *part;
84    Evas_Object *content;
85    Elm_Naviframe_Item_Data *it;
86 };
87 
88 typedef struct _Elm_Naviframe_Text_Item_Pair Elm_Naviframe_Text_Item_Pair;
89 struct _Elm_Naviframe_Text_Item_Pair
90 {
91    EINA_INLIST;
92    const char *part;
93 };
94 
95 /**
96  * @}
97  */
98 
99 #define ELM_NAVIFRAME_DATA_GET(o, sd) \
100   Elm_Naviframe_Data * sd = efl_data_scope_get(o, ELM_NAVIFRAME_CLASS)
101 
102 #define ELM_NAVIFRAME_DATA_GET_OR_RETURN(o, ptr)     \
103   ELM_NAVIFRAME_DATA_GET(o, ptr);                    \
104   if (EINA_UNLIKELY(!ptr))                           \
105     {                                                \
106        ERR("No widget data for object %p (%s)",      \
107            o, evas_object_type_get(o));              \
108        return;                                       \
109     }
110 
111 #define ELM_NAVIFRAME_DATA_GET_OR_RETURN_VAL(o, ptr, val) \
112   ELM_NAVIFRAME_DATA_GET(o, ptr);                         \
113   if (EINA_UNLIKELY(!ptr))                                \
114     {                                                     \
115        ERR("No widget data for object %p (%s)",           \
116            o, evas_object_type_get(o));                   \
117        return val;                                        \
118     }
119 
120 #define ELM_NAVIFRAME_CHECK(obj)                                 \
121   if (EINA_UNLIKELY(!efl_isa((obj), ELM_NAVIFRAME_CLASS)))    \
122     return
123 
124 #define ELM_NAVIFRAME_ITEM_CHECK(it)                        \
125   if (EINA_UNLIKELY(!efl_isa((it->base->eo_obj), ELM_NAVIFRAME_ITEM_CLASS))) \
126     return
127 
128 #define ELM_NAVIFRAME_ITEM_CHECK_OR_RETURN(it, ...)        \
129   if (EINA_UNLIKELY(!efl_isa((it->base->eo_obj), ELM_NAVIFRAME_ITEM_CLASS))) \
130     return __VA_ARGS__;
131 
132 #define ELM_NAVIFRAME_ITEM_DATA_GET(o, sd) \
133   Elm_Naviframe_Item_Data *sd = efl_data_scope_get(o, ELM_NAVIFRAME_ITEM_CLASS)
134 
135 #endif
136