summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJi-Youn Park <jy0703.park@samsung.com>2016-04-11 13:21:05 +0830
committerJi-Youn Park <jy0703.park@samsung.com>2016-04-11 13:21:05 +0830
commit7b4c23489d134b18a937ed90eac0d964f77e98fd (patch)
tree060f68662b6115afe1cee794e12e165b67df7ec7
parent62841aee3ce838321149b329008a54185341f9f8 (diff)
Elm_photo: move api from eo to legacy.
elm_photo will be deprecated in the future. so move all api from eo to legacy.
-rw-r--r--src/lib/elementary/elm_photo.c110
-rw-r--r--src/lib/elementary/elm_photo.eo56
-rw-r--r--src/lib/elementary/elm_photo_legacy.h72
3 files changed, 130 insertions, 108 deletions
diff --git a/src/lib/elementary/elm_photo.c b/src/lib/elementary/elm_photo.c
index c8ffc74a93..803e07cdd6 100644
--- a/src/lib/elementary/elm_photo.c
+++ b/src/lib/elementary/elm_photo.c
@@ -328,93 +328,99 @@ _elm_photo_efl_file_file_set(Eo *obj, Elm_Photo_Data *sd, const char *file, cons
328 return EINA_TRUE; 328 return EINA_TRUE;
329} 329}
330 330
331EOLIAN static void 331static void
332_elm_photo_size_set(Eo *obj, Elm_Photo_Data *sd, int size) 332_elm_photo_class_constructor(Eo_Class *klass)
333{ 333{
334 sd->size = (size > 0) ? size : 0; 334 evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
335
336 elm_image_prescale_set(sd->icon, sd->size);
337
338 _sizing_eval(obj);
339} 335}
340 336
341EOLIAN static int 337EAPI Eina_Bool
342_elm_photo_size_get(Eo *obj EINA_UNUSED, Elm_Photo_Data *sd) 338elm_photo_file_set(Eo *obj, const char *file)
343{ 339{
344 return sd->size; 340 return efl_file_set((Eo *) obj, file, NULL);
345} 341}
346 342
347EOLIAN static void 343/* Legacy deprecated functions */
348_elm_photo_fill_inside_set(Eo *obj, Elm_Photo_Data *sd, Eina_Bool fill) 344EAPI void
345elm_photo_editable_set(Evas_Object *obj, Eina_Bool edit)
349{ 346{
350 elm_image_fill_outside_set(sd->icon, !fill); 347 ELM_PHOTO_CHECK(obj);
351 sd->fill_inside = !!fill; 348 ELM_PHOTO_DATA_GET(obj, sd);
352 349 elm_image_editable_set(sd->icon, edit);
353 _sizing_eval(obj);
354} 350}
355 351
356EOLIAN static Eina_Bool 352EAPI Eina_Bool
357_elm_photo_fill_inside_get(Eo *obj EINA_UNUSED, Elm_Photo_Data *sd) 353elm_photo_editable_get(const Evas_Object *obj)
358{ 354{
359 return sd->fill_inside; 355 ELM_PHOTO_CHECK(obj) EINA_FALSE;
356 ELM_PHOTO_DATA_GET(obj, sd);
357 return elm_image_editable_get(sd->icon);
360} 358}
361 359
362EOLIAN static void 360EAPI void
363_elm_photo_evas_draggable_interface_drag_target_set(Eo *obj EINA_UNUSED, Elm_Photo_Data *sd, Eina_Bool set) 361elm_photo_size_set(Evas_Object *obj, int size)
364{ 362{
365 elm_image_editable_set(sd->icon, set); 363 ELM_PHOTO_CHECK(obj);
366} 364 ELM_PHOTO_DATA_GET(obj, sd);
365 sd->size = (size > 0) ? size : 0;
367 366
368EOLIAN static Eina_Bool 367 elm_image_prescale_set(sd->icon, sd->size);
369_elm_photo_evas_draggable_interface_drag_target_get(Eo *obj EINA_UNUSED, Elm_Photo_Data *sd) 368
370{ 369 _sizing_eval(obj);
371 return elm_image_editable_get(sd->icon);
372} 370}
373 371
374EOLIAN static void 372EAPI int
375_elm_photo_thumb_set(const Eo *obj EINA_UNUSED, Elm_Photo_Data *sd, const char *file, const char *group) 373elm_photo_size_get(const Evas_Object *obj)
376{ 374{
377 eina_stringshare_replace(&sd->thumb.file.path, file); 375 ELM_PHOTO_CHECK(obj) 0;
378 eina_stringshare_replace(&sd->thumb.file.key, group); 376 ELM_PHOTO_DATA_GET(obj, sd);
379 377 return sd->size;
380 elm_icon_thumb_set(sd->icon, file, group);
381} 378}
382 379
383EOLIAN static void 380EAPI void
384_elm_photo_aspect_fixed_set(Eo *obj EINA_UNUSED, Elm_Photo_Data *sd, Eina_Bool fixed) 381elm_photo_fill_inside_set(Evas_Object *obj, Eina_Bool fill)
385{ 382{
386 elm_image_aspect_fixed_set(sd->icon, fixed); 383 ELM_PHOTO_CHECK(obj);
384 ELM_PHOTO_DATA_GET(obj, sd);
385 elm_image_fill_outside_set(sd->icon, !fill);
386 sd->fill_inside = !!fill;
387
388 _sizing_eval(obj);
387} 389}
388 390
389EOLIAN static Eina_Bool 391EAPI Eina_Bool
390_elm_photo_aspect_fixed_get(Eo *obj EINA_UNUSED, Elm_Photo_Data *sd) 392elm_photo_fill_inside_get(const Evas_Object *obj)
391{ 393{
392 return elm_image_aspect_fixed_get(sd->icon); 394 ELM_PHOTO_CHECK(obj) EINA_FALSE;
395 ELM_PHOTO_DATA_GET(obj, sd);
396 return sd->fill_inside;
393} 397}
394 398
395static void 399EAPI void
396_elm_photo_class_constructor(Eo_Class *klass) 400elm_photo_aspect_fixed_set(Evas_Object *obj, Eina_Bool fixed)
397{ 401{
398 evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass); 402 ELM_PHOTO_CHECK(obj);
403 ELM_PHOTO_DATA_GET(obj, sd);
404 elm_image_aspect_fixed_set(sd->icon, fixed);
399} 405}
400 406
401EAPI Eina_Bool 407EAPI Eina_Bool
402elm_photo_file_set(Eo *obj, const char *file) 408elm_photo_aspect_fixed_get(const Evas_Object *obj)
403{ 409{
404 return efl_file_set((Eo *) obj, file, NULL); 410 ELM_PHOTO_CHECK(obj) EINA_FALSE;
411 ELM_PHOTO_DATA_GET(obj, sd);
412 return elm_image_aspect_fixed_get(sd->icon);
405} 413}
406 414
407/* Legacy deprecated functions */
408EAPI void 415EAPI void
409elm_photo_editable_set(Evas_Object *obj, Eina_Bool edit) 416elm_photo_thumb_set(Evas_Object *obj, const char *file, const char *group)
410{ 417{
411 evas_draggable_interface_drag_target_set(obj, edit); 418 ELM_PHOTO_CHECK(obj);
412} 419 ELM_PHOTO_DATA_GET(obj, sd);
420 eina_stringshare_replace(&sd->thumb.file.path, file);
421 eina_stringshare_replace(&sd->thumb.file.key, group);
413 422
414EAPI Eina_Bool 423 elm_icon_thumb_set(sd->icon, file, group);
415elm_photo_editable_get(const Evas_Object *obj)
416{
417 return evas_draggable_interface_drag_target_get(obj);
418} 424}
419 425
420#include "elm_photo.eo.c" 426#include "elm_photo.eo.c"
diff --git a/src/lib/elementary/elm_photo.eo b/src/lib/elementary/elm_photo.eo
index 68c1faeeac..f08e8e807d 100644
--- a/src/lib/elementary/elm_photo.eo
+++ b/src/lib/elementary/elm_photo.eo
@@ -1,68 +1,12 @@
1class Elm.Photo (Elm.Widget, Efl.File, Evas.Clickable_Interface, Evas.Draggable_Interface) 1class Elm.Photo (Elm.Widget, Efl.File, Evas.Clickable_Interface, Evas.Draggable_Interface)
2{ 2{
3 eo_prefix: elm_obj_photo; 3 eo_prefix: elm_obj_photo;
4 methods {
5 @property fill_inside {
6 set {
7 [[Set if the photo should be completely visible or not.]]
8 }
9 get {
10 [[Get if the photo should be completely visible or not.]]
11 }
12 values {
13 fill: bool; [[Photo visibility.]]
14 }
15 }
16 @property aspect_fixed {
17 set {
18 [[Set whether the original aspect ratio of the photo should be kept
19 on resize.
20
21 The original aspect ratio (width / height) of the photo is
22 usually distorted to match the object's size. Enabling this
23 option will fix this original aspect, and the way that the
24 photo is fit into the object's area.
25
26 See also @.aspect_fixed.get.
27 ]]
28 }
29 get {
30 [[Get if the object keeps the original aspect ratio.]]
31 }
32 values {
33 fixed: bool; [[$true if the photo should fix the aspect,
34 $false otherwise.]]
35 }
36 }
37 @property size {
38 set {
39 [[Set the size that will be used on the photo]]
40 }
41 get {
42 [[Get the size that will be used on the photo]]
43 }
44 values {
45 size: int; [[The size of the photo]]
46 }
47 }
48 thumb_set @const {
49 [[Set the file that will be used as thumbnail in the photo.]]
50 params {
51 @in file: const(char)* @nullable; [[The path to file that will be
52 used as thumbnail.]]
53 @in group: const(char)* @optional; [[The key used in case of an EET
54 file.]]
55 }
56 }
57 }
58 implements { 4 implements {
59 class.constructor; 5 class.constructor;
60 Eo.Base.constructor; 6 Eo.Base.constructor;
61 Efl.File.file.set; 7 Efl.File.file.set;
62 Evas.Object_Smart.add; 8 Evas.Object_Smart.add;
63 Evas.Object_Smart.del; 9 Evas.Object_Smart.del;
64 Evas.Draggable_Interface.drag_target.set;
65 Evas.Draggable_Interface.drag_target.get;
66 Elm.Widget.theme_apply; 10 Elm.Widget.theme_apply;
67 } 11 }
68 12
diff --git a/src/lib/elementary/elm_photo_legacy.h b/src/lib/elementary/elm_photo_legacy.h
index 116c0be2d5..36005de149 100644
--- a/src/lib/elementary/elm_photo_legacy.h
+++ b/src/lib/elementary/elm_photo_legacy.h
@@ -44,4 +44,76 @@ EAPI void elm_photo_editable_set(Evas_Object *obj, Eina_Bool set);
44 * @ingroup Elm_Photo 44 * @ingroup Elm_Photo
45 */ 45 */
46EAPI Eina_Bool elm_photo_editable_get(const Evas_Object *obj); 46EAPI Eina_Bool elm_photo_editable_get(const Evas_Object *obj);
47
48/**
49 * @brief Set if the photo should be completely visible or not.
50 *
51 * @param[in] fill Photo visibility.
52 *
53 * @ingroup Elm_Photo
54 */
55EAPI void elm_photo_fill_inside_set(Evas_Object *obj, Eina_Bool fill);
56
57/**
58 * @brief Get if the photo should be completely visible or not.
59 *
60 * @return Photo visibility.
61 *
62 * @ingroup Elm_Photo
63 */
64EAPI Eina_Bool elm_photo_fill_inside_get(const Evas_Object *obj);
65
66/**
67 * @brief Set whether the original aspect ratio of the photo should be kept on
68 * resize.
69 *
70 * The original aspect ratio (width / height) of the photo is usually distorted
71 * to match the object's size. Enabling this option will fix this original
72 * aspect, and the way that the photo is fit into the object's area.
73 *
74 * See also @ref elm_photo_aspect_fixed_get.
75 *
76 * @param[in] fixed @c true if the photo should fix the aspect, @c false
77 * otherwise.
78 *
79 * @ingroup Elm_Photo
80 */
81EAPI void elm_photo_aspect_fixed_set(Evas_Object *obj, Eina_Bool fixed);
82
83/**
84 * @brief Get if the object keeps the original aspect ratio.
85 *
86 * @return @c true if the photo should fix the aspect, @c false otherwise.
87 *
88 * @ingroup Elm_Photo
89 */
90EAPI Eina_Bool elm_photo_aspect_fixed_get(const Evas_Object *obj);
91
92/**
93 * @brief Set the size that will be used on the photo
94 *
95 * @param[in] size The size of the photo
96 *
97 * @ingroup Elm_Photo
98 */
99EAPI void elm_photo_size_set(Evas_Object *obj, int size);
100
101/**
102 * @brief Get the size that will be used on the photo
103 *
104 * @return The size of the photo
105 *
106 * @ingroup Elm_Photo
107 */
108EAPI int elm_photo_size_get(const Evas_Object *obj);
109
110/**
111 * @brief Set the file that will be used as thumbnail in the photo.
112 *
113 * @param[in] group The key used in case of an EET file.
114 *
115 * @ingroup Elm_Photo
116 */
117EAPI void elm_photo_thumb_set(Evas_Object *obj, const char *file, const char *group);
118
47#include "elm_photo.eo.legacy.h" 119#include "elm_photo.eo.legacy.h"