3 * @defgroup Thumb Thumbnail
6 * @image html thumb_inheritance_tree.png
7 * @image latex thumb_inheritance_tree.eps
9 * @image html img/widget/thumb/preview-00.png
10 * @image latex img/widget/thumb/preview-00.eps
12 * A thumbnail object is used for displaying the thumbnail of an image
13 * or video. You must have compiled Elementary with @c Ethumb_Client
14 * support. Also, Ethumb's DBus service must be present and
15 * auto-activated in order to have thumbnails generated. You must also
16 * have a @b session bus, not a @b system one.
18 * Once the thumbnail object becomes visible, it checks if there
19 * is a previously generated thumbnail image for the file set on
20 * it. If not, it starts generating this thumbnail.
22 * Different configuration settings causes different thumbnails to
23 * be generated even on the same file.
25 * Generated thumbnails are stored under @c $HOME/.thumbnails/. Check
26 * Ethumb's documentation to change this path, and to see other
27 * configuration options.
29 * This widget emits the following signals:
30 * - @c "clicked" - This is called when a user has clicked the
31 * thumbnail object without dragging it around.
32 * - @c "clicked,double" - This is called when a user has double-clicked
33 * the thumbnail object.
34 * - @c "press" - This is called when a user has pressed down over the
36 * - @c "generate,start" - The thumbnail generation has started.
37 * - @c "generate,stop" - The generation process has stopped.
38 * - @c "generate,error" - The thumbnail generation failed.
39 * - @c "load,error" - The thumbnail image loading failed.
49 * @enum Elm_Thumb_Animation_Setting
50 * @typedef Elm_Thumb_Animation_Setting
52 * @brief Enumeration to set if a video thumbnail is animating.
58 ELM_THUMB_ANIMATION_START = 0, /**< Play animation once */
59 ELM_THUMB_ANIMATION_LOOP, /**< Keep playing animation until stop is requested */
60 ELM_THUMB_ANIMATION_STOP, /**< Stop playing the animation */
61 ELM_THUMB_ANIMATION_LAST
62 } Elm_Thumb_Animation_Setting;
65 * @brief Adds a new thumb object to the parent.
67 * @param[in] parent The parent object
68 * @return The new object, otherwise @c NULL if it cannot be created
70 * @see elm_thumb_file_set()
71 * @see elm_thumb_ethumb_client_get()
75 EAPI Evas_Object *elm_thumb_add(Evas_Object *parent);
78 * @brief Reloads a thumbnail if it is generated before.
80 * @remarks This is useful if the ethumb client configuration changed, like its
81 * size, aspect, or any other property one set in the handle returned
82 * by elm_thumb_ethumb_client_get().
84 * @remarks If the options didn't change, the thumbnail won't be generated again, but
85 * the old one is still used.
87 * @param[in] obj The thumb object to reload
89 * @see elm_thumb_file_set()
93 EAPI void elm_thumb_reload(Evas_Object *obj);
96 * @brief Sets the file that is used as a thumbnail @b source.
98 * @remarks The file can be an image or a video (in that case, acceptable
99 * extensions are: avi, mp4, ogv, mov, mpg and wmv). To start the
100 * video animation, use the function elm_thumb_animate().
102 * @param[in] obj The thumb object
103 * @param[in] file The path to the file that is used as a thumbnail source
104 * @param[in] key The key used in case of an EET file
106 * @see elm_thumb_file_get()
107 * @see elm_thumb_reload()
108 * @see elm_thumb_animate()
112 EAPI void elm_thumb_file_set(Evas_Object *obj, const char *file, const char *key);
115 * @brief Gets the image or video path and key used to generate the thumbnail.
117 * @param[in] obj The thumb object
118 * @param[out] file A pointer to the filename
119 * @param[out] key A pointer to the key
121 * @see elm_thumb_file_set()
122 * @see elm_thumb_path_get()
126 EAPI void elm_thumb_file_get(const Evas_Object *obj, const char **file, const char **key);
129 * @brief Gets the path and key to the image or video thumbnail generated by ethumb.
131 * @remarks One just needs to make sure that the thumbnail is generated before getting
132 * its path, otherwise the path is @c NULL. One way to do that is by asking
133 * for the path when/after the "generate,stop" smart callback is called.
135 * @param[in] obj The thumb object
136 * @param[out] file A pointer to the thumb path
137 * @param[out] key A pointer to the thumb key
139 * @see elm_thumb_file_get()
143 EAPI void elm_thumb_path_get(const Evas_Object *obj, const char **file, const char **key);
146 * @brief Sets the animation state for the thumb object. If its content is an animated
147 * video, you may start/stop the animation or tell it to play continuously and
150 * @param[in] obj The thumb object
151 * @param[in] s The animation setting
153 * @see elm_thumb_file_set()
157 EAPI void elm_thumb_animate_set(Evas_Object *obj, Elm_Thumb_Animation_Setting s);
160 * @brief Gets the animation state for the thumb object.
162 * @param[in] obj The thumb object
163 * @return The animation setting, otherwise @c ELM_THUMB_ANIMATION_LAST
166 * @see elm_thumb_animate_set()
170 EAPI Elm_Thumb_Animation_Setting elm_thumb_animate_get(const Evas_Object *obj);
173 * @brief Gets the ethumb_client handle so that custom configuration can be made.
175 * @remarks This must be called before the objects are created to be sure that no object is
176 * visible and no generation has started.
181 * #include <Elementary.h>
182 * #ifndef ELM_LIB_QUICKLAUNCH
184 * elm_main(int argc, char **argv)
186 * Ethumb_Client *client;
192 * client = elm_thumb_ethumb_client_get();
195 * ERR("could not get ethumb_client");
198 * ethumb_client_size_set(client, 100, 100);
199 * ethumb_client_crop_align_set(client, 0.5, 0.5);
202 * // Create elm_thumb objects here
212 * @remarks There's only one client handle for Ethumb, so once a configuration
213 * change is done to it, any other request for thumbnails (for any thumbnail
214 * object) uses that configuration. Thus, this configuration is global.
216 * @return An Ethumb_Client instance, otherwise @c NULL
220 EAPI void *elm_thumb_ethumb_client_get(void);
223 * @brief Gets the ethumb_client connection state.
225 * @return @c EINA_TRUE if the client is connected to the server, otherwise @c EINA_FALSE
228 EAPI Eina_Bool elm_thumb_ethumb_client_connected_get(void);
231 * @brief Makes the thumbnail 'editable'.
233 * @remarks This means the thumbnail is a valid drag target for drag and drop, and can be
236 * @param[in] obj The thumb object
237 * @param[in] edit The boolean value that turns on or turns off editability \n
238 * Default is @c EINA_FALSE.
240 * @see elm_thumb_editable_get()
244 EAPI Eina_Bool elm_thumb_editable_set(Evas_Object *obj, Eina_Bool edit);
247 * @brief Makes the thumbnail 'editable'.
249 * @remarks This means the thumbnail is a valid drag target for drag and drop, and can be
252 * @param[in] obj The thumb object
253 * @return The boolean value that turns on or turns off editability
255 * @see elm_thumb_editable_set()
259 EAPI Eina_Bool elm_thumb_editable_get(const Evas_Object *obj);