7ef9a77975da215c0a0c3cd78d59f735ea659a75
[framework/uifw/elementary.git] / src / lib / elm_flip.h
1 /**
2  * @defgroup Flip Flip
3  *
4  * @image html img/widget/flip/preview-00.png
5  * @image latex img/widget/flip/preview-00.eps
6  *
7  * This widget holds 2 content objects(Evas_Object): one on the front and one
8  * on the back. It allows you to flip from front to back and vice-versa using
9  * various animations.
10  *
11  * If either the front or back contents are not set the flip will treat that
12  * as transparent. So if you wore to set the front content but not the back,
13  * and then call elm_flip_go() you would see whatever is below the flip.
14  *
15  * For a list of supported animations see elm_flip_go().
16  *
17  * Signals that you can add callbacks for are:
18  * "animate,begin" - when a flip animation was started
19  * "animate,done" - when a flip animation is finished
20  *
21 <<<<<<< HEAD
22 =======
23  * Default content parts of the flip widget that you can use for are:
24  * @li "front" - A front content of the flip 
25  * @li "back" - A back content of the flip 
26  *
27  * Supported elm_object common APIs.
28  * @li elm_object_part_content_set
29  * @li elm_object_part_content_get
30  * @li elm_object_part_content_unset
31  * 
32 >>>>>>> remotes/origin/upstream
33  * @ref tutorial_flip show how to use most of the API.
34  *
35  * @{
36  */
37 typedef enum
38 {
39    ELM_FLIP_ROTATE_Y_CENTER_AXIS,
40    ELM_FLIP_ROTATE_X_CENTER_AXIS,
41    ELM_FLIP_ROTATE_XZ_CENTER_AXIS,
42    ELM_FLIP_ROTATE_YZ_CENTER_AXIS,
43    ELM_FLIP_CUBE_LEFT,
44    ELM_FLIP_CUBE_RIGHT,
45    ELM_FLIP_CUBE_UP,
46    ELM_FLIP_CUBE_DOWN,
47    ELM_FLIP_PAGE_LEFT,
48    ELM_FLIP_PAGE_RIGHT,
49    ELM_FLIP_PAGE_UP,
50    ELM_FLIP_PAGE_DOWN
51 } Elm_Flip_Mode;
52
53 typedef enum
54 {
55    ELM_FLIP_INTERACTION_NONE,
56    ELM_FLIP_INTERACTION_ROTATE,
57    ELM_FLIP_INTERACTION_CUBE,
58    ELM_FLIP_INTERACTION_PAGE
59 } Elm_Flip_Interaction;
60
61 typedef enum
62 {
63    ELM_FLIP_DIRECTION_UP, /**< Allows interaction with the top of the widget */
64    ELM_FLIP_DIRECTION_DOWN, /**< Allows interaction with the bottom of the widget */
65    ELM_FLIP_DIRECTION_LEFT, /**< Allows interaction with the left portion of the widget */
66    ELM_FLIP_DIRECTION_RIGHT /**< Allows interaction with the right portion of the widget */
67 } Elm_Flip_Direction;
68
69 /**
70  * @brief Add a new flip to the parent
71  *
72  * @param parent The parent object
73  * @return The new object or NULL if it cannot be created
74  */
75 EAPI Evas_Object *elm_flip_add(Evas_Object *parent);
76
77 /**
78 <<<<<<< HEAD
79  * @brief Set the front content of the flip widget.
80  *
81  * @param obj The flip object
82  * @param content The new front content object
83  *
84  * Once the content object is set, a previously set one will be deleted.
85  * If you want to keep that old content object, use the
86  * elm_flip_content_front_unset() function.
87  */
88 EAPI void                 elm_flip_content_front_set(Evas_Object *obj, Evas_Object *content);
89
90 /**
91  * @brief Set the back content of the flip widget.
92  *
93  * @param obj The flip object
94  * @param content The new back content object
95  *
96  * Once the content object is set, a previously set one will be deleted.
97  * If you want to keep that old content object, use the
98  * elm_flip_content_back_unset() function.
99  */
100 EAPI void                 elm_flip_content_back_set(Evas_Object *obj, Evas_Object *content);
101
102 /**
103  * @brief Get the front content used for the flip
104  *
105  * @param obj The flip object
106  * @return The front content object that is being used
107  *
108  * Return the front content object which is set for this widget.
109  */
110 EAPI Evas_Object         *elm_flip_content_front_get(const Evas_Object *obj);
111
112 /**
113  * @brief Get the back content used for the flip
114  *
115  * @param obj The flip object
116  * @return The back content object that is being used
117  *
118  * Return the back content object which is set for this widget.
119  */
120 EAPI Evas_Object         *elm_flip_content_back_get(const Evas_Object *obj);
121
122 /**
123  * @brief Unset the front content used for the flip
124  *
125  * @param obj The flip object
126  * @return The front content object that was being used
127  *
128  * Unparent and return the front content object which was set for this widget.
129  */
130 EAPI Evas_Object         *elm_flip_content_front_unset(Evas_Object *obj);
131
132 /**
133  * @brief Unset the back content used for the flip
134  *
135  * @param obj The flip object
136  * @return The back content object that was being used
137  *
138  * Unparent and return the back content object which was set for this widget.
139  */
140 EAPI Evas_Object         *elm_flip_content_back_unset(Evas_Object *obj);
141
142 /**
143  * @brief Get flip front visibility state
144  *
145  * @param obj The flip objct
146  * @return EINA_TRUE if front front is showing, EINA_FALSE if the back is
147  * showing.
148  */
149 EAPI Eina_Bool            elm_flip_front_get(const Evas_Object *obj);
150 =======
151  * @brief Get flip front visibility state
152  *
153  * @param obj The flip object
154  * @return EINA_TRUE if front front is showing, EINA_FALSE if the back is
155  * showing.
156  */
157 Eina_Bool elm_flip_front_visible_get(const Evas_Object *obj);
158 >>>>>>> remotes/origin/upstream
159
160 /**
161  * @brief Set flip perspective
162  *
163  * @param obj The flip object
164  * @param foc The coordinate to set the focus on
165  * @param x The X coordinate
166  * @param y The Y coordinate
167  *
168  * @warning This function currently does nothing.
169  */
170 EAPI void                 elm_flip_perspective_set(Evas_Object *obj, Evas_Coord foc, Evas_Coord x, Evas_Coord y);
171
172 /**
173  * @brief Runs the flip animation
174  *
175  * @param obj The flip object
176  * @param mode The mode type
177  *
178  * Flips the front and back contents using the @p mode animation. This
179 <<<<<<< HEAD
180  * efectively hides the currently visible content and shows the hidden one.
181 =======
182  * effectively hides the currently visible content and shows the hidden one.
183 >>>>>>> remotes/origin/upstream
184  *
185  * There a number of possible animations to use for the flipping:
186  * @li ELM_FLIP_ROTATE_X_CENTER_AXIS - Rotate the currently visible content
187  * around a horizontal axis in the middle of its height, the other content
188  * is shown as the other side of the flip.
189  * @li ELM_FLIP_ROTATE_Y_CENTER_AXIS - Rotate the currently visible content
190  * around a vertical axis in the middle of its width, the other content is
191  * shown as the other side of the flip.
192  * @li ELM_FLIP_ROTATE_XZ_CENTER_AXIS - Rotate the currently visible content
193  * around a diagonal axis in the middle of its width, the other content is
194  * shown as the other side of the flip.
195  * @li ELM_FLIP_ROTATE_YZ_CENTER_AXIS - Rotate the currently visible content
196  * around a diagonal axis in the middle of its height, the other content is
197  * shown as the other side of the flip.
198  * @li ELM_FLIP_CUBE_LEFT - Rotate the currently visible content to the left
199  * as if the flip was a cube, the other content is show as the right face of
200  * the cube.
201  * @li ELM_FLIP_CUBE_RIGHT - Rotate the currently visible content to the
202  * right as if the flip was a cube, the other content is show as the left
203  * face of the cube.
204  * @li ELM_FLIP_CUBE_UP - Rotate the currently visible content up as if the
205  * flip was a cube, the other content is show as the bottom face of the cube.
206  * @li ELM_FLIP_CUBE_DOWN - Rotate the currently visible content down as if
207  * the flip was a cube, the other content is show as the upper face of the
208  * cube.
209  * @li ELM_FLIP_PAGE_LEFT - Move the currently visible content to the left as
210  * if the flip was a book, the other content is shown as the page below that.
211  * @li ELM_FLIP_PAGE_RIGHT - Move the currently visible content to the right
212  * as if the flip was a book, the other content is shown as the page below
213  * that.
214  * @li ELM_FLIP_PAGE_UP - Move the currently visible content up as if the
215  * flip was a book, the other content is shown as the page below that.
216  * @li ELM_FLIP_PAGE_DOWN - Move the currently visible content down as if the
217  * flip was a book, the other content is shown as the page below that.
218  *
219  * @image html elm_flip.png
220  * @image latex elm_flip.eps width=\textwidth
221  */
222 EAPI void                 elm_flip_go(Evas_Object *obj, Elm_Flip_Mode mode);
223
224 /**
225  * @brief Set the interactive flip mode
226  *
227  * @param obj The flip object
228  * @param mode The interactive flip mode to use
229  *
230  * This sets if the flip should be interactive (allow user to click and
231  * drag a side of the flip to reveal the back page and cause it to flip).
232  * By default a flip is not interactive. You may also need to set which
233  * sides of the flip are "active" for flipping and how much space they use
234 <<<<<<< HEAD
235  * (a minimum of a finger size) with elm_flip_interacton_direction_enabled_set()
236  * and elm_flip_interacton_direction_hitsize_set()
237  *
238  * The four avilable mode of interaction are:
239 =======
240  * (a minimum of a finger size) with elm_flip_interaction_direction_enabled_set()
241  * and elm_flip_interaction_direction_hitsize_set()
242  *
243  * The four available mode of interaction are:
244 >>>>>>> remotes/origin/upstream
245  * @li ELM_FLIP_INTERACTION_NONE - No interaction is allowed
246  * @li ELM_FLIP_INTERACTION_ROTATE - Interaction will cause rotate animation
247  * @li ELM_FLIP_INTERACTION_CUBE - Interaction will cause cube animation
248  * @li ELM_FLIP_INTERACTION_PAGE - Interaction will cause page animation
249  *
250  * @note ELM_FLIP_INTERACTION_ROTATE won't cause
251  * ELM_FLIP_ROTATE_XZ_CENTER_AXIS or ELM_FLIP_ROTATE_YZ_CENTER_AXIS to
252 <<<<<<< HEAD
253  * happen, those can only be acheived with elm_flip_go();
254 =======
255  * happen, those can only be achieved with elm_flip_go();
256 >>>>>>> remotes/origin/upstream
257  */
258 EAPI void                 elm_flip_interaction_set(Evas_Object *obj, Elm_Flip_Interaction mode);
259
260 /**
261  * @brief Get the interactive flip mode
262  *
263  * @param obj The flip object
264  * @return The interactive flip mode
265  *
266  * Returns the interactive flip mode set by elm_flip_interaction_set()
267  */
268 EAPI Elm_Flip_Interaction elm_flip_interaction_get(const Evas_Object *obj);
269
270 /**
271  * @brief Set which directions of the flip respond to interactive flip
272  *
273  * @param obj The flip object
274  * @param dir The direction to change
275  * @param enabled If that direction is enabled or not
276  *
277  * By default all directions are disabled, so you may want to enable the
278  * desired directions for flipping if you need interactive flipping. You must
279  * call this function once for each direction that should be enabled.
280  *
281  * @see elm_flip_interaction_set()
282  */
283 <<<<<<< HEAD
284 EAPI void                 elm_flip_interacton_direction_enabled_set(Evas_Object *obj, Elm_Flip_Direction dir, Eina_Bool enabled);
285 =======
286 EAPI void                 elm_flip_interaction_direction_enabled_set(Evas_Object *obj, Elm_Flip_Direction dir, Eina_Bool enabled);
287 >>>>>>> remotes/origin/upstream
288
289 /**
290  * @brief Get the enabled state of that flip direction
291  *
292  * @param obj The flip object
293  * @param dir The direction to check
294  * @return If that direction is enabled or not
295  *
296 <<<<<<< HEAD
297  * Gets the enabled state set by elm_flip_interacton_direction_enabled_set()
298  *
299  * @see elm_flip_interaction_set()
300  */
301 EAPI Eina_Bool            elm_flip_interacton_direction_enabled_get(Evas_Object *obj, Elm_Flip_Direction dir);
302 =======
303  * Gets the enabled state set by elm_flip_interaction_direction_enabled_set()
304  *
305  * @see elm_flip_interaction_set()
306  */
307 EAPI Eina_Bool            elm_flip_interaction_direction_enabled_get(Evas_Object *obj, Elm_Flip_Direction dir);
308 >>>>>>> remotes/origin/upstream
309
310 /**
311  * @brief Set the amount of the flip that is sensitive to interactive flip
312  *
313  * @param obj The flip object
314  * @param dir The direction to modify
315  * @param hitsize The amount of that dimension (0.0 to 1.0) to use
316  *
317  * Set the amount of the flip that is sensitive to interactive flip, with 0
318  * representing no area in the flip and 1 representing the entire flip. There
319  * is however a consideration to be made in that the area will never be
320  * smaller than the finger size set(as set in your Elementary configuration).
321  *
322  * @see elm_flip_interaction_set()
323  */
324 <<<<<<< HEAD
325 EAPI void                 elm_flip_interacton_direction_hitsize_set(Evas_Object *obj, Elm_Flip_Direction dir, double hitsize);
326 =======
327 EAPI void                 elm_flip_interaction_direction_hitsize_set(Evas_Object *obj, Elm_Flip_Direction dir, double hitsize);
328 >>>>>>> remotes/origin/upstream
329
330 /**
331  * @brief Get the amount of the flip that is sensitive to interactive flip
332  *
333  * @param obj The flip object
334  * @param dir The direction to check
335  * @return The size set for that direction
336  *
337 <<<<<<< HEAD
338  * Returns the amount os sensitive area set by
339  * elm_flip_interacton_direction_hitsize_set().
340  */
341 EAPI double               elm_flip_interacton_direction_hitsize_get(Evas_Object *obj, Elm_Flip_Direction dir);
342 =======
343  * Returns the amount of sensitive area set by
344  * elm_flip_interaction_direction_hitsize_set().
345  */
346 EAPI double               elm_flip_interaction_direction_hitsize_get(Evas_Object *obj, Elm_Flip_Direction dir);
347 >>>>>>> remotes/origin/upstream
348
349 /**
350  * @}
351  */