forked from enlightenment/efl
elementary/thumb - Added explained example and some more doc.
SVN revision: 61960
This commit is contained in:
parent
05b42aa217
commit
5286f7a506
|
@ -77,7 +77,8 @@ WGT_PREVIEW = \
|
|||
table::preview-00.png:widget_preview_table:100:100 \
|
||||
win:preview-00.png:widget_preview_win:200:200 \
|
||||
table:preview-00.png:widget_preview_table:100:100 \
|
||||
menu:preview-00.png:widget_preview_menu:100:100
|
||||
menu:preview-00.png:widget_preview_menu:100:100 \
|
||||
thumb:preview-00.png:widget_preview_thumb:100:100
|
||||
|
||||
widget-build:
|
||||
@$(MAKE) -C widgets
|
||||
|
|
|
@ -81,6 +81,8 @@
|
|||
*
|
||||
* @ref genlist_example_05
|
||||
*
|
||||
* @ref thumb_example_01
|
||||
*
|
||||
* @ref progressbar_example
|
||||
*
|
||||
* @ref slideshow_example
|
||||
|
@ -4714,6 +4716,46 @@
|
|||
* @image latex screenshots/genlist_example_05.eps width=\textwidth
|
||||
*/
|
||||
|
||||
/**
|
||||
* @page thumb_example_01 Thumb - generating thumbnails.
|
||||
*
|
||||
* This example shows how to create a simple thumbnail object with Elementary.
|
||||
* The full source code can be found at @ref thumb_example_01_c
|
||||
*
|
||||
* Everything is very simple. First we need to tell elementary that we need
|
||||
* Ethumb to generate the thumbnails:
|
||||
*
|
||||
* @dontinclude thumb_example_01.c
|
||||
* @skipline elm_need_ethumb
|
||||
*
|
||||
* Then, after creating the window and background, we setup our client to
|
||||
* generate images of 160x160:
|
||||
*
|
||||
* @skip client_get
|
||||
* @until size_set
|
||||
*
|
||||
* After that, we can start creating thumbnail objects. They are very similar to
|
||||
* image or icon objects:
|
||||
*
|
||||
* @until thumb_reload
|
||||
*
|
||||
* As you can see, the main different function here is elm_thumb_reload(), which
|
||||
* will check if the options of the Ethumb client have changed. If so, it will
|
||||
* re-generate the thumbnail, and show the new one.
|
||||
*
|
||||
* Notice in this example that the thumbnail object is displayed on the size of
|
||||
* the window (320x320 pixels), but the thumbnail generated and stored has size
|
||||
* 160x160 pixels. That's why the picture seems upscaled.
|
||||
*
|
||||
* Ideally, you will be generating thumbnails with the size that you will be
|
||||
* using them.
|
||||
*
|
||||
* The example will look like this when running:
|
||||
*
|
||||
* @image html screenshots/thumb_example_01.png
|
||||
* @image latex screenshots/thumb_example_01.eps width=\textwidth
|
||||
*/
|
||||
|
||||
/**
|
||||
* @page progressbar_example Progress bar widget example
|
||||
*
|
||||
|
@ -5644,6 +5686,12 @@
|
|||
* @example genlist_example_05.c
|
||||
*/
|
||||
|
||||
/**
|
||||
* @page thumb_example_01_c thumb_example_01.c
|
||||
* @include thumb_example_01.c
|
||||
* @example thumb_example_01.c
|
||||
*/
|
||||
|
||||
/**
|
||||
* @page progressbar_example_c Progress bar example
|
||||
* @include progressbar_example.c
|
||||
|
|
|
@ -190,6 +190,9 @@
|
|||
* @image html img/widget/spinner/preview-00.png
|
||||
* @image latex img/widget/spinner/preview-00.eps
|
||||
* @li @ref Thumb
|
||||
|
||||
* @image html img/widget/thumb/preview-00.png
|
||||
* @image latex img/widget/thumb/preview-00.eps
|
||||
* @li @ref Toggle
|
||||
*
|
||||
* @image html img/widget/toggle/preview-00.png
|
||||
|
|
|
@ -92,7 +92,8 @@ widget_preview_inwin3 \
|
|||
widget_preview_scroller \
|
||||
widget_preview_table \
|
||||
widget_preview_win \
|
||||
widget_preview_menu
|
||||
widget_preview_menu \
|
||||
widget_preview_thumb
|
||||
|
||||
LDADD = $(top_builddir)/src/lib/libelementary.la @ELEMENTARY_EWEATHER_LIBS@ @ELEMENTARY_EDBUS_LIBS@ @ELEMENTARY_EFREET_LIBS@ @ELEMENTARY_EMAP_LIBS@ @ELEMENTARY_LIBS@ @EIO_LIBS@ @my_libs@
|
||||
|
||||
|
@ -166,5 +167,6 @@ EXTRA_DIST = \
|
|||
widget_preview_table.c \
|
||||
widget_preview_win.c \
|
||||
widget_preview_menu.c \
|
||||
widget_preview_thumb.c \
|
||||
widget_preview_tmpl_foot.c \
|
||||
widget_preview_tmpl_head.c
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
#include "widget_preview_tmpl_head.c"
|
||||
|
||||
elm_need_ethumb();
|
||||
|
||||
Evas_Object *o = elm_thumb_add(win);
|
||||
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
elm_win_resize_object_add(win, o);
|
||||
|
||||
elm_thumb_file_set(o, PACKAGE_DATA_DIR"/images/plant_01.jpg", NULL);
|
||||
evas_object_show(o);
|
||||
|
||||
#include "widget_preview_tmpl_foot.c"
|
|
@ -107,7 +107,8 @@ SRCS = \
|
|||
scroller_example_01.c \
|
||||
table_example_01.c \
|
||||
table_example_02.c \
|
||||
menu_example_01.c
|
||||
menu_example_01.c \
|
||||
thumb_example_01.c
|
||||
|
||||
pkglib_PROGRAMS =
|
||||
|
||||
|
@ -204,7 +205,8 @@ pkglib_PROGRAMS += \
|
|||
scroller_example_01 \
|
||||
table_example_01 \
|
||||
table_example_02 \
|
||||
menu_example_01
|
||||
menu_example_01 \
|
||||
thumb_example_01
|
||||
|
||||
# This variable will hold the list of screenshots that will be made
|
||||
# by "make screenshots". Each item in the list is of the form:
|
||||
|
@ -267,6 +269,7 @@ SCREENSHOTS = \
|
|||
genlist_example_03:genlist_example_03.png:0.1 \
|
||||
genlist_example_04:genlist_example_04.png:0.1 \
|
||||
genlist_example_05:genlist_example_05.png:0.1 \
|
||||
thumb_example_01:thumb_example_01.png:0.5 \
|
||||
entry_example:entry_example.png:0.0 \
|
||||
progressbar_example:progressbar_example.png:0.0 \
|
||||
notify_example_01:notify_example_01.png:0.0 \
|
||||
|
|
|
@ -0,0 +1,86 @@
|
|||
//Compile with:
|
||||
//gcc -g `pkg-config --cflags --libs elementary` thumb_example_01.c -o thumb_example_01
|
||||
|
||||
#include <Elementary.h>
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "elementary_config.h"
|
||||
#else
|
||||
# define __UNUSED__
|
||||
# define PACKAGE_DATA_DIR "."
|
||||
#endif
|
||||
|
||||
static void
|
||||
_generation_started_cb(void *data __UNUSED__, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
|
||||
{
|
||||
printf("thumbnail generation started.\n");
|
||||
}
|
||||
|
||||
static void
|
||||
_generation_finished_cb(void *data __UNUSED__, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
|
||||
{
|
||||
printf("thumbnail generation finished.\n");
|
||||
}
|
||||
|
||||
static void
|
||||
_generation_error_cb(void *data __UNUSED__, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
|
||||
{
|
||||
printf("thumbnail generation error.\n");
|
||||
}
|
||||
|
||||
int
|
||||
elm_main(int argc __UNUSED__, char **argv __UNUSED__)
|
||||
{
|
||||
Evas_Object *win, *bg;
|
||||
Evas_Object *thumb;
|
||||
Ethumb_Client *client;
|
||||
char buf[PATH_MAX];
|
||||
|
||||
elm_need_ethumb();
|
||||
|
||||
win = elm_win_add(NULL, "thumb", ELM_WIN_BASIC);
|
||||
elm_win_title_set(win, "Thumbnailer");
|
||||
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
|
||||
elm_win_autodel_set(win, 1);
|
||||
|
||||
bg = elm_bg_add(win);
|
||||
evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
elm_win_resize_object_add(win, bg);
|
||||
evas_object_show(bg);
|
||||
|
||||
client = elm_thumb_ethumb_client_get();
|
||||
if (!client)
|
||||
{
|
||||
printf("error: could not get Ethumb client.\n");
|
||||
return 1;
|
||||
}
|
||||
ethumb_client_size_set(client, 160, 160);
|
||||
|
||||
thumb = elm_thumb_add(win);
|
||||
|
||||
evas_object_smart_callback_add(thumb, "generate,start", _generation_started_cb, NULL);
|
||||
evas_object_smart_callback_add(thumb, "generate,stop", _generation_finished_cb, NULL);
|
||||
evas_object_smart_callback_add(thumb, "generate,error", _generation_error_cb, NULL);
|
||||
|
||||
elm_thumb_editable_set(thumb, EINA_FALSE);
|
||||
snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", PACKAGE_DATA_DIR);
|
||||
elm_thumb_file_set(thumb, buf, NULL);
|
||||
elm_thumb_reload(thumb);
|
||||
|
||||
evas_object_size_hint_weight_set(thumb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
elm_win_resize_object_add(win, thumb);
|
||||
evas_object_show(thumb);
|
||||
|
||||
evas_object_size_hint_min_set(bg, 160, 160);
|
||||
evas_object_size_hint_max_set(bg, 640, 640);
|
||||
evas_object_resize(win, 320, 320);
|
||||
evas_object_show(win);
|
||||
|
||||
elm_run(); /* and run the program now, starting to handle all
|
||||
* events, etc. */
|
||||
elm_shutdown(); /* clean up and shut down */
|
||||
|
||||
/* exit code */
|
||||
return 0;
|
||||
}
|
||||
|
||||
ELM_MAIN()
|
|
@ -10019,38 +10019,257 @@ extern "C" {
|
|||
*/
|
||||
EAPI Evas_Object *elm_gesture_layer_add(Evas_Object *parent) EINA_ARG_NONNULL(1);
|
||||
|
||||
/* thumb */
|
||||
/**
|
||||
* @defgroup Thumb Thumb
|
||||
*
|
||||
* @image html img/widget/thumb/preview-00.png
|
||||
* @image latex img/widget/thumb/preview-00.eps
|
||||
*
|
||||
* A thumb object is used for displaying the thumbnail of an image or video.
|
||||
* You must have compiled Elementary with Ethumb_Client support and the DBus
|
||||
* service must be present and auto-activated in order to have thumbnails to
|
||||
* be generated.
|
||||
*
|
||||
* Once the thumbnail object becomes visible, it will check if there is a
|
||||
* previously generated thumbnail image for the file set on it. If not, it
|
||||
* will start generating this thumbnail.
|
||||
*
|
||||
* Different config settings will cause different thumbnails to be generated
|
||||
* even on the same file.
|
||||
*
|
||||
* Generated thumbnails are stored under @c $HOME/.thumbnails/. Check the
|
||||
* Ethumb documentation to change this path, and to see other configuration
|
||||
* options.
|
||||
*
|
||||
* Signals that you can add callbacks for are:
|
||||
*
|
||||
* - "clicked" - This is called when a user has clicked the thumb without dragging
|
||||
* around.
|
||||
* - "clicked,double" - This is called when a user has double-clicked the thumb.
|
||||
* - "press" - This is called when a user has pressed down the thumb.
|
||||
* - "generate,start" - The thumbnail generation started.
|
||||
* - "generate,stop" - The generation process stopped.
|
||||
* - "generate,error" - The generation failed.
|
||||
* - "load,error" - The thumbnail image loading failed.
|
||||
*
|
||||
* available styles:
|
||||
* - default
|
||||
* - noframe
|
||||
*
|
||||
* An example of use of thumbnail:
|
||||
*
|
||||
* - @ref thumb_example_01
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup Thumb
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @enum _Elm_Thum_Animation_Setting
|
||||
* @typedef Elm_Thumb_Animation_Setting
|
||||
*
|
||||
* Used to set if a video thumbnail is animating or not.
|
||||
*
|
||||
* @ingroup Thumb
|
||||
*/
|
||||
typedef enum _Elm_Thumb_Animation_Setting
|
||||
{
|
||||
ELM_THUMB_ANIMATION_START = 0, /* Play animation once */
|
||||
ELM_THUMB_ANIMATION_LOOP, /* Keep playing animation until stop is requested */
|
||||
ELM_THUMB_ANIMATION_STOP,
|
||||
ELM_THUMB_ANIMATION_START = 0, /**< Play animation once */
|
||||
ELM_THUMB_ANIMATION_LOOP, /**< Keep playing animation until stop is requested */
|
||||
ELM_THUMB_ANIMATION_STOP, /**< Stop playing the animation */
|
||||
ELM_THUMB_ANIMATION_LAST
|
||||
} Elm_Thumb_Animation_Setting;
|
||||
|
||||
EAPI Evas_Object *elm_thumb_add(Evas_Object *parent) EINA_ARG_NONNULL(1);
|
||||
EAPI void elm_thumb_reload(Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
EAPI void elm_thumb_file_set(Evas_Object *obj, const char *file, const char *key) EINA_ARG_NONNULL(1);
|
||||
EAPI void elm_thumb_file_get(const Evas_Object *obj, const char **file, const char **key) EINA_ARG_NONNULL(1);
|
||||
EAPI void elm_thumb_path_get(const Evas_Object *obj, const char **file, const char **key) EINA_ARG_NONNULL(1);
|
||||
EAPI void elm_thumb_animate_set(Evas_Object *obj, Elm_Thumb_Animation_Setting s) EINA_ARG_NONNULL(1);
|
||||
EAPI Elm_Thumb_Animation_Setting elm_thumb_animate_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
EAPI void *elm_thumb_ethumb_client_get(void);
|
||||
EAPI Eina_Bool elm_thumb_ethumb_client_connected(void);
|
||||
EAPI Eina_Bool elm_thumb_editable_set(Evas_Object *obj, Eina_Bool edit) EINA_ARG_NONNULL(1);
|
||||
EAPI Eina_Bool elm_thumb_editable_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
/* available styles:
|
||||
* default
|
||||
* noframe
|
||||
/**
|
||||
* Add a new thumb object to the parent.
|
||||
*
|
||||
* @param parent The parent object.
|
||||
* @return The new object or NULL if it cannot be created.
|
||||
*
|
||||
* @see elm_thumb_file_set()
|
||||
* @see elm_thumb_ethumb_client_get()
|
||||
*
|
||||
* @ingroup Thumb
|
||||
*/
|
||||
/* smart callbacks called:
|
||||
* "clicked" - This is called when a user has clicked the thumb without dragging around.
|
||||
* "clicked,double" - This is called when a user has double-clicked the thumb.
|
||||
* "press" - This is called when a user has pressed down the thumb.
|
||||
* "generate,start" - The thumbnail generation started.
|
||||
* "generate,stop" - The generation process stopped.
|
||||
* "generate,error" - The generation failed.
|
||||
* "load,error" - The thumbnail image loading failed.
|
||||
EAPI Evas_Object *elm_thumb_add(Evas_Object *parent) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* Reload thumbnail if it was generated before.
|
||||
*
|
||||
* @param obj The thumb object to reload
|
||||
*
|
||||
* This is useful if the ethumb client configuration changed, like its
|
||||
* size, aspect or any other property one set in the handle returned
|
||||
* by elm_thumb_ethumb_client_get().
|
||||
*
|
||||
* If the options didn't change, the thumbnail won't be generated again, but
|
||||
* the old one will still be used.
|
||||
*
|
||||
* @see elm_thumb_file_set()
|
||||
*
|
||||
* @ingroup Thumb
|
||||
*/
|
||||
EAPI void elm_thumb_reload(Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* Set the file that will be used as thumbnail.
|
||||
*
|
||||
* @param obj The thumb object.
|
||||
* @param file The path to file that will be used as thumb.
|
||||
* @param key The key used in case of an EET file.
|
||||
*
|
||||
* The file can be an image or a video (in that case, acceptable extensions are:
|
||||
* avi, mp4, ogv, mov, mpg and wmv). To start the video animation, use the
|
||||
* function elm_thumb_animate().
|
||||
*
|
||||
* @see elm_thumb_file_get()
|
||||
* @see elm_thumb_reload()
|
||||
* @see elm_thumb_animate()
|
||||
*
|
||||
* @ingroup Thumb
|
||||
*/
|
||||
EAPI void elm_thumb_file_set(Evas_Object *obj, const char *file, const char *key) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* Get the image or video path and key used to generate the thumbnail.
|
||||
*
|
||||
* @param obj The thumb object.
|
||||
* @param file Pointer to filename.
|
||||
* @param key Pointer to key.
|
||||
*
|
||||
* @see elm_thumb_file_set()
|
||||
* @see elm_thumb_path_get()
|
||||
*
|
||||
* @ingroup Thumb
|
||||
*/
|
||||
EAPI void elm_thumb_file_get(const Evas_Object *obj, const char **file, const char **key) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* Get the path and key to the image or video generated by ethumb.
|
||||
*
|
||||
* One just need to make sure that the thumbnail was generated before getting
|
||||
* its path; otherwise, the path will be NULL. One way to do that is by asking
|
||||
* for the path when/after the "generate,stop" smart callback is called.
|
||||
*
|
||||
* @param obj The thumb object.
|
||||
* @param file Pointer to thumb path.
|
||||
* @param key Pointer to thumb key.
|
||||
*
|
||||
* @see elm_thumb_file_get()
|
||||
*
|
||||
* @ingroup Thumb
|
||||
*/
|
||||
EAPI void elm_thumb_path_get(const Evas_Object *obj, const char **file, const char **key) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* Set the animation state for the thumb object. If its content is an animated
|
||||
* video, you may start/stop the animation or tell it to play continuously and
|
||||
* looping.
|
||||
*
|
||||
* @param obj The thumb object.
|
||||
* @param setting The animation setting.
|
||||
*
|
||||
* @see elm_thumb_file_set()
|
||||
*
|
||||
* @ingroup Thumb
|
||||
*/
|
||||
EAPI void elm_thumb_animate_set(Evas_Object *obj, Elm_Thumb_Animation_Setting s) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* Get the animation state for the thumb object.
|
||||
*
|
||||
* @param obj The thumb object.
|
||||
* @return getting The animation setting or @c ELM_THUMB_ANIMATION_LAST,
|
||||
* on errors.
|
||||
*
|
||||
* @see elm_thumb_animate_set()
|
||||
*
|
||||
* @ingroup Thumb
|
||||
*/
|
||||
EAPI Elm_Thumb_Animation_Setting elm_thumb_animate_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* Get the ethumb_client handle so custom configuration can be made.
|
||||
*
|
||||
* @return Ethumb_Client instance or NULL.
|
||||
*
|
||||
* This must be called before the objects are created to be sure no object is
|
||||
* visible and no generation started.
|
||||
*
|
||||
* Example of usage:
|
||||
*
|
||||
* @code
|
||||
* #include <Elementary.h>
|
||||
* #ifndef ELM_LIB_QUICKLAUNCH
|
||||
* EAPI int
|
||||
* elm_main(int argc, char **argv)
|
||||
* {
|
||||
* Ethumb_Client *client;
|
||||
*
|
||||
* elm_need_ethumb();
|
||||
*
|
||||
* // ... your code
|
||||
*
|
||||
* client = elm_thumb_ethumb_client_get();
|
||||
* if (!client)
|
||||
* {
|
||||
* ERR("could not get ethumb_client");
|
||||
* return 1;
|
||||
* }
|
||||
* ethumb_client_size_set(client, 100, 100);
|
||||
* ethumb_client_crop_align_set(client, 0.5, 0.5);
|
||||
* // ... your code
|
||||
*
|
||||
* // Create elm_thumb objects here
|
||||
*
|
||||
* elm_run();
|
||||
* elm_shutdown();
|
||||
* return 0;
|
||||
* }
|
||||
* #endif
|
||||
* ELM_MAIN()
|
||||
* @endcode
|
||||
*
|
||||
* @note There's only one client handle for Ethumb, so once a configuration
|
||||
* change is done to it, any other request for thumbnails (for any thumbnail
|
||||
* object) will use that configuration. Thus, this configuration is global.
|
||||
*
|
||||
* @ingroup Thumb
|
||||
*/
|
||||
EAPI void *elm_thumb_ethumb_client_get(void);
|
||||
/**
|
||||
* Get the ethumb_client connection state.
|
||||
*
|
||||
* @return EINA_TRUE if the client is connected to the server or EINA_FALSE
|
||||
* otherwise.
|
||||
*/
|
||||
EAPI Eina_Bool elm_thumb_ethumb_client_connected(void);
|
||||
/**
|
||||
* Make the thumbnail 'editable'.
|
||||
*
|
||||
* @param obj Thumb object.
|
||||
* @param set Turn on or off editability. Default is @c EINA_FALSE.
|
||||
*
|
||||
* This means the thumbnail is a valid drag target for drag and drop, and can be
|
||||
* cut or pasted too.
|
||||
*
|
||||
* @seee elm_thumb_editable_get()
|
||||
*
|
||||
* @ingroup Thumb
|
||||
*/
|
||||
EAPI Eina_Bool elm_thumb_editable_set(Evas_Object *obj, Eina_Bool edit) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* Make the thumbnail 'editable'.
|
||||
*
|
||||
* @param obj Thumb object.
|
||||
* @return Editability.
|
||||
*
|
||||
* This means the thumbnail is a valid drag target for drag and drop, and can be
|
||||
* cut or pasted too.
|
||||
*
|
||||
* @seee elm_thumb_editable_set()
|
||||
*
|
||||
* @ingroup Thumb
|
||||
*/
|
||||
EAPI Eina_Bool elm_thumb_editable_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,26 +1,6 @@
|
|||
#include <Elementary.h>
|
||||
#include "elm_priv.h"
|
||||
|
||||
/**
|
||||
* @defgroup Thumb Thumb
|
||||
*
|
||||
* A thumb object is used for displaying the thumbnail of an image or video.
|
||||
* You must have compiled Elementary with Ethumb_Client support and the DBus
|
||||
* service must be present and auto-activated in order to have thumbnails to
|
||||
* be generated.
|
||||
*
|
||||
* Signals that you can add callbacks for are:
|
||||
*
|
||||
* "clicked" - This is called when a user has clicked the thumb without dragging
|
||||
* around.
|
||||
* "clicked,double" - This is called when a user has double-clicked the thumb.
|
||||
* "press" - This is called when a user has pressed down the thumb.
|
||||
* "generate,start" - The thumbnail generation started.
|
||||
* "generate,stop" - The generation process stopped.
|
||||
* "generate,error" - The generation failed.
|
||||
* "load,error" - The thumbnail image loading failed.
|
||||
*/
|
||||
|
||||
typedef struct _Widget_Data Widget_Data;
|
||||
|
||||
struct _Widget_Data
|
||||
|
@ -600,17 +580,6 @@ elm_need_ethumb(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new thumb object to the parent.
|
||||
*
|
||||
* @param parent The parent object.
|
||||
* @return The new object or NULL if it cannot be created.
|
||||
*
|
||||
* @see elm_thumb_file_set()
|
||||
* @see elm_thumb_ethumb_client_get()
|
||||
*
|
||||
* @ingroup Thumb
|
||||
*/
|
||||
EAPI Evas_Object *
|
||||
elm_thumb_add(Evas_Object *parent)
|
||||
{
|
||||
|
@ -666,19 +635,6 @@ elm_thumb_add(Evas_Object *parent)
|
|||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reload thumbnail if it was generated before.
|
||||
*
|
||||
* This is useful if the ethumb client configuration changed, like its
|
||||
* size, aspect or any other property one set in the handle returned
|
||||
* by elm_thumb_ethumb_client_get().
|
||||
*
|
||||
* @param obj The thumb object to reload
|
||||
*
|
||||
* @see elm_thumb_file_set()
|
||||
*
|
||||
* @ingroup Thumb
|
||||
*/
|
||||
EAPI void
|
||||
elm_thumb_reload(Evas_Object *obj)
|
||||
{
|
||||
|
@ -694,23 +650,6 @@ elm_thumb_reload(Evas_Object *obj)
|
|||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the file that will be used as thumbnail.
|
||||
*
|
||||
* The file can be an image or a video (in that case, acceptable extensions are:
|
||||
* avi, mp4, ogv, mov, mpg and wmv). To start the video animation, use the
|
||||
* function elm_thumb_animate().
|
||||
*
|
||||
* @param obj The thumb object.
|
||||
* @param file The path to file that will be used as thumb.
|
||||
* @param key The key used in case of an EET file.
|
||||
*
|
||||
* @see elm_thumb_file_get()
|
||||
* @see elm_thumb_reload()
|
||||
* @see elm_thumb_animate()
|
||||
*
|
||||
* @ingroup Thumb
|
||||
*/
|
||||
EAPI void
|
||||
elm_thumb_file_set(Evas_Object *obj, const char *file, const char *key)
|
||||
{
|
||||
|
@ -753,19 +692,6 @@ elm_thumb_file_set(Evas_Object *obj, const char *file, const char *key)
|
|||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the image or video path and key used to generate the thumbnail.
|
||||
*
|
||||
* @param obj The thumb object.
|
||||
* @param file Pointer to filename.
|
||||
* @param key Pointer to key.
|
||||
*
|
||||
* @see elm_thumb_file_set()
|
||||
* @see elm_thumb_path_get()
|
||||
* @see elm_thumb_animate()
|
||||
*
|
||||
* @ingroup Thumb
|
||||
*/
|
||||
EAPI void
|
||||
elm_thumb_file_get(const Evas_Object *obj, const char **file, const char **key)
|
||||
{
|
||||
|
@ -778,21 +704,6 @@ elm_thumb_file_get(const Evas_Object *obj, const char **file, const char **key)
|
|||
*key = wd->key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the path and key to the image or video generated by ethumb.
|
||||
*
|
||||
* One just need to make sure that the thumbnail was generated before getting
|
||||
* its path; otherwise, the path will be NULL. One way to do that is by asking
|
||||
* for the path when/after the "generate,stop" smart callback is called.
|
||||
*
|
||||
* @param obj The thumb object.
|
||||
* @param file Pointer to thumb path.
|
||||
* @param key Pointer to thumb key.
|
||||
*
|
||||
* @see elm_thumb_file_get()
|
||||
*
|
||||
* @ingroup Thumb
|
||||
*/
|
||||
EAPI void
|
||||
elm_thumb_path_get(const Evas_Object *obj, const char **file, const char **key)
|
||||
{
|
||||
|
@ -805,18 +716,6 @@ elm_thumb_path_get(const Evas_Object *obj, const char **file, const char **key)
|
|||
*key = wd->thumb.key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the animation state for the thumb object. If its content is an animated
|
||||
* video, you may start/stop the animation or tell it to play continuously and
|
||||
* looping.
|
||||
*
|
||||
* @param obj The thumb object.
|
||||
* @param setting The animation setting.
|
||||
*
|
||||
* @see elm_thumb_file_set()
|
||||
*
|
||||
* @ingroup Thumb
|
||||
*/
|
||||
EAPI void
|
||||
elm_thumb_animate_set(Evas_Object *obj, Elm_Thumb_Animation_Setting setting)
|
||||
{
|
||||
|
@ -834,17 +733,6 @@ elm_thumb_animate_set(Evas_Object *obj, Elm_Thumb_Animation_Setting setting)
|
|||
edje_object_signal_emit(wd->view, "animate_stop", "");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the animation state for the thumb object.
|
||||
*
|
||||
* @param obj The thumb object.
|
||||
* @return getting The animation setting or @c ELM_THUMB_ANIMATION_LAST,
|
||||
* on errors.
|
||||
*
|
||||
* @see elm_thumb_file_get()
|
||||
*
|
||||
* @ingroup Thumb
|
||||
*/
|
||||
EAPI Elm_Thumb_Animation_Setting
|
||||
elm_thumb_animate_get(const Evas_Object *obj)
|
||||
{
|
||||
|
@ -854,61 +742,12 @@ elm_thumb_animate_get(const Evas_Object *obj)
|
|||
return wd->anim_setting;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ethumb_client handle so custom configuration can be made.
|
||||
* This must be called before the objects are created to be sure no object is
|
||||
* visible and no generation started.
|
||||
*
|
||||
* @return Ethumb_Client instance or NULL.
|
||||
*
|
||||
* Example of usage:
|
||||
*
|
||||
* @code
|
||||
* #include <Elementary.h>
|
||||
* #ifndef ELM_LIB_QUICKLAUNCH
|
||||
* EAPI int
|
||||
* elm_main(int argc, char **argv)
|
||||
* {
|
||||
* Ethumb_Client *client;
|
||||
*
|
||||
* elm_need_ethumb();
|
||||
*
|
||||
* // ... your code
|
||||
*
|
||||
* client = elm_thumb_ethumb_client_get();
|
||||
* if (!client)
|
||||
* {
|
||||
* ERR("could not get ethumb_client");
|
||||
* return 1;
|
||||
* }
|
||||
* ethumb_client_size_set(client, 100, 100);
|
||||
* ethumb_client_crop_align_set(client, 0.5, 0.5);
|
||||
* // ... your code
|
||||
*
|
||||
* // Create elm_thumb objects here
|
||||
*
|
||||
* elm_run();
|
||||
* elm_shutdown();
|
||||
* return 0;
|
||||
* }
|
||||
* #endif
|
||||
* ELM_MAIN()
|
||||
* @endcode
|
||||
*
|
||||
* @ingroup Thumb
|
||||
*/
|
||||
EAPI void *
|
||||
elm_thumb_ethumb_client_get(void)
|
||||
{
|
||||
return _elm_ethumb_client;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ethumb_client connection state.
|
||||
*
|
||||
* @return EINA_TRUE if the client is connected to the server or
|
||||
* EINA_FALSE otherwise.
|
||||
*/
|
||||
EAPI Eina_Bool
|
||||
elm_thumb_ethumb_client_connected(void)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue