3d, gesturelayer, index, naviframe, transit, fileselector, frame, glview, layout...
[framework/uifw/elementary.git] / src / lib / elc_naviframe.h
1 /**
2  * @defgroup Naviframe Naviframe
3  * @ingroup Elementary
4  *
5  * @brief Naviframe is a kind of view manager for the applications.
6  *
7  * Naviframe provides functions to switch different pages with stack
8  * mechanism. It means if one page(item) needs to be changed to the new one,
9  * then naviframe would push the new page to its internal stack. Of course,
10  * it can be back to the previous page by popping the top page. Naviframe
11  * provides some transition effect while the pages are switching (same as
12  * pager).
13  *
14  * Since each item could keep the different styles, users could keep the
15  * same look & feel for the pages or different styles for the items in it's
16  * application.
17  * 
18  * Default content parts of the naviframe that you can use content hooks for
19  * are:
20  * @li "default" - The main content of the current page
21  * @li "icon" - An icon in the title area of the current page
22  * @li "prev_btn" - A button of the current page to go to the previous page
23  * @li "next_btn" - A button of the current page to go to the next page
24  * 
25  * Default text parts of the naviframe that you can use for are:
26  * @li "default" - Title label in the title area of the current page
27  * @li "subtitle" - Sub-title label in the title area of the current page
28  *
29  * Signals that you can add callbacks for are:
30  * @li "transition,finished" - When the transition is finished in changing the
31  * item
32  * @li "title,clicked" - User clicked title area
33  *
34  * Item Signals that you can add callbacks for are:
35  * @li "show,begin" - When the item is started to be top item.
36  * @li "hide,finished" - When a new top item is finished to push onto the
37  * item.
38  *
39  * Default content parts of the naviframe items that you can use content hooks
40  * for are:
41  * @li "default" - The main content of the page
42  * @li "icon" - An icon in the title area
43  * @li "prev_btn" - A button to go to the previous page
44  * @li "next_btn" - A button to go to the next page
45  *
46  * Default text parts of the naviframe items that you can use for are:
47  * @li "default" - Title label in the title area
48  * @li "subtitle" - Sub-title label in the title area
49  *
50  * Supported elm_object common APIs.
51  * @li elm_object_signal_emit
52  * @li elm_object_part_text_set
53  * @li elm_object_part_text_get
54  * @li elm_object_part_content_set
55  * @li elm_object_part_content_get
56  * @li elm_object_part_content_unset
57  *
58  * Supported elm_object_item common APIs.
59  * @li elm_object_item_part_text_set
60  * @li elm_object_item_part_text_get
61  * @li elm_object_item_part_content_set
62  * @li elm_object_item_part_content_get
63  * @li elm_object_item_part_content_unset
64  * @li elm_object_item_signal_emit
65  */
66
67 /**
68  * @addtogroup Naviframe
69  * @{
70  */
71
72 /**
73  * @brief Add a new Naviframe object to the parent.
74  *
75  * @param parent Parent object
76  * @return New object or @c NULL, if it cannot be created
77  *
78  * @ingroup Naviframe
79  */
80 EAPI Evas_Object     *elm_naviframe_add(Evas_Object *parent);
81
82 /**
83  * @brief Push a new item to the top of the naviframe stack (and show it).
84  *
85  * @param obj The naviframe object
86  * @param title_label The label in the title area. The name of the title
87  *        label part is "elm.text.title"
88  * @param prev_btn The button to go to the previous item. If it is NULL,
89  *        then naviframe will create a back button automatically. The name of
90  *        the prev_btn part is "elm.swallow.prev_btn"
91  * @param next_btn The button to go to the next item. Or It could be just an
92  *        extra function button. The name of the next_btn part is
93  *        "elm.swallow.next_btn"
94  * @param content The main content object. The name of content part is
95  *        "elm.swallow.content"
96  * @param item_style The current item style name. @c NULL would be default.
97  * @return The created item or @c NULL upon failure.
98  *
99  * The item pushed becomes one page of the naviframe, this item will be
100  * deleted when it is popped.
101  *
102  * @see also elm_naviframe_item_style_set()
103  * @see also elm_naviframe_item_insert_before()
104  * @see also elm_naviframe_item_insert_after()
105  *
106  * The following styles are available for this item:
107  * @li @c "default"
108  *
109  * @ingroup Naviframe
110  */
111 EAPI Elm_Object_Item *elm_naviframe_item_push(Evas_Object *obj, const char *title_label, Evas_Object *prev_btn, Evas_Object *next_btn, Evas_Object *content, const char *item_style);
112
113 /**
114  * @brief Insert a new item into the naviframe before item @p before.
115  *
116  * @param obj The naviframe object
117  * @param before The naviframe item to insert before.
118  * @param title_label The label in the title area. The name of the title
119  *        label part is "elm.text.title"
120  * @param prev_btn The button to go to the previous item. If it is NULL,
121  *        then naviframe will create a back button automatically. The name of
122  *        the prev_btn part is "elm.swallow.prev_btn"
123  * @param next_btn The button to go to the next item. Or It could be just an
124  *        extra function button. The name of the next_btn part is
125  *        "elm.swallow.next_btn"
126  * @param content The main content object. The name of content part is
127  *        "elm.swallow.content"
128  * @param item_style The current item style name. @c NULL would be default.
129  * @return The created item or @c NULL upon failure.
130  *
131  * The item is inserted into the naviframe straight away without any
132  * transition operations. This item will be deleted when it is popped.
133  *
134  * @see also elm_naviframe_item_style_set()
135  * @see also elm_naviframe_item_push()
136  * @see also elm_naviframe_item_insert_after()
137  *
138  * The following styles are available for this item:
139  * @li @c "default"
140  *
141  * @ingroup Naviframe
142  */
143 EAPI Elm_Object_Item *elm_naviframe_item_insert_before(Evas_Object *obj, Elm_Object_Item *before, const char *title_label, Evas_Object *prev_btn, Evas_Object *next_btn, Evas_Object *content, const char *item_style);
144
145 /**
146  * @brief Insert a new item into the naviframe after item @p after.
147  *
148  * @param obj The naviframe object
149  * @param after The naviframe item to insert after.
150  * @param title_label The label in the title area. The name of the title
151  *        label part is "elm.text.title"
152  * @param prev_btn The button to go to the previous item. If it is NULL,
153  *        then naviframe will create a back button automatically. The name of
154  *        the prev_btn part is "elm.swallow.prev_btn"
155  * @param next_btn The button to go to the next item. Or It could be just an
156  *        extra function button. The name of the next_btn part is
157  *        "elm.swallow.next_btn"
158  * @param content The main content object. The name of content part is
159  *        "elm.swallow.content"
160  * @param item_style The current item style name. @c NULL would be default.
161  * @return The created item or @c NULL upon failure.
162  *
163  * The item is inserted into the naviframe straight away without any
164  * transition operations. This item will be deleted when it is popped.
165  *
166  * @see also elm_naviframe_item_style_set()
167  * @see also elm_naviframe_item_push()
168  * @see also elm_naviframe_item_insert_before()
169  *
170  * The following styles are available for this item:
171  * @li @c "default"
172  *
173  * @ingroup Naviframe
174  */
175 EAPI Elm_Object_Item *elm_naviframe_item_insert_after(Evas_Object *obj, Elm_Object_Item *after, const char *title_label, Evas_Object *prev_btn, Evas_Object *next_btn, Evas_Object *content, const char *item_style);
176
177 /**
178  * @brief Pop an item that is on top of the stack
179  *
180  * @param obj The naviframe object
181  * @return @c NULL or the content object(if the
182  *         elm_naviframe_content_preserve_on_pop_get is true).
183  *
184  * This pops an item that is on the top(visible) of the naviframe, makes it
185  * disappear, then deletes the item. The item that was underneath it on the
186  * stack will become visible.
187  *
188  * @see also elm_naviframe_content_preserve_on_pop_get()
189  *
190  * @ingroup Naviframe
191  */
192 EAPI Evas_Object     *elm_naviframe_item_pop(Evas_Object *obj);
193
194 /**
195  * @brief Pop the items between the top and the above one on the given item.
196  *
197  * @param it The naviframe item
198  *
199  * @ingroup Naviframe
200  */
201 EAPI void             elm_naviframe_item_pop_to(Elm_Object_Item *it);
202
203 /**
204  * Promote an item already in the naviframe stack to the top of the stack
205  *
206  * @param it The naviframe item
207  *
208  * This will take the indicated item and promote it to the top of the stack
209  * as if it had been pushed there. The item must already be inside the
210  * naviframe stack to work.
211  *
212  */
213 EAPI void             elm_naviframe_item_promote(Elm_Object_Item *it);
214
215 /**
216  * @brief preserve the content objects when items are popped.
217  *
218  * @param obj The naviframe object
219  * @param preserve Enable the preserve mode if EINA_TRUE, disable otherwise
220  *
221  * @see also elm_naviframe_content_preserve_on_pop_get()
222  *
223  * @ingroup Naviframe
224  */
225 EAPI void             elm_naviframe_content_preserve_on_pop_set(Evas_Object *obj, Eina_Bool preserve);
226
227 /**
228  * @brief Get a value whether preserve mode is enabled or not.
229  *
230  * @param obj The naviframe object
231  * @return If @c EINA_TRUE, preserve mode is enabled
232  *
233  * @see also elm_naviframe_content_preserve_on_pop_set()
234  *
235  * @ingroup Naviframe
236  */
237 EAPI Eina_Bool        elm_naviframe_content_preserve_on_pop_get(const Evas_Object *obj);
238
239 /**
240  * @brief Get a top item on the naviframe stack
241  *
242  * @param obj The naviframe object
243  * @return The top item on the naviframe stack or @c NULL, if the stack is
244  *         empty
245  *
246  * @ingroup Naviframe
247  */
248 EAPI Elm_Object_Item *elm_naviframe_top_item_get(const Evas_Object *obj);
249
250 /**
251  * @brief Get a bottom item on the naviframe stack
252  *
253  * @param obj The naviframe object
254  * @return The bottom item on the naviframe stack or @c NULL, if the stack is
255  *         empty
256  *
257  * @ingroup Naviframe
258  */
259 EAPI Elm_Object_Item *elm_naviframe_bottom_item_get(const Evas_Object *obj);
260
261 /**
262  * @brief Set an item style
263  *
264  * @param it The naviframe item
265  * @param item_style The current item style name. @c NULL would be default
266  *
267  * The following styles are available for this item:
268  * @li @c "default"
269  *
270  * @see also elm_naviframe_item_style_get()
271  *
272  * @ingroup Naviframe
273  */
274 EAPI void             elm_naviframe_item_style_set(Elm_Object_Item *it, const char *item_style);
275
276 /**
277  * @brief Get an item style
278  *
279  * @param it The naviframe item
280  * @return The current item style name
281  *
282  * @see also elm_naviframe_item_style_set()
283  *
284  * @ingroup Naviframe
285  */
286 EAPI const char      *elm_naviframe_item_style_get(const Elm_Object_Item *it);
287
288 /**
289  * @brief Show/Hide the title area
290  *
291  * @param it The naviframe item
292  * @param visible If @c EINA_TRUE, title area will be visible, hidden
293  *        otherwise
294  *
295  * When the title area is invisible, then the controls would be hidden so as     * to expand the content area to full-size.
296  *
297  * @see also elm_naviframe_item_title_visible_get()
298  *
299  * @ingroup Naviframe
300  */
301 EAPI void             elm_naviframe_item_title_visible_set(Elm_Object_Item *it, Eina_Bool visible);
302
303 /**
304  * @brief Get a value whether title area is visible or not.
305  *
306  * @param it The naviframe item
307  * @return If @c EINA_TRUE, title area is visible
308  *
309  * @see also elm_naviframe_item_title_visible_set()
310  *
311  * @ingroup Naviframe
312  */
313 EAPI Eina_Bool        elm_naviframe_item_title_visible_get(const Elm_Object_Item *it);
314
315 /**
316  * @brief Set creating prev button automatically or not
317  *
318  * @param obj The naviframe object
319  * @param auto_pushed If @c EINA_TRUE, the previous button(back button) will
320  *        be created internally when you pass the @c NULL to the prev_btn
321  *        parameter in elm_naviframe_item_push
322  *
323  * @see also elm_naviframe_item_push()
324  *
325  * @ingroup Naviframe
326  */
327 EAPI void             elm_naviframe_prev_btn_auto_pushed_set(Evas_Object *obj, Eina_Bool auto_pushed);
328
329 /**
330  * @brief Get a value whether prev button(back button) will be auto pushed or
331  *        not.
332  *
333  * @param obj The naviframe object
334  * @return If @c EINA_TRUE, prev button will be auto pushed.
335  *
336  * @see also elm_naviframe_item_push()
337  *           elm_naviframe_prev_btn_auto_pushed_set()
338  *
339  * @ingroup Naviframe
340  */
341 EAPI Eina_Bool        elm_naviframe_prev_btn_auto_pushed_get(const Evas_Object *obj);
342
343 /**
344  * @brief Get a list of all the naviframe items.
345  *
346  * @param obj The naviframe object
347  * @return An Eina_List of naviframe items, #Elm_Object_Item,
348  * or @c NULL on failure.
349  * @note The returned list MUST be freed.
350  *
351  * @ingroup Naviframe
352  */
353 EAPI Eina_List *elm_naviframe_items_get(const Evas_Object *obj) EINA_MALLOC EINA_WARN_UNUSED_RESULT;
354
355 /**
356  * @brief Set the event enabled when pushing/popping items
357  *
358  * If @c enabled is EINA_TRUE, the contents of the naviframe item will
359  * receives events from mouse and keyboard during view changing such as
360  * item push/pop.
361  *
362  * @param obj The naviframe object
363  * @param enabled Events are received when enabled is @c EINA_TRUE, and
364  * ignored otherwise.
365  *
366  * @warning Events will be blocked by calling evas_object_freeze_events_set()
367  * internally. So don't call the API whiling pushing/popping items.
368  *
369  * @see elm_naviframe_event_enabled_get()
370  * @see evas_object_freeze_events_set()
371  *
372  * @ingroup Naviframe
373  */
374 EAPI void             elm_naviframe_event_enabled_set(Evas_Object *obj, Eina_Bool enabled);
375
376 /**
377  * @brief Get the value of event enabled status.
378  *
379  * @param obj The naviframe object
380  * @return EINA_TRUE, when event is enabled
381  *
382  * @see elm_naviframe_event_enabled_set()
383  *
384  * @ingroup Naviframe
385  */
386 EAPI Eina_Bool        elm_naviframe_event_enabled_get(const Evas_Object *obj);
387
388 /**
389  * @brief Simple version of item_push.
390  *
391  * @see elm_naviframe_item_push
392  */
393 static inline Elm_Object_Item *
394 elm_naviframe_item_simple_push(Evas_Object *obj, Evas_Object *content)
395 {
396    Elm_Object_Item *it;
397    it = elm_naviframe_item_push(obj, NULL, NULL, NULL, content, NULL);
398    elm_naviframe_item_title_visible_set(it, EINA_FALSE);
399    return it;
400 }
401
402 /**
403  * @brief Simple version of item_promote.
404  *
405  * @see elm_naviframe_item_promote
406  */
407 EAPI void             elm_naviframe_item_simple_promote(Evas_Object *obj, Evas_Object *content);
408
409 /**
410  * @}
411  */