summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Antognolli <antognolli@gmail.com>2011-08-01 17:37:10 +0000
committerRafael Antognolli <antognolli@gmail.com>2011-08-01 17:37:10 +0000
commit814151560b12cd2517a03d9952e680a210104a6c (patch)
treebaedf14cebfb097c41ed60b7398ca2e91d01d0b1
parent294d7127a64a7357ede17da4284e817ac28e60a1 (diff)
elementary/thumb - Added explained example and some more doc.
SVN revision: 61960
-rw-r--r--doc/Makefile.am3
-rw-r--r--doc/examples.dox48
-rw-r--r--doc/index.doxy3
-rw-r--r--doc/widgets/Makefile.am4
-rw-r--r--doc/widgets/widget_preview_thumb.c12
-rw-r--r--src/examples/Makefile.am7
-rw-r--r--src/examples/thumb_example_01.c86
-rw-r--r--src/lib/Elementary.h.in251
-rw-r--r--src/lib/elm_thumb.c161
9 files changed, 394 insertions, 181 deletions
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 73aef9709..7ea36ff68 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -77,7 +77,8 @@ WGT_PREVIEW = \
77 table::preview-00.png:widget_preview_table:100:100 \ 77 table::preview-00.png:widget_preview_table:100:100 \
78 win:preview-00.png:widget_preview_win:200:200 \ 78 win:preview-00.png:widget_preview_win:200:200 \
79 table:preview-00.png:widget_preview_table:100:100 \ 79 table:preview-00.png:widget_preview_table:100:100 \
80 menu:preview-00.png:widget_preview_menu:100:100 80 menu:preview-00.png:widget_preview_menu:100:100 \
81 thumb:preview-00.png:widget_preview_thumb:100:100
81 82
82widget-build: 83widget-build:
83 @$(MAKE) -C widgets 84 @$(MAKE) -C widgets
diff --git a/doc/examples.dox b/doc/examples.dox
index c4bad80d5..1cdb7aa6f 100644
--- a/doc/examples.dox
+++ b/doc/examples.dox
@@ -81,6 +81,8 @@
81 * 81 *
82 * @ref genlist_example_05 82 * @ref genlist_example_05
83 * 83 *
84 * @ref thumb_example_01
85 *
84 * @ref progressbar_example 86 * @ref progressbar_example
85 * 87 *
86 * @ref slideshow_example 88 * @ref slideshow_example
@@ -4715,6 +4717,46 @@
4715 */ 4717 */
4716 4718
4717/** 4719/**
4720 * @page thumb_example_01 Thumb - generating thumbnails.
4721 *
4722 * This example shows how to create a simple thumbnail object with Elementary.
4723 * The full source code can be found at @ref thumb_example_01_c
4724 *
4725 * Everything is very simple. First we need to tell elementary that we need
4726 * Ethumb to generate the thumbnails:
4727 *
4728 * @dontinclude thumb_example_01.c
4729 * @skipline elm_need_ethumb
4730 *
4731 * Then, after creating the window and background, we setup our client to
4732 * generate images of 160x160:
4733 *
4734 * @skip client_get
4735 * @until size_set
4736 *
4737 * After that, we can start creating thumbnail objects. They are very similar to
4738 * image or icon objects:
4739 *
4740 * @until thumb_reload
4741 *
4742 * As you can see, the main different function here is elm_thumb_reload(), which
4743 * will check if the options of the Ethumb client have changed. If so, it will
4744 * re-generate the thumbnail, and show the new one.
4745 *
4746 * Notice in this example that the thumbnail object is displayed on the size of
4747 * the window (320x320 pixels), but the thumbnail generated and stored has size
4748 * 160x160 pixels. That's why the picture seems upscaled.
4749 *
4750 * Ideally, you will be generating thumbnails with the size that you will be
4751 * using them.
4752 *
4753 * The example will look like this when running:
4754 *
4755 * @image html screenshots/thumb_example_01.png
4756 * @image latex screenshots/thumb_example_01.eps width=\textwidth
4757 */
4758
4759/**
4718 * @page progressbar_example Progress bar widget example 4760 * @page progressbar_example Progress bar widget example
4719 * 4761 *
4720 * This application is a thorough example of the progress bar widget, 4762 * This application is a thorough example of the progress bar widget,
@@ -5645,6 +5687,12 @@
5645 */ 5687 */
5646 5688
5647/** 5689/**
5690 * @page thumb_example_01_c thumb_example_01.c
5691 * @include thumb_example_01.c
5692 * @example thumb_example_01.c
5693 */
5694
5695/**
5648 * @page progressbar_example_c Progress bar example 5696 * @page progressbar_example_c Progress bar example
5649 * @include progressbar_example.c 5697 * @include progressbar_example.c
5650 * @example progressbar_example.c 5698 * @example progressbar_example.c
diff --git a/doc/index.doxy b/doc/index.doxy
index 7400e8664..956c86165 100644
--- a/doc/index.doxy
+++ b/doc/index.doxy
@@ -190,6 +190,9 @@
190 * @image html img/widget/spinner/preview-00.png 190 * @image html img/widget/spinner/preview-00.png
191 * @image latex img/widget/spinner/preview-00.eps 191 * @image latex img/widget/spinner/preview-00.eps
192 * @li @ref Thumb 192 * @li @ref Thumb
193
194 * @image html img/widget/thumb/preview-00.png
195 * @image latex img/widget/thumb/preview-00.eps
193 * @li @ref Toggle 196 * @li @ref Toggle
194 * 197 *
195 * @image html img/widget/toggle/preview-00.png 198 * @image html img/widget/toggle/preview-00.png
diff --git a/doc/widgets/Makefile.am b/doc/widgets/Makefile.am
index d4a6fad87..1bfb9b83a 100644
--- a/doc/widgets/Makefile.am
+++ b/doc/widgets/Makefile.am
@@ -92,7 +92,8 @@ widget_preview_inwin3 \
92widget_preview_scroller \ 92widget_preview_scroller \
93widget_preview_table \ 93widget_preview_table \
94widget_preview_win \ 94widget_preview_win \
95widget_preview_menu 95widget_preview_menu \
96widget_preview_thumb
96 97
97LDADD = $(top_builddir)/src/lib/libelementary.la @ELEMENTARY_EWEATHER_LIBS@ @ELEMENTARY_EDBUS_LIBS@ @ELEMENTARY_EFREET_LIBS@ @ELEMENTARY_EMAP_LIBS@ @ELEMENTARY_LIBS@ @EIO_LIBS@ @my_libs@ 98LDADD = $(top_builddir)/src/lib/libelementary.la @ELEMENTARY_EWEATHER_LIBS@ @ELEMENTARY_EDBUS_LIBS@ @ELEMENTARY_EFREET_LIBS@ @ELEMENTARY_EMAP_LIBS@ @ELEMENTARY_LIBS@ @EIO_LIBS@ @my_libs@
98 99
@@ -166,5 +167,6 @@ EXTRA_DIST = \
166 widget_preview_table.c \ 167 widget_preview_table.c \
167 widget_preview_win.c \ 168 widget_preview_win.c \
168 widget_preview_menu.c \ 169 widget_preview_menu.c \
170 widget_preview_thumb.c \
169 widget_preview_tmpl_foot.c \ 171 widget_preview_tmpl_foot.c \
170 widget_preview_tmpl_head.c 172 widget_preview_tmpl_head.c
diff --git a/doc/widgets/widget_preview_thumb.c b/doc/widgets/widget_preview_thumb.c
new file mode 100644
index 000000000..986c1a5ad
--- /dev/null
+++ b/doc/widgets/widget_preview_thumb.c
@@ -0,0 +1,12 @@
1#include "widget_preview_tmpl_head.c"
2
3elm_need_ethumb();
4
5Evas_Object *o = elm_thumb_add(win);
6evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
7elm_win_resize_object_add(win, o);
8
9elm_thumb_file_set(o, PACKAGE_DATA_DIR"/images/plant_01.jpg", NULL);
10evas_object_show(o);
11
12#include "widget_preview_tmpl_foot.c"
diff --git a/src/examples/Makefile.am b/src/examples/Makefile.am
index b2e228d0d..5e70e9dc8 100644
--- a/src/examples/Makefile.am
+++ b/src/examples/Makefile.am
@@ -107,7 +107,8 @@ SRCS = \
107 scroller_example_01.c \ 107 scroller_example_01.c \
108 table_example_01.c \ 108 table_example_01.c \
109 table_example_02.c \ 109 table_example_02.c \
110 menu_example_01.c 110 menu_example_01.c \
111 thumb_example_01.c
111 112
112pkglib_PROGRAMS = 113pkglib_PROGRAMS =
113 114
@@ -204,7 +205,8 @@ pkglib_PROGRAMS += \
204 scroller_example_01 \ 205 scroller_example_01 \
205 table_example_01 \ 206 table_example_01 \
206 table_example_02 \ 207 table_example_02 \
207 menu_example_01 208 menu_example_01 \
209 thumb_example_01
208 210
209# This variable will hold the list of screenshots that will be made 211# This variable will hold the list of screenshots that will be made
210# by "make screenshots". Each item in the list is of the form: 212# by "make screenshots". Each item in the list is of the form:
@@ -267,6 +269,7 @@ SCREENSHOTS = \
267 genlist_example_03:genlist_example_03.png:0.1 \ 269 genlist_example_03:genlist_example_03.png:0.1 \
268 genlist_example_04:genlist_example_04.png:0.1 \ 270 genlist_example_04:genlist_example_04.png:0.1 \
269 genlist_example_05:genlist_example_05.png:0.1 \ 271 genlist_example_05:genlist_example_05.png:0.1 \
272 thumb_example_01:thumb_example_01.png:0.5 \
270 entry_example:entry_example.png:0.0 \ 273 entry_example:entry_example.png:0.0 \
271 progressbar_example:progressbar_example.png:0.0 \ 274 progressbar_example:progressbar_example.png:0.0 \
272 notify_example_01:notify_example_01.png:0.0 \ 275 notify_example_01:notify_example_01.png:0.0 \
diff --git a/src/examples/thumb_example_01.c b/src/examples/thumb_example_01.c
new file mode 100644
index 000000000..53e75e8e6
--- /dev/null
+++ b/src/examples/thumb_example_01.c
@@ -0,0 +1,86 @@
1//Compile with:
2//gcc -g `pkg-config --cflags --libs elementary` thumb_example_01.c -o thumb_example_01
3
4#include <Elementary.h>
5#ifdef HAVE_CONFIG_H
6# include "elementary_config.h"
7#else
8# define __UNUSED__
9# define PACKAGE_DATA_DIR "."
10#endif
11
12static void
13_generation_started_cb(void *data __UNUSED__, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
14{
15 printf("thumbnail generation started.\n");
16}
17
18static void
19_generation_finished_cb(void *data __UNUSED__, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
20{
21 printf("thumbnail generation finished.\n");
22}
23
24static void
25_generation_error_cb(void *data __UNUSED__, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
26{
27 printf("thumbnail generation error.\n");
28}
29
30int
31elm_main(int argc __UNUSED__, char **argv __UNUSED__)
32{
33 Evas_Object *win, *bg;
34 Evas_Object *thumb;
35 Ethumb_Client *client;
36 char buf[PATH_MAX];
37
38 elm_need_ethumb();
39
40 win = elm_win_add(NULL, "thumb", ELM_WIN_BASIC);
41 elm_win_title_set(win, "Thumbnailer");
42 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
43 elm_win_autodel_set(win, 1);
44
45 bg = elm_bg_add(win);
46 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
47 elm_win_resize_object_add(win, bg);
48 evas_object_show(bg);
49
50 client = elm_thumb_ethumb_client_get();
51 if (!client)
52 {
53 printf("error: could not get Ethumb client.\n");
54 return 1;
55 }
56 ethumb_client_size_set(client, 160, 160);
57
58 thumb = elm_thumb_add(win);
59
60 evas_object_smart_callback_add(thumb, "generate,start", _generation_started_cb, NULL);
61 evas_object_smart_callback_add(thumb, "generate,stop", _generation_finished_cb, NULL);
62 evas_object_smart_callback_add(thumb, "generate,error", _generation_error_cb, NULL);
63
64 elm_thumb_editable_set(thumb, EINA_FALSE);
65 snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", PACKAGE_DATA_DIR);
66 elm_thumb_file_set(thumb, buf, NULL);
67 elm_thumb_reload(thumb);
68
69 evas_object_size_hint_weight_set(thumb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
70 elm_win_resize_object_add(win, thumb);
71 evas_object_show(thumb);
72
73 evas_object_size_hint_min_set(bg, 160, 160);
74 evas_object_size_hint_max_set(bg, 640, 640);
75 evas_object_resize(win, 320, 320);
76 evas_object_show(win);
77
78 elm_run(); /* and run the program now, starting to handle all
79 * events, etc. */
80 elm_shutdown(); /* clean up and shut down */
81
82 /* exit code */
83 return 0;
84}
85
86ELM_MAIN()
diff --git a/src/lib/Elementary.h.in b/src/lib/Elementary.h.in
index 07c72780b..e0a2a6fe5 100644
--- a/src/lib/Elementary.h.in
+++ b/src/lib/Elementary.h.in
@@ -10019,38 +10019,257 @@ extern "C" {
10019 */ 10019 */
10020 EAPI Evas_Object *elm_gesture_layer_add(Evas_Object *parent) EINA_ARG_NONNULL(1); 10020 EAPI Evas_Object *elm_gesture_layer_add(Evas_Object *parent) EINA_ARG_NONNULL(1);
10021 10021
10022 /* thumb */ 10022 /**
10023 * @defgroup Thumb Thumb
10024 *
10025 * @image html img/widget/thumb/preview-00.png
10026 * @image latex img/widget/thumb/preview-00.eps
10027 *
10028 * A thumb object is used for displaying the thumbnail of an image or video.
10029 * You must have compiled Elementary with Ethumb_Client support and the DBus
10030 * service must be present and auto-activated in order to have thumbnails to
10031 * be generated.
10032 *
10033 * Once the thumbnail object becomes visible, it will check if there is a
10034 * previously generated thumbnail image for the file set on it. If not, it
10035 * will start generating this thumbnail.
10036 *
10037 * Different config settings will cause different thumbnails to be generated
10038 * even on the same file.
10039 *
10040 * Generated thumbnails are stored under @c $HOME/.thumbnails/. Check the
10041 * Ethumb documentation to change this path, and to see other configuration
10042 * options.
10043 *
10044 * Signals that you can add callbacks for are:
10045 *
10046 * - "clicked" - This is called when a user has clicked the thumb without dragging
10047 * around.
10048 * - "clicked,double" - This is called when a user has double-clicked the thumb.
10049 * - "press" - This is called when a user has pressed down the thumb.
10050 * - "generate,start" - The thumbnail generation started.
10051 * - "generate,stop" - The generation process stopped.
10052 * - "generate,error" - The generation failed.
10053 * - "load,error" - The thumbnail image loading failed.
10054 *
10055 * available styles:
10056 * - default
10057 * - noframe
10058 *
10059 * An example of use of thumbnail:
10060 *
10061 * - @ref thumb_example_01
10062 */
10063
10064 /**
10065 * @addtogroup Thumb
10066 * @{
10067 */
10068
10069 /**
10070 * @enum _Elm_Thum_Animation_Setting
10071 * @typedef Elm_Thumb_Animation_Setting
10072 *
10073 * Used to set if a video thumbnail is animating or not.
10074 *
10075 * @ingroup Thumb
10076 */
10023 typedef enum _Elm_Thumb_Animation_Setting 10077 typedef enum _Elm_Thumb_Animation_Setting
10024 { 10078 {
10025 ELM_THUMB_ANIMATION_START = 0, /* Play animation once */ 10079 ELM_THUMB_ANIMATION_START = 0, /**< Play animation once */
10026 ELM_THUMB_ANIMATION_LOOP, /* Keep playing animation until stop is requested */ 10080 ELM_THUMB_ANIMATION_LOOP, /**< Keep playing animation until stop is requested */
10027 ELM_THUMB_ANIMATION_STOP, 10081 ELM_THUMB_ANIMATION_STOP, /**< Stop playing the animation */
10028 ELM_THUMB_ANIMATION_LAST 10082 ELM_THUMB_ANIMATION_LAST
10029 } Elm_Thumb_Animation_Setting; 10083 } Elm_Thumb_Animation_Setting;
10030 10084
10085 /**
10086 * Add a new thumb object to the parent.
10087 *
10088 * @param parent The parent object.
10089 * @return The new object or NULL if it cannot be created.
10090 *
10091 * @see elm_thumb_file_set()
10092 * @see elm_thumb_ethumb_client_get()
10093 *
10094 * @ingroup Thumb
10095 */
10031 EAPI Evas_Object *elm_thumb_add(Evas_Object *parent) EINA_ARG_NONNULL(1); 10096 EAPI Evas_Object *elm_thumb_add(Evas_Object *parent) EINA_ARG_NONNULL(1);
10097 /**
10098 * Reload thumbnail if it was generated before.
10099 *
10100 * @param obj The thumb object to reload
10101 *
10102 * This is useful if the ethumb client configuration changed, like its
10103 * size, aspect or any other property one set in the handle returned
10104 * by elm_thumb_ethumb_client_get().
10105 *
10106 * If the options didn't change, the thumbnail won't be generated again, but
10107 * the old one will still be used.
10108 *
10109 * @see elm_thumb_file_set()
10110 *
10111 * @ingroup Thumb
10112 */
10032 EAPI void elm_thumb_reload(Evas_Object *obj) EINA_ARG_NONNULL(1); 10113 EAPI void elm_thumb_reload(Evas_Object *obj) EINA_ARG_NONNULL(1);
10114 /**
10115 * Set the file that will be used as thumbnail.
10116 *
10117 * @param obj The thumb object.
10118 * @param file The path to file that will be used as thumb.
10119 * @param key The key used in case of an EET file.
10120 *
10121 * The file can be an image or a video (in that case, acceptable extensions are:
10122 * avi, mp4, ogv, mov, mpg and wmv). To start the video animation, use the
10123 * function elm_thumb_animate().
10124 *
10125 * @see elm_thumb_file_get()
10126 * @see elm_thumb_reload()
10127 * @see elm_thumb_animate()
10128 *
10129 * @ingroup Thumb
10130 */
10033 EAPI void elm_thumb_file_set(Evas_Object *obj, const char *file, const char *key) EINA_ARG_NONNULL(1); 10131 EAPI void elm_thumb_file_set(Evas_Object *obj, const char *file, const char *key) EINA_ARG_NONNULL(1);
10132 /**
10133 * Get the image or video path and key used to generate the thumbnail.
10134 *
10135 * @param obj The thumb object.
10136 * @param file Pointer to filename.
10137 * @param key Pointer to key.
10138 *
10139 * @see elm_thumb_file_set()
10140 * @see elm_thumb_path_get()
10141 *
10142 * @ingroup Thumb
10143 */
10034 EAPI void elm_thumb_file_get(const Evas_Object *obj, const char **file, const char **key) EINA_ARG_NONNULL(1); 10144 EAPI void elm_thumb_file_get(const Evas_Object *obj, const char **file, const char **key) EINA_ARG_NONNULL(1);
10145 /**
10146 * Get the path and key to the image or video generated by ethumb.
10147 *
10148 * One just need to make sure that the thumbnail was generated before getting
10149 * its path; otherwise, the path will be NULL. One way to do that is by asking
10150 * for the path when/after the "generate,stop" smart callback is called.
10151 *
10152 * @param obj The thumb object.
10153 * @param file Pointer to thumb path.
10154 * @param key Pointer to thumb key.
10155 *
10156 * @see elm_thumb_file_get()
10157 *
10158 * @ingroup Thumb
10159 */
10035 EAPI void elm_thumb_path_get(const Evas_Object *obj, const char **file, const char **key) EINA_ARG_NONNULL(1); 10160 EAPI void elm_thumb_path_get(const Evas_Object *obj, const char **file, const char **key) EINA_ARG_NONNULL(1);
10161 /**
10162 * Set the animation state for the thumb object. If its content is an animated
10163 * video, you may start/stop the animation or tell it to play continuously and
10164 * looping.
10165 *
10166 * @param obj The thumb object.
10167 * @param setting The animation setting.
10168 *
10169 * @see elm_thumb_file_set()
10170 *
10171 * @ingroup Thumb
10172 */
10036 EAPI void elm_thumb_animate_set(Evas_Object *obj, Elm_Thumb_Animation_Setting s) EINA_ARG_NONNULL(1); 10173 EAPI void elm_thumb_animate_set(Evas_Object *obj, Elm_Thumb_Animation_Setting s) EINA_ARG_NONNULL(1);
10174 /**
10175 * Get the animation state for the thumb object.
10176 *
10177 * @param obj The thumb object.
10178 * @return getting The animation setting or @c ELM_THUMB_ANIMATION_LAST,
10179 * on errors.
10180 *
10181 * @see elm_thumb_animate_set()
10182 *
10183 * @ingroup Thumb
10184 */
10037 EAPI Elm_Thumb_Animation_Setting elm_thumb_animate_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); 10185 EAPI Elm_Thumb_Animation_Setting elm_thumb_animate_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
10186 /**
10187 * Get the ethumb_client handle so custom configuration can be made.
10188 *
10189 * @return Ethumb_Client instance or NULL.
10190 *
10191 * This must be called before the objects are created to be sure no object is
10192 * visible and no generation started.
10193 *
10194 * Example of usage:
10195 *
10196 * @code
10197 * #include <Elementary.h>
10198 * #ifndef ELM_LIB_QUICKLAUNCH
10199 * EAPI int
10200 * elm_main(int argc, char **argv)
10201 * {
10202 * Ethumb_Client *client;
10203 *
10204 * elm_need_ethumb();
10205 *
10206 * // ... your code
10207 *
10208 * client = elm_thumb_ethumb_client_get();
10209 * if (!client)
10210 * {
10211 * ERR("could not get ethumb_client");
10212 * return 1;
10213 * }
10214 * ethumb_client_size_set(client, 100, 100);
10215 * ethumb_client_crop_align_set(client, 0.5, 0.5);
10216 * // ... your code
10217 *
10218 * // Create elm_thumb objects here
10219 *
10220 * elm_run();
10221 * elm_shutdown();
10222 * return 0;
10223 * }
10224 * #endif
10225 * ELM_MAIN()
10226 * @endcode
10227 *
10228 * @note There's only one client handle for Ethumb, so once a configuration
10229 * change is done to it, any other request for thumbnails (for any thumbnail
10230 * object) will use that configuration. Thus, this configuration is global.
10231 *
10232 * @ingroup Thumb
10233 */
10038 EAPI void *elm_thumb_ethumb_client_get(void); 10234 EAPI void *elm_thumb_ethumb_client_get(void);
10235 /**
10236 * Get the ethumb_client connection state.
10237 *
10238 * @return EINA_TRUE if the client is connected to the server or EINA_FALSE
10239 * otherwise.
10240 */
10039 EAPI Eina_Bool elm_thumb_ethumb_client_connected(void); 10241 EAPI Eina_Bool elm_thumb_ethumb_client_connected(void);
10242 /**
10243 * Make the thumbnail 'editable'.
10244 *
10245 * @param obj Thumb object.
10246 * @param set Turn on or off editability. Default is @c EINA_FALSE.
10247 *
10248 * This means the thumbnail is a valid drag target for drag and drop, and can be
10249 * cut or pasted too.
10250 *
10251 * @seee elm_thumb_editable_get()
10252 *
10253 * @ingroup Thumb
10254 */
10040 EAPI Eina_Bool elm_thumb_editable_set(Evas_Object *obj, Eina_Bool edit) EINA_ARG_NONNULL(1); 10255 EAPI Eina_Bool elm_thumb_editable_set(Evas_Object *obj, Eina_Bool edit) EINA_ARG_NONNULL(1);
10041 EAPI Eina_Bool elm_thumb_editable_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); 10256 /**
10042 /* available styles: 10257 * Make the thumbnail 'editable'.
10043 * default 10258 *
10044 * noframe 10259 * @param obj Thumb object.
10260 * @return Editability.
10261 *
10262 * This means the thumbnail is a valid drag target for drag and drop, and can be
10263 * cut or pasted too.
10264 *
10265 * @seee elm_thumb_editable_set()
10266 *
10267 * @ingroup Thumb
10045 */ 10268 */
10046 /* smart callbacks called: 10269 EAPI Eina_Bool elm_thumb_editable_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
10047 * "clicked" - This is called when a user has clicked the thumb without dragging around. 10270
10048 * "clicked,double" - This is called when a user has double-clicked the thumb. 10271 /**
10049 * "press" - This is called when a user has pressed down the thumb. 10272 * @}
10050 * "generate,start" - The thumbnail generation started.
10051 * "generate,stop" - The generation process stopped.
10052 * "generate,error" - The generation failed.
10053 * "load,error" - The thumbnail image loading failed.
10054 */ 10273 */
10055 10274
10056 /** 10275 /**
diff --git a/src/lib/elm_thumb.c b/src/lib/elm_thumb.c
index b7b925380..e4329da24 100644
--- a/src/lib/elm_thumb.c
+++ b/src/lib/elm_thumb.c
@@ -1,26 +1,6 @@
1#include <Elementary.h> 1#include <Elementary.h>
2#include "elm_priv.h" 2#include "elm_priv.h"
3 3
4/**
5 * @defgroup Thumb Thumb
6 *
7 * A thumb object is used for displaying the thumbnail of an image or video.
8 * You must have compiled Elementary with Ethumb_Client support and the DBus
9 * service must be present and auto-activated in order to have thumbnails to
10 * be generated.
11 *
12 * Signals that you can add callbacks for are:
13 *
14 * "clicked" - This is called when a user has clicked the thumb without dragging
15 * around.
16 * "clicked,double" - This is called when a user has double-clicked the thumb.
17 * "press" - This is called when a user has pressed down the thumb.
18 * "generate,start" - The thumbnail generation started.
19 * "generate,stop" - The generation process stopped.
20 * "generate,error" - The generation failed.
21 * "load,error" - The thumbnail image loading failed.
22 */
23
24typedef struct _Widget_Data Widget_Data; 4typedef struct _Widget_Data Widget_Data;
25 5
26struct _Widget_Data 6struct _Widget_Data
@@ -600,17 +580,6 @@ elm_need_ethumb(void)
600#endif 580#endif
601} 581}
602 582
603/**
604 * Add a new thumb object to the parent.
605 *
606 * @param parent The parent object.
607 * @return The new object or NULL if it cannot be created.
608 *
609 * @see elm_thumb_file_set()
610 * @see elm_thumb_ethumb_client_get()
611 *
612 * @ingroup Thumb
613 */
614EAPI Evas_Object * 583EAPI Evas_Object *
615elm_thumb_add(Evas_Object *parent) 584elm_thumb_add(Evas_Object *parent)
616{ 585{
@@ -666,19 +635,6 @@ elm_thumb_add(Evas_Object *parent)
666 return obj; 635 return obj;
667} 636}
668 637
669/**
670 * Reload thumbnail if it was generated before.
671 *
672 * This is useful if the ethumb client configuration changed, like its
673 * size, aspect or any other property one set in the handle returned
674 * by elm_thumb_ethumb_client_get().
675 *
676 * @param obj The thumb object to reload
677 *
678 * @see elm_thumb_file_set()
679 *
680 * @ingroup Thumb
681 */
682EAPI void 638EAPI void
683elm_thumb_reload(Evas_Object *obj) 639elm_thumb_reload(Evas_Object *obj)
684{ 640{
@@ -694,23 +650,6 @@ elm_thumb_reload(Evas_Object *obj)
694#endif 650#endif
695} 651}
696 652
697/**
698 * Set the file that will be used as thumbnail.
699 *
700 * The file can be an image or a video (in that case, acceptable extensions are:
701 * avi, mp4, ogv, mov, mpg and wmv). To start the video animation, use the
702 * function elm_thumb_animate().
703 *
704 * @param obj The thumb object.
705 * @param file The path to file that will be used as thumb.
706 * @param key The key used in case of an EET file.
707 *
708 * @see elm_thumb_file_get()
709 * @see elm_thumb_reload()
710 * @see elm_thumb_animate()
711 *
712 * @ingroup Thumb
713 */
714EAPI void 653EAPI void
715elm_thumb_file_set(Evas_Object *obj, const char *file, const char *key) 654elm_thumb_file_set(Evas_Object *obj, const char *file, const char *key)
716{ 655{
@@ -753,19 +692,6 @@ elm_thumb_file_set(Evas_Object *obj, const char *file, const char *key)
753#endif 692#endif
754} 693}
755 694
756/**
757 * Get the image or video path and key used to generate the thumbnail.
758 *
759 * @param obj The thumb object.
760 * @param file Pointer to filename.
761 * @param key Pointer to key.
762 *
763 * @see elm_thumb_file_set()
764 * @see elm_thumb_path_get()
765 * @see elm_thumb_animate()
766 *
767 * @ingroup Thumb
768 */
769EAPI void 695EAPI void
770elm_thumb_file_get(const Evas_Object *obj, const char **file, const char **key) 696elm_thumb_file_get(const Evas_Object *obj, const char **file, const char **key)
771{ 697{
@@ -778,21 +704,6 @@ elm_thumb_file_get(const Evas_Object *obj, const char **file, const char **key)
778 *key = wd->key; 704 *key = wd->key;
779} 705}
780 706
781/**
782 * Get the path and key to the image or video generated by ethumb.
783 *
784 * One just need to make sure that the thumbnail was generated before getting
785 * its path; otherwise, the path will be NULL. One way to do that is by asking
786 * for the path when/after the "generate,stop" smart callback is called.
787 *
788 * @param obj The thumb object.
789 * @param file Pointer to thumb path.
790 * @param key Pointer to thumb key.
791 *
792 * @see elm_thumb_file_get()
793 *
794 * @ingroup Thumb
795 */
796EAPI void 707EAPI void
797elm_thumb_path_get(const Evas_Object *obj, const char **file, const char **key) 708elm_thumb_path_get(const Evas_Object *obj, const char **file, const char **key)
798{ 709{
@@ -805,18 +716,6 @@ elm_thumb_path_get(const Evas_Object *obj, const char **file, const char **key)
805 *key = wd->thumb.key; 716 *key = wd->thumb.key;
806} 717}
807 718
808/**
809 * Set the animation state for the thumb object. If its content is an animated
810 * video, you may start/stop the animation or tell it to play continuously and
811 * looping.
812 *
813 * @param obj The thumb object.
814 * @param setting The animation setting.
815 *
816 * @see elm_thumb_file_set()
817 *
818 * @ingroup Thumb
819 */
820EAPI void 719EAPI void
821elm_thumb_animate_set(Evas_Object *obj, Elm_Thumb_Animation_Setting setting) 720elm_thumb_animate_set(Evas_Object *obj, Elm_Thumb_Animation_Setting setting)
822{ 721{
@@ -834,17 +733,6 @@ elm_thumb_animate_set(Evas_Object *obj, Elm_Thumb_Animation_Setting setting)
834 edje_object_signal_emit(wd->view, "animate_stop", ""); 733 edje_object_signal_emit(wd->view, "animate_stop", "");
835} 734}
836 735
837/**
838 * Get the animation state for the thumb object.
839 *
840 * @param obj The thumb object.
841 * @return getting The animation setting or @c ELM_THUMB_ANIMATION_LAST,
842 * on errors.
843 *
844 * @see elm_thumb_file_get()
845 *
846 * @ingroup Thumb
847 */
848EAPI Elm_Thumb_Animation_Setting 736EAPI Elm_Thumb_Animation_Setting
849elm_thumb_animate_get(const Evas_Object *obj) 737elm_thumb_animate_get(const Evas_Object *obj)
850{ 738{
@@ -854,61 +742,12 @@ elm_thumb_animate_get(const Evas_Object *obj)
854 return wd->anim_setting; 742 return wd->anim_setting;
855} 743}
856 744
857/**
858 * Get the ethumb_client handle so custom configuration can be made.
859 * This must be called before the objects are created to be sure no object is
860 * visible and no generation started.
861 *
862 * @return Ethumb_Client instance or NULL.
863 *
864 * Example of usage:
865 *
866 * @code
867 * #include <Elementary.h>
868 * #ifndef ELM_LIB_QUICKLAUNCH
869 * EAPI int
870 * elm_main(int argc, char **argv)
871 * {
872 * Ethumb_Client *client;
873 *
874 * elm_need_ethumb();
875 *
876 * // ... your code
877 *
878 * client = elm_thumb_ethumb_client_get();
879 * if (!client)
880 * {
881 * ERR("could not get ethumb_client");
882 * return 1;
883 * }
884 * ethumb_client_size_set(client, 100, 100);
885 * ethumb_client_crop_align_set(client, 0.5, 0.5);
886 * // ... your code
887 *
888 * // Create elm_thumb objects here
889 *
890 * elm_run();
891 * elm_shutdown();
892 * return 0;
893 * }
894 * #endif
895 * ELM_MAIN()
896 * @endcode
897 *
898 * @ingroup Thumb
899 */
900EAPI void * 745EAPI void *
901elm_thumb_ethumb_client_get(void) 746elm_thumb_ethumb_client_get(void)
902{ 747{
903 return _elm_ethumb_client; 748 return _elm_ethumb_client;
904} 749}
905 750
906/**
907 * Get the ethumb_client connection state.
908 *
909 * @return EINA_TRUE if the client is connected to the server or
910 * EINA_FALSE otherwise.
911 */
912EAPI Eina_Bool 751EAPI Eina_Bool
913elm_thumb_ethumb_client_connected(void) 752elm_thumb_ethumb_client_connected(void)
914{ 753{