1 #include <Elementary.h>
5 * @defgroup Thumb Thumb
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
12 * Signals that you can add callbacks for are:
14 * "clicked" - This is called when a user has clicked the thumb without dragging
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.
24 typedef struct _Widget_Data Widget_Data;
38 #ifdef HAVE_ELEMENTARY_ETHUMB
39 const char *thumb_path;
40 const char *thumb_key;
41 Ethumb_Exists *exists;
43 Ethumb_Thumb_Format format;
48 Ecore_Event_Handler *eeh;
49 Elm_Thumb_Animation_Setting anim_setting;
50 Eina_Bool on_hold : 1;
51 Eina_Bool is_video : 1;
52 Eina_Bool was_video : 1;
56 static const char *widtype = NULL;
58 static const char SIG_CLICKED[] = "clicked";
59 static const char SIG_CLICKED_DOUBLE[] = "clicked,double";
60 static const char SIG_GENERATE_ERROR[] = "generate,error";
61 static const char SIG_GENERATE_START[] = "generate,start";
62 static const char SIG_GENERATE_STOP[] = "generate,stop";
63 static const char SIG_LOAD_ERROR[] = "load,error";
64 static const char SIG_PRESS[] = "press";
66 static const Evas_Smart_Cb_Description _signals[] =
69 {SIG_CLICKED_DOUBLE, ""},
70 {SIG_GENERATE_ERROR, ""},
71 {SIG_GENERATE_START, ""},
72 {SIG_GENERATE_STOP, ""},
78 #define EDJE_SIGNAL_GENERATE_START "elm,thumb,generate,start"
79 #define EDJE_SIGNAL_GENERATE_STOP "elm,thumb,generate,stop"
80 #define EDJE_SIGNAL_GENERATE_ERROR "elm,thumb,generate,error"
81 #define EDJE_SIGNAL_LOAD_ERROR "elm,thumb,load,error"
82 #define EDJE_SIGNAL_PULSE_START "elm,state,pulse,start"
83 #define EDJE_SIGNAL_PULSE_STOP "elm,state,pulse,stop"
85 struct _Ethumb_Client *_elm_ethumb_client = NULL;
86 Eina_Bool _elm_ethumb_connected = EINA_FALSE;
87 #ifdef HAVE_ELEMENTARY_ETHUMB
88 static Eina_List *retry = NULL;
89 static int pending_request = 0;
91 static void _thumb_exists(Ethumb_Client *client __UNUSED__, Ethumb_Exists *thread,
92 Eina_Bool exists, void *data);
96 EAPI int ELM_ECORE_EVENT_ETHUMB_CONNECT = 0;
99 _del_hook(Evas_Object *obj)
101 Widget_Data *wd = elm_widget_data_get(obj);
103 #ifdef HAVE_ELEMENTARY_ETHUMB
104 if (wd->thumb.id >= 0)
106 ethumb_client_generate_cancel(_elm_ethumb_client, wd->thumb.id,
110 if (wd->thumb.exists)
112 ethumb_client_thumb_exists_cancel(wd->thumb.exists, _thumb_exists, wd);
113 wd->thumb.exists = NULL;
117 retry = eina_list_remove(retry, wd);
118 wd->thumb.retry = EINA_FALSE;
121 eina_stringshare_del(wd->thumb.thumb_path);
122 eina_stringshare_del(wd->thumb.thumb_key);
125 eina_stringshare_del(wd->file);
126 eina_stringshare_del(wd->key);
127 if (wd->eeh) ecore_event_handler_del(wd->eeh);
132 _theme_hook(Evas_Object *obj)
134 Widget_Data *wd = elm_widget_data_get(obj);
135 _elm_theme_object_set(obj, wd->frame, "thumb", "base",
136 elm_widget_style_get(obj));
139 #ifdef HAVE_ELEMENTARY_ETHUMB
141 _mouse_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
143 Widget_Data *wd = data;
144 Evas_Event_Mouse_Down *ev = event_info;
148 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
149 wd->on_hold = EINA_TRUE;
151 wd->on_hold = EINA_FALSE;
152 if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
153 evas_object_smart_callback_call(wd->self, SIG_CLICKED_DOUBLE, NULL);
155 evas_object_smart_callback_call(wd->self, SIG_PRESS, NULL);
159 _mouse_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
161 Widget_Data *wd = data;
162 Evas_Event_Mouse_Up *ev = event_info;
166 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
167 wd->on_hold = EINA_TRUE;
169 wd->on_hold = EINA_FALSE;
171 evas_object_smart_callback_call(wd->self, SIG_CLICKED, NULL);
172 wd->on_hold = EINA_FALSE;
176 _thumb_ready(Widget_Data *wd, const char *thumb_path, const char *thumb_key)
181 evas_object_image_size_get(wd->view, &aw, &ah);
182 evas_object_size_hint_aspect_set(wd->view,
183 EVAS_ASPECT_CONTROL_BOTH,
185 edje_object_part_swallow(wd->frame, "elm.swallow.content", wd->view);
186 edje_object_size_min_get(wd->frame, &mw, &mh);
187 edje_object_size_min_restricted_calc(wd->frame, &mw, &mh, mw, mh);
188 evas_object_size_hint_min_set(wd->self, mw, mh);
189 eina_stringshare_replace(&(wd->thumb.file), thumb_path);
190 eina_stringshare_replace(&(wd->thumb.key), thumb_key);
191 edje_object_signal_emit(wd->frame, EDJE_SIGNAL_GENERATE_STOP, "elm");
192 evas_object_smart_callback_call(wd->self, SIG_GENERATE_STOP, NULL);
196 _thumb_loaded(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
198 Widget_Data *wd = data;
199 const char *thumb_path;
200 const char *thumb_key;
202 evas_object_image_file_get(wd->view, &thumb_path, &thumb_key);
204 _thumb_ready(wd, thumb_path, thumb_key);
207 /* As we do use stat to check if a thumbnail is available, it's possible
208 that we end up accessing before the file is completly written on disk.
209 By retrying each time a thumbnail is finished we should be fine or not.
212 _retry_thumb(Widget_Data *wd)
216 if ((wd->is_video) && (wd->thumb.format == ETHUMB_THUMB_EET))
218 edje_object_file_set(wd->view, NULL, NULL);
219 if (!edje_object_file_set(wd->view,
220 wd->thumb.thumb_path,
223 if (pending_request == 0)
224 ERR("could not set file=%s key=%s for %s",
225 wd->thumb.thumb_path,
233 evas_object_image_file_set(wd->view, NULL, NULL);
234 evas_object_image_file_set(wd->view,
235 wd->thumb.thumb_path,
236 wd->thumb.thumb_key);
237 r = evas_object_image_load_error_get(wd->view);
238 if (r != EVAS_LOAD_ERROR_NONE)
240 if (pending_request == 0)
241 ERR("%s: %s", wd->thumb.thumb_path, evas_load_error_str(r));
245 evas_object_event_callback_add(wd->view,
246 EVAS_CALLBACK_IMAGE_PRELOADED,
248 evas_object_image_preload(wd->view, EINA_TRUE);
252 _thumb_ready(wd, wd->thumb.thumb_path, wd->thumb.thumb_key);
254 eina_stringshare_del(wd->thumb.thumb_path);
255 wd->thumb.thumb_path = NULL;
257 eina_stringshare_del(wd->thumb.thumb_key);
258 wd->thumb.thumb_key = NULL;
267 _finished_thumb(Widget_Data *wd,
268 const char *thumb_path,
269 const char *thumb_key)
275 evas = evas_object_evas_get(wd->self);
276 if ((wd->view) && (wd->is_video ^ wd->was_video))
278 evas_object_del(wd->view);
281 wd->was_video = wd->is_video;
283 if ((wd->is_video) &&
284 (ethumb_client_format_get(_elm_ethumb_client) == ETHUMB_THUMB_EET))
288 wd->view = edje_object_add(evas);
291 ERR("could not create edje object");
294 elm_widget_sub_object_add(wd->self, wd->view);
297 if (!edje_object_file_set(wd->view, thumb_path, thumb_key))
299 wd->thumb.thumb_path = eina_stringshare_ref(thumb_path);
300 wd->thumb.thumb_key = eina_stringshare_ref(thumb_key);
301 wd->thumb.format = ethumb_client_format_get(_elm_ethumb_client);
302 wd->thumb.retry = EINA_TRUE;
304 retry = eina_list_append(retry, wd);
312 wd->view = evas_object_image_filled_add(evas);
315 ERR("could not create image object");
318 evas_object_event_callback_add(wd->view,
319 EVAS_CALLBACK_IMAGE_PRELOADED,
321 elm_widget_sub_object_add(wd->self, wd->view);
322 evas_object_hide(wd->view);
325 evas_object_image_file_set(wd->view, thumb_path, thumb_key);
326 r = evas_object_image_load_error_get(wd->view);
327 if (r != EVAS_LOAD_ERROR_NONE)
329 WRN("%s: %s", thumb_path, evas_load_error_str(r));
330 wd->thumb.thumb_path = eina_stringshare_ref(thumb_path);
331 wd->thumb.thumb_key = eina_stringshare_ref(thumb_key);
332 wd->thumb.format = ethumb_client_format_get(_elm_ethumb_client);
333 wd->thumb.retry = EINA_TRUE;
335 retry = eina_list_append(retry, wd);
339 evas_object_image_preload(wd->view, 0);
343 _thumb_ready(wd, thumb_path, thumb_key);
345 EINA_LIST_FOREACH_SAFE(retry, l, ll, wd)
346 if (_retry_thumb(wd))
347 retry = eina_list_remove_list(retry, l);
349 if (pending_request == 0)
350 EINA_LIST_FREE(retry, wd)
352 eina_stringshare_del(wd->thumb.thumb_path);
353 wd->thumb.thumb_path = NULL;
355 eina_stringshare_del(wd->thumb.thumb_key);
356 wd->thumb.thumb_key = NULL;
358 evas_object_del(wd->view);
361 edje_object_signal_emit(wd->frame, EDJE_SIGNAL_LOAD_ERROR, "elm");
362 evas_object_smart_callback_call(wd->self, SIG_LOAD_ERROR, NULL);
368 edje_object_signal_emit(wd->frame, EDJE_SIGNAL_LOAD_ERROR, "elm");
369 evas_object_smart_callback_call(wd->self, SIG_LOAD_ERROR, NULL);
373 _finished_thumb_cb(void *data, Ethumb_Client *c __UNUSED__, int id, const char *file, const char *key, const char *thumb_path, const char *thumb_key, Eina_Bool success)
375 Widget_Data *wd = data;
377 EINA_SAFETY_ON_FALSE_RETURN(wd->thumb.id == id);
382 edje_object_signal_emit(wd->frame, EDJE_SIGNAL_PULSE_STOP, "elm");
386 _finished_thumb(wd, thumb_path, thumb_key);
390 ERR("could not generate thumbnail for %s (key: %s)", file, key ? key : "");
391 edje_object_signal_emit(wd->frame, EDJE_SIGNAL_GENERATE_ERROR, "elm");
392 evas_object_smart_callback_call(wd->self, SIG_GENERATE_ERROR, NULL);
396 _thumb_exists(Ethumb_Client *client __UNUSED__, Ethumb_Exists *thread,
397 Eina_Bool exists, void *data)
399 Widget_Data *wd = data;
401 if (ethumb_client_thumb_exists_check(thread))
404 wd->thumb.exists = NULL;
408 const char *thumb_path, *thumb_key;
413 ethumb_client_thumb_path_get(_elm_ethumb_client, &thumb_path,
415 _finished_thumb(wd, thumb_path, thumb_key);
418 else if ((wd->thumb.id = ethumb_client_generate
419 (_elm_ethumb_client, _finished_thumb_cb, wd, NULL)) != -1)
421 edje_object_signal_emit(wd->frame, EDJE_SIGNAL_PULSE_START, "elm");
422 edje_object_signal_emit(wd->frame, EDJE_SIGNAL_GENERATE_START, "elm");
423 evas_object_smart_callback_call(wd->self, SIG_GENERATE_START, NULL);
430 edje_object_signal_emit(wd->frame, EDJE_SIGNAL_GENERATE_ERROR, "elm");
431 evas_object_smart_callback_call(wd->self, SIG_GENERATE_ERROR, NULL);
437 _thumb_apply(Widget_Data *wd)
439 if (wd->thumb.id > 0)
441 ethumb_client_generate_cancel
442 (_elm_ethumb_client, wd->thumb.id, NULL, NULL, NULL);
446 if (wd->thumb.exists)
448 ethumb_client_thumb_exists_cancel(wd->thumb.exists, _thumb_exists, wd);
449 wd->thumb.exists = NULL;
454 retry = eina_list_remove(retry, wd);
455 wd->thumb.retry = EINA_FALSE;
458 if (!wd->file) return;
461 ethumb_client_file_set(_elm_ethumb_client, wd->file, wd->key);
462 wd->thumb.exists = ethumb_client_thumb_exists(_elm_ethumb_client,
468 _thumb_apply_cb(void *data, int type __UNUSED__, void *ev __UNUSED__)
471 return ECORE_CALLBACK_RENEW;
475 _thumb_show(Widget_Data *wd)
477 evas_object_show(wd->frame);
479 if (elm_thumb_ethumb_client_connected())
486 wd->eeh = ecore_event_handler_add(ELM_ECORE_EVENT_ETHUMB_CONNECT,
487 _thumb_apply_cb, wd);
491 _thumb_show_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
497 _thumb_hide_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
499 Widget_Data *wd = data;
501 evas_object_hide(wd->frame);
503 if (wd->thumb.id >= 0)
505 ethumb_client_generate_cancel
506 (_elm_ethumb_client, wd->thumb.id, NULL, NULL, NULL);
509 edje_object_signal_emit(wd->frame, EDJE_SIGNAL_GENERATE_STOP, "elm");
510 evas_object_smart_callback_call(wd->self, SIG_GENERATE_STOP, NULL);
513 if (wd->thumb.exists)
515 ethumb_client_thumb_exists_cancel(wd->thumb.exists, _thumb_exists, wd);
516 wd->thumb.exists = NULL;
521 retry = eina_list_remove(retry, wd);
522 wd->thumb.retry = EINA_FALSE;
527 ecore_event_handler_del(wd->eeh);
535 static int _elm_need_ethumb = 0;
537 static void _on_die_cb(void *, Ethumb_Client *);
540 _connect_cb(void *data __UNUSED__, Ethumb_Client *c, Eina_Bool success)
544 ethumb_client_on_server_die_callback_set(c, _on_die_cb, NULL, NULL);
545 _elm_ethumb_connected = EINA_TRUE;
546 ecore_event_add(ELM_ECORE_EVENT_ETHUMB_CONNECT, NULL, NULL, NULL);
549 _elm_ethumb_client = NULL;
553 _on_die_cb(void *data __UNUSED__, Ethumb_Client *c __UNUSED__)
555 ethumb_client_disconnect(_elm_ethumb_client);
556 _elm_ethumb_client = NULL;
557 _elm_ethumb_connected = EINA_FALSE;
558 _elm_ethumb_client = ethumb_client_connect(_connect_cb, NULL, NULL);
563 _elm_unneed_ethumb(void)
566 if (--_elm_need_ethumb) return;
568 ethumb_client_disconnect(_elm_ethumb_client);
569 _elm_ethumb_client = NULL;
570 ethumb_client_shutdown();
571 ELM_ECORE_EVENT_ETHUMB_CONNECT = 0;
576 _elm_thumb_dropcb(void *data __UNUSED__, Evas_Object *o, Elm_Selection_Data *drop)
578 if ((!o) || (!drop) || (!drop->data)) return EINA_FALSE;
579 elm_thumb_file_set(o, drop->data, NULL);
584 * This must be called before any other function that handle with
585 * elm_thumb objects or ethumb_client instances.
590 elm_need_ethumb(void)
593 if (_elm_need_ethumb++) return EINA_TRUE;
594 ELM_ECORE_EVENT_ETHUMB_CONNECT = ecore_event_type_new();
595 ethumb_client_init();
596 _elm_ethumb_client = ethumb_client_connect(_connect_cb, NULL, NULL);
604 * Add a new thumb object to the parent.
606 * @param parent The parent object.
607 * @return The new object or NULL if it cannot be created.
609 * @see elm_thumb_file_set()
610 * @see elm_thumb_ethumb_client_get()
615 elm_thumb_add(Evas_Object *parent)
620 Evas_Coord minw, minh;
622 ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
624 ELM_SET_WIDTYPE(widtype, "thumb");
625 elm_widget_type_set(obj, "thumb");
626 elm_widget_sub_object_add(parent, obj);
627 elm_widget_data_set(obj, wd);
628 elm_widget_del_hook_set(obj, _del_hook);
629 elm_widget_theme_hook_set(obj, _theme_hook);
630 elm_widget_can_focus_set(obj, EINA_FALSE);
632 wd->frame = edje_object_add(e);
633 _elm_theme_object_set(obj, wd->frame, "thumb", "base", "default");
634 elm_widget_resize_object_set(obj, wd->frame);
636 edje_object_size_min_calc(obj, &minw, &minh);
637 evas_object_size_hint_min_set(obj, minw, minh);
645 wd->on_hold = EINA_FALSE;
646 wd->is_video = EINA_FALSE;
647 wd->was_video = EINA_FALSE;
649 #ifdef HAVE_ELEMENTARY_ETHUMB
650 wd->thumb.thumb_path = NULL;
651 wd->thumb.thumb_key = NULL;
652 wd->thumb.exists = NULL;
653 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_DOWN,
655 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_UP,
657 evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW,
659 evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE,
663 // TODO: convert Elementary to subclassing of Evas_Smart_Class
664 // TODO: and save some bytes, making descriptions per-class and not instance!
665 evas_object_smart_callbacks_descriptions_set(obj, _signals);
670 * Reload thumbnail if it was generated before.
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().
676 * @param obj The thumb object to reload
678 * @see elm_thumb_file_set()
683 elm_thumb_reload(Evas_Object *obj)
685 ELM_CHECK_WIDTYPE(obj, widtype);
686 Widget_Data *wd = elm_widget_data_get(obj);
688 eina_stringshare_replace(&(wd->thumb.file), NULL);
689 eina_stringshare_replace(&(wd->thumb.key), NULL);
691 #ifdef HAVE_ELEMENTARY_ETHUMB
692 if (evas_object_visible_get(obj))
698 * Set the file that will be used as thumbnail.
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().
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.
708 * @see elm_thumb_file_get()
709 * @see elm_thumb_reload()
710 * @see elm_thumb_animate()
715 elm_thumb_file_set(Evas_Object *obj, const char *file, const char *key)
717 ELM_CHECK_WIDTYPE(obj, widtype);
718 Eina_Bool file_replaced, key_replaced;
719 Widget_Data *wd = elm_widget_data_get(obj);
721 file_replaced = eina_stringshare_replace(&(wd->file), file);
722 key_replaced = eina_stringshare_replace(&(wd->key), key);
727 const char **ext, *ptr;
728 static const char *extensions[] =
730 ".avi", ".mp4", ".ogv", ".mov", ".mpg", ".wmv", NULL
733 prefix_size = eina_stringshare_strlen(wd->file) - 4;
734 if (prefix_size >= 0)
736 ptr = wd->file + prefix_size;
737 wd->is_video = EINA_FALSE;
738 for (ext = extensions; *ext; ext++)
739 if (!strcasecmp(ptr, *ext))
741 wd->is_video = EINA_TRUE;
747 eina_stringshare_replace(&(wd->thumb.file), NULL);
748 eina_stringshare_replace(&(wd->thumb.key), NULL);
750 #ifdef HAVE_ELEMENTARY_ETHUMB
751 if (((file_replaced) || (key_replaced)) && (evas_object_visible_get(obj)))
757 * Get the image or video path and key used to generate the thumbnail.
759 * @param obj The thumb object.
760 * @param file Pointer to filename.
761 * @param key Pointer to key.
763 * @see elm_thumb_file_set()
764 * @see elm_thumb_path_get()
765 * @see elm_thumb_animate()
770 elm_thumb_file_get(const Evas_Object *obj, const char **file, const char **key)
772 ELM_CHECK_WIDTYPE(obj, widtype);
773 Widget_Data *wd = elm_widget_data_get(obj);
782 * Get the path and key to the image or video generated by ethumb.
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.
788 * @param obj The thumb object.
789 * @param file Pointer to thumb path.
790 * @param key Pointer to thumb key.
792 * @see elm_thumb_file_get()
797 elm_thumb_path_get(const Evas_Object *obj, const char **file, const char **key)
799 ELM_CHECK_WIDTYPE(obj, widtype);
800 Widget_Data *wd = elm_widget_data_get(obj);
803 *file = wd->thumb.file;
805 *key = wd->thumb.key;
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
813 * @param obj The thumb object.
814 * @param setting The animation setting.
816 * @see elm_thumb_file_set()
821 elm_thumb_animate_set(Evas_Object *obj, Elm_Thumb_Animation_Setting setting)
823 ELM_CHECK_WIDTYPE(obj, widtype);
824 Widget_Data *wd = elm_widget_data_get(obj);
826 EINA_SAFETY_ON_TRUE_RETURN(setting >= ELM_THUMB_ANIMATION_LAST);
828 wd->anim_setting = setting;
829 if (setting == ELM_THUMB_ANIMATION_LOOP)
830 edje_object_signal_emit(wd->view, "animate_loop", "");
831 else if (setting == ELM_THUMB_ANIMATION_START)
832 edje_object_signal_emit(wd->view, "animate", "");
833 else if (setting == ELM_THUMB_ANIMATION_STOP)
834 edje_object_signal_emit(wd->view, "animate_stop", "");
838 * Get the animation state for the thumb object.
840 * @param obj The thumb object.
841 * @return getting The animation setting or @c ELM_THUMB_ANIMATION_LAST,
844 * @see elm_thumb_file_get()
848 EAPI Elm_Thumb_Animation_Setting
849 elm_thumb_animate_get(const Evas_Object *obj)
851 ELM_CHECK_WIDTYPE(obj, widtype) ELM_THUMB_ANIMATION_LAST;
852 Widget_Data *wd = elm_widget_data_get(obj);
854 return wd->anim_setting;
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.
862 * @return Ethumb_Client instance or NULL.
867 * #include <Elementary.h>
868 * #ifndef ELM_LIB_QUICKLAUNCH
870 * elm_main(int argc, char **argv)
872 * Ethumb_Client *client;
878 * client = elm_thumb_ethumb_client_get();
881 * ERR("could not get ethumb_client");
884 * ethumb_client_size_set(client, 100, 100);
885 * ethumb_client_crop_align_set(client, 0.5, 0.5);
888 * // Create elm_thumb objects here
901 elm_thumb_ethumb_client_get(void)
903 return _elm_ethumb_client;
907 * Get the ethumb_client connection state.
909 * @return EINA_TRUE if the client is connected to the server or
910 * EINA_FALSE otherwise.
913 elm_thumb_ethumb_client_connected(void)
915 return _elm_ethumb_connected;
919 elm_thumb_editable_set(Evas_Object *obj, Eina_Bool edit)
921 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
922 Widget_Data *wd = elm_widget_data_get(obj);
924 if (!wd) return EINA_FALSE;
926 if (wd->edit == edit) return EINA_TRUE;
930 elm_drop_target_add(obj, ELM_SEL_FORMAT_IMAGE,
931 _elm_thumb_dropcb, obj);
933 elm_drop_target_del(obj);
939 elm_thumb_editable_get(const Evas_Object *obj)
941 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
942 Widget_Data *wd = elm_widget_data_get(obj);
944 if (!wd) return EINA_FALSE;
948 /* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-3f0^-2{2(0W1st0 :*/