migration merge<Jiyoun Park>
[framework/uifw/elementary.git] / src / lib / elm_photocam.h
1 /**
2  * @defgroup Photocam Photocam
3  *
4  * @image html img/widget/photocam/preview-00.png
5  * @image latex img/widget/photocam/preview-00.eps
6  *
7  * This is a widget specifically for displaying high-resolution digital
8  * camera photos giving speedy feedback (fast load), low memory footprint
9  * and zooming and panning as well as fitting logic. It is entirely focused
10  * on jpeg images, and takes advantage of properties of the jpeg format (via
11  * evas loader features in the jpeg loader).
12  *
13  * Signals that you can add callbacks for are:
14  * @li "clicked" - This is called when a user has clicked the photo without
15  *                 dragging around.
16  * @li "press" - This is called when a user has pressed down on the photo.
17  * @li "longpressed" - This is called when a user has pressed down on the
18  *                     photo for a long time without dragging around.
19  * @li "clicked,double" - This is called when a user has double-clicked the
20  *                        photo.
21  * @li "load" - Photo load begins.
22  * @li "loaded" - This is called when the image file load is complete for the
23  *                first view (low resolution blurry version).
24  * @li "load,detail" - Photo detailed data load begins.
25  * @li "loaded,detail" - This is called when the image file load is complete
26  *                      for the detailed image data (full resolution needed).
27  * @li "zoom,start" - Zoom animation started.
28  * @li "zoom,stop" - Zoom animation stopped.
29  * @li "zoom,change" - Zoom changed when using an auto zoom mode.
30  * @li "scroll" - the content has been scrolled (moved)
31  * @li "scroll,anim,start" - scrolling animation has started
32  * @li "scroll,anim,stop" - scrolling animation has stopped
33  * @li "scroll,drag,start" - dragging the contents around has started
34  * @li "scroll,drag,stop" - dragging the contents around has stopped
35  *
36  * @ref tutorial_photocam shows the API in action.
37  * @{
38  */
39
40 /**
41  * @brief Types of zoom available.
42  */
43 typedef enum
44 {
45    ELM_PHOTOCAM_ZOOM_MODE_MANUAL = 0, /**< Zoom controlled normally by elm_photocam_zoom_set */
46    ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT, /**< Zoom until photo fits in photocam */
47    ELM_PHOTOCAM_ZOOM_MODE_AUTO_FILL, /**< Zoom until photo fills photocam */
48    ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT_IN, /**< Zoom in until photo fits in photocam */
49    ELM_PHOTOCAM_ZOOM_MODE_LAST
50 } Elm_Photocam_Zoom_Mode;
51
52 /**
53  * @brief Add a new Photocam object
54  *
55  * @param parent The parent object
56  * @return The new object or NULL if it cannot be created
57  */
58 EAPI Evas_Object           *elm_photocam_add(Evas_Object *parent);
59
60 /**
61  * @brief Set the photo file to be shown
62  *
63  * @param obj The photocam object
64  * @param file The photo file
65  * @return The return error (see EVAS_LOAD_ERROR_NONE, EVAS_LOAD_ERROR_GENERIC etc.)
66  *
67  * This sets (and shows) the specified file (with a relative or absolute
68  * path) and will return a load error (same error that
69  * evas_object_image_load_error_get() will return). The image will change and
70  * adjust its size at this point and begin a background load process for this
71  * photo that at some time in the future will be displayed at the full
72  * quality needed.
73  */
74 EAPI Evas_Load_Error        elm_photocam_file_set(Evas_Object *obj, const char *file);
75
76 /**
77  * @brief Returns the path of the current image file
78  *
79  * @param obj The photocam object
80  * @return Returns the path
81  *
82  * @see elm_photocam_file_set()
83  */
84 EAPI const char            *elm_photocam_file_get(const Evas_Object *obj);
85
86 /**
87  * @brief Set the zoom level of the photo
88  *
89  * @param obj The photocam object
90  * @param zoom The zoom level to set
91  *
92  * This sets the zoom level. 1 will be 1:1 pixel for pixel. 2 will be 2:1
93  * (that is 2x2 photo pixels will display as 1 on-screen pixel). 4:1 will be
94  * 4x4 photo pixels as 1 screen pixel, and so on. The @p zoom parameter must
95  * be greater than 0. It is suggested to stick to powers of 2. (1, 2, 4, 8,
96  * 16, 32, etc.).
97  */
98 EAPI void                   elm_photocam_zoom_set(Evas_Object *obj, double zoom);
99
100 /**
101  * @brief Get the zoom level of the photo
102  *
103  * @param obj The photocam object
104  * @return The current zoom level
105  *
106  * This returns the current zoom level of the photocam object. Note that if
107  * you set the fill mode to other than ELM_PHOTOCAM_ZOOM_MODE_MANUAL
108  * (which is the default), the zoom level may be changed at any time by the
109  * photocam object itself to account for photo size and photocam viewport
110  * size.
111  *
112  * @see elm_photocam_zoom_set()
113  * @see elm_photocam_zoom_mode_set()
114  */
115 EAPI double                 elm_photocam_zoom_get(const Evas_Object *obj);
116
117 /**
118  * @brief Set the zoom mode
119  *
120  * @param obj The photocam object
121  * @param mode The desired mode
122  *
123  * This sets the zoom mode to manual or one of several automatic levels.
124  * Manual (ELM_PHOTOCAM_ZOOM_MODE_MANUAL) means that zoom is set manually by
125  * elm_photocam_zoom_set() and will stay at that level until changed by code
126  * or until zoom mode is changed. This is the default mode. The Automatic
127  * modes will allow the photocam object to automatically adjust zoom mode
128  * based on properties. ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT) will adjust zoom so
129  * the photo fits EXACTLY inside the scroll frame with no pixels outside this
130  * region. ELM_PHOTOCAM_ZOOM_MODE_AUTO_FILL will be similar but ensure no
131  * pixels within the frame are left unfilled.
132  */
133 EAPI void                   elm_photocam_zoom_mode_set(Evas_Object *obj, Elm_Photocam_Zoom_Mode mode);
134
135 /**
136  * @brief Get the zoom mode
137  *
138  * @param obj The photocam object
139  * @return The current zoom mode
140  *
141  * This gets the current zoom mode of the photocam object.
142  *
143  * @see elm_photocam_zoom_mode_set()
144  */
145 EAPI Elm_Photocam_Zoom_Mode elm_photocam_zoom_mode_get(const Evas_Object *obj);
146
147 /**
148  * @brief Get the current image pixel width and height
149  *
150  * @param obj The photocam object
151  * @param w A pointer to the width return
152  * @param h A pointer to the height return
153  *
154  * This gets the current photo pixel width and height (for the original).
155  * The size will be returned in the integers @p w and @p h that are pointed
156  * to.
157  */
158 EAPI void                   elm_photocam_image_size_get(const Evas_Object *obj, int *w, int *h);
159
160 /**
161  * @brief Get the region of the image that is currently shown
162  *
163  * @param obj
164  * @param x A pointer to the X-coordinate of region
165  * @param y A pointer to the Y-coordinate of region
166  * @param w A pointer to the width
167  * @param h A pointer to the height
168  *
169  * @see elm_photocam_image_region_show()
170  * @see elm_photocam_image_region_bring_in()
171  */
172 EAPI void                   elm_photocam_image_region_get(const Evas_Object *obj, int *x, int *y, int *w, int *h);
173
174 /**
175  * @brief Set the viewed region of the image
176  *
177  * @param obj The photocam object
178  * @param x X-coordinate of region in image original pixels
179  * @param y Y-coordinate of region in image original pixels
180  * @param w Width of region in image original pixels
181  * @param h Height of region in image original pixels
182  *
183  * This shows the region of the image without using animation.
184  */
185 EAPI void                   elm_photocam_image_region_show(Evas_Object *obj, int x, int y, int w, int h);
186
187 /**
188  * @brief Bring in the viewed portion of the image
189  *
190  * @param obj The photocam object
191  * @param x X-coordinate of region in image original pixels
192  * @param y Y-coordinate of region in image original pixels
193  * @param w Width of region in image original pixels
194  * @param h Height of region in image original pixels
195  *
196  * This shows the region of the image using animation.
197  */
198 EAPI void                   elm_photocam_image_region_bring_in(Evas_Object *obj, int x, int y, int w, int h);
199
200 /**
201  * @brief Set the paused state for photocam
202  *
203  * @param obj The photocam object
204  * @param paused The pause state to set
205  *
206  * This sets the paused state to on(EINA_TRUE) or off (EINA_FALSE) for
207  * photocam. The default is off. This will stop zooming using animation on
208  * zoom level changes and change instantly. This will stop any existing
209  * animations that are running.
210  */
211 EAPI void                   elm_photocam_paused_set(Evas_Object *obj, Eina_Bool paused);
212
213 /**
214  * @brief Get the paused state for photocam
215  *
216  * @param obj The photocam object
217  * @return The current paused state
218  *
219  * This gets the current paused state for the photocam object.
220  *
221  * @see elm_photocam_paused_set()
222  */
223 EAPI Eina_Bool              elm_photocam_paused_get(const Evas_Object *obj);
224
225 /**
226  * @brief Get the internal low-res image used for photocam
227  *
228  * @param obj The photocam object
229  * @return The internal image object handle, or NULL if none exists
230  *
231  * This gets the internal image object inside photocam. Do not modify it. It
232  * is for inspection only, and hooking callbacks to. Nothing else. It may be
233  * deleted at any time as well.
234  */
235 EAPI Evas_Object           *elm_photocam_internal_image_get(const Evas_Object *obj);
236
237 /**
238  * @brief Set the photocam scrolling bouncing.
239  *
240  * @param obj The photocam object
241  * @param h_bounce set this to @c EINA_TRUE for horizontal bouncing
242  * @param v_bounce set this to @c EINA_TRUE for vertical bouncing
243  */
244 EAPI void                   elm_photocam_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce);
245
246 /**
247  * @brief Get the photocam scrolling bouncing.
248  *
249  * @param obj The photocam object
250  * @param h_bounce horizontal bouncing
251  * @param v_bounce vertical bouncing
252  *
253  * @see elm_photocam_bounce_set()
254  */
255 EAPI void                   elm_photocam_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce);
256
257 /**
258  * @brief Set the gesture state for photocam.
259  *
260  * @param obj The photocam object
261  * @param gesture The gesture state to set
262  *
263  * This sets the gesture state to on(EINA_TRUE) or off (EINA_FALSE) for
264  * photocam. The default is off. This will start multi touch zooming.
265  */
266 EAPI void                   elm_photocam_gesture_enabled_set(Evas_Object *obj, Eina_Bool gesture);
267
268 /**
269  * @brief Get the gesture state for photocam.
270  *
271  * @param obj The photocam object
272  * @return The current gesture state
273  *
274  * This gets the current gesture state for the photocam object.
275  *
276  * @see elm_photocam_gesture_enabled_set()
277  */
278 EAPI Eina_Bool              elm_photocam_gesture_enabled_get(const Evas_Object *obj);
279 /**
280  * @}
281  */