diff options
author | Jean-Philippe Andre <jp.andre@samsung.com> | 2016-06-16 16:05:00 +0900 |
---|---|---|
committer | Jean-Philippe Andre <jp.andre@samsung.com> | 2016-06-17 11:37:39 +0900 |
commit | d4b96d33d6d0cd0898beb429bccb35da11fc7d4a (patch) | |
tree | 9197247ea9adb8413abb4dc83c20391f7ee5f249 /src | |
parent | 76d2778177681cd170dfce4575a0e4c7c2385771 (diff) |
Evas: Mark type as legacy and protected
Only set() is allowed for EO, and it's a constructor,
protected function. Unfortunately, this means a lot
of #define EVAS_OBJECT_PROTECTED
Diffstat (limited to '')
-rw-r--r-- | src/examples/evas/evas-object-manipulation-eo.c | 6 | ||||
-rw-r--r-- | src/lib/edje/edje_private.h | 2 | ||||
-rw-r--r-- | src/lib/elementary/elementary_config.h | 2 | ||||
-rw-r--r-- | src/lib/emotion/emotion_smart.c | 2 | ||||
-rw-r--r-- | src/lib/evas/Evas_Legacy.h | 18 | ||||
-rw-r--r-- | src/lib/evas/canvas/evas_object.eo | 28 | ||||
-rw-r--r-- | src/lib/evas/canvas/evas_object_main.c | 23 | ||||
-rw-r--r-- | src/lib/evas/include/evas_common_private.h | 5 | ||||
-rw-r--r-- | src/lib/evas/include/evas_private.h | 4 |
9 files changed, 54 insertions, 36 deletions
diff --git a/src/examples/evas/evas-object-manipulation-eo.c b/src/examples/evas/evas-object-manipulation-eo.c index f32de7b815..be50221322 100644 --- a/src/examples/evas/evas-object-manipulation-eo.c +++ b/src/examples/evas/evas-object-manipulation-eo.c | |||
@@ -209,10 +209,8 @@ main(void) | |||
209 | efl_gfx_position_set(d.img, 0, 0); | 209 | efl_gfx_position_set(d.img, 0, 0); |
210 | efl_gfx_size_set(d.img, WIDTH, HEIGHT); | 210 | efl_gfx_size_set(d.img, WIDTH, HEIGHT); |
211 | efl_gfx_visible_set(d.img, EINA_TRUE); | 211 | efl_gfx_visible_set(d.img, EINA_TRUE); |
212 | 212 | fprintf(stdout, "Image object added, class name is: %s\n", | |
213 | const char *type = NULL; | 213 | eo_class_name_get(d.img)); |
214 | type = evas_obj_type_get(d.img); | ||
215 | fprintf(stdout, "Image object added, type is: %s\n", type); | ||
216 | } | 214 | } |
217 | 215 | ||
218 | /* border on the image's clipper, here just to emphasize its position */ | 216 | /* border on the image's clipper, here just to emphasize its position */ |
diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h index db75df4361..c4b16f525d 100644 --- a/src/lib/edje/edje_private.h +++ b/src/lib/edje/edje_private.h | |||
@@ -39,6 +39,8 @@ | |||
39 | # include <Evil.h> | 39 | # include <Evil.h> |
40 | #endif | 40 | #endif |
41 | 41 | ||
42 | #define EVAS_OBJECT_PROTECTED | ||
43 | |||
42 | #include <Eina.h> | 44 | #include <Eina.h> |
43 | #include <Eet.h> | 45 | #include <Eet.h> |
44 | #include <Eo.h> | 46 | #include <Eo.h> |
diff --git a/src/lib/elementary/elementary_config.h b/src/lib/elementary/elementary_config.h index ae14f49252..0e84d6ecda 100644 --- a/src/lib/elementary/elementary_config.h +++ b/src/lib/elementary/elementary_config.h | |||
@@ -8,4 +8,4 @@ | |||
8 | */ | 8 | */ |
9 | 9 | ||
10 | #define ELM_CONFIG_ICON_THEME_ELEMENTARY "_Elementary_Icon_Theme" | 10 | #define ELM_CONFIG_ICON_THEME_ELEMENTARY "_Elementary_Icon_Theme" |
11 | 11 | #define EVAS_OBJECT_PROTECTED | |
diff --git a/src/lib/emotion/emotion_smart.c b/src/lib/emotion/emotion_smart.c index 804b865307..7bfa18a94e 100644 --- a/src/lib/emotion/emotion_smart.c +++ b/src/lib/emotion/emotion_smart.c | |||
@@ -2,6 +2,8 @@ | |||
2 | # include "config.h" | 2 | # include "config.h" |
3 | #endif | 3 | #endif |
4 | 4 | ||
5 | #define EVAS_OBJECT_PROTECTED | ||
6 | |||
5 | #include <Evas.h> | 7 | #include <Evas.h> |
6 | #include <Ecore.h> | 8 | #include <Ecore.h> |
7 | 9 | ||
diff --git a/src/lib/evas/Evas_Legacy.h b/src/lib/evas/Evas_Legacy.h index 7ca908065f..b7e22bc893 100644 --- a/src/lib/evas/Evas_Legacy.h +++ b/src/lib/evas/Evas_Legacy.h | |||
@@ -673,6 +673,24 @@ EAPI int evas_object_ref_get(const Evas_Object *obj); | |||
673 | EAPI void evas_object_del(Evas_Object *obj) EINA_ARG_NONNULL(1); | 673 | EAPI void evas_object_del(Evas_Object *obj) EINA_ARG_NONNULL(1); |
674 | 674 | ||
675 | /** | 675 | /** |
676 | * @brief Retrieves the type of the given Evas object. | ||
677 | * | ||
678 | * For Evas' builtin types, the return strings will be one of "rectangle", | ||
679 | * "line", "polygon", "text", "textblock" or "image". | ||
680 | * | ||
681 | * For Evas smart objects (see @ref Evas_Smart_Group), the name of the smart | ||
682 | * class itself is returned on this call. For the built-in smart objects, these | ||
683 | * names are "EvasObjectSmartClipped" for the clipped smart object, | ||
684 | * "Evas_Object_Box" for the box object and "Evas_Object_Table for the table | ||
685 | * object. | ||
686 | * | ||
687 | * @return The type of the object. | ||
688 | * | ||
689 | * @ingroup Evas_Object | ||
690 | */ | ||
691 | EAPI const char *evas_object_type_get(const Evas_Object *obj); | ||
692 | |||
693 | /** | ||
676 | * Retrieves the position and (rectangular) size of the given Evas | 694 | * Retrieves the position and (rectangular) size of the given Evas |
677 | * object. | 695 | * object. |
678 | * | 696 | * |
diff --git a/src/lib/evas/canvas/evas_object.eo b/src/lib/evas/canvas/evas_object.eo index 587578cb64..44c98fb438 100644 --- a/src/lib/evas/canvas/evas_object.eo +++ b/src/lib/evas/canvas/evas_object.eo | |||
@@ -11,32 +11,11 @@ abstract Evas.Object (Eo.Base, Evas.Common_Interface, Efl.Gfx, Efl.Gfx.Stack, | |||
11 | legacy_ctor @protected { | 11 | legacy_ctor @protected { |
12 | [[Internal function. Do not use.]] | 12 | [[Internal function. Do not use.]] |
13 | } | 13 | } |
14 | @property type { | 14 | @property type @protected { |
15 | set { | 15 | set { |
16 | [[Sets the type of the given Evas object.]] | 16 | [[Sets the legacy type name of this Evas object.]] |
17 | legacy: null; | 17 | legacy: null; |
18 | } | 18 | } |
19 | get { | ||
20 | [[Retrieves the type of the given Evas object. | ||
21 | |||
22 | For Evas' builtin types, the return strings will be one of | ||
23 | "rectangle", "line", "polygon", "text", "textblock" or "image". | ||
24 | |||
25 | For Evas smart objects (see \@ref Evas_Smart_Group), the name | ||
26 | of the smart class itself is returned on this call. For the | ||
27 | built-in smart objects, these names are "EvasObjectSmartClipped" | ||
28 | for the clipped smart object, "Evas_Object_Box" for the box | ||
29 | object and "Evas_Object_Table for the table object. | ||
30 | ]] | ||
31 | /* FIXME-doc | ||
32 | Example: | ||
33 | @dontinclude evas-object-manipulation.c | ||
34 | @skip d.img = evas_object_image_filled_add(d.canvas); | ||
35 | @until border on the | ||
36 | |||
37 | See the full @ref Example_Evas_Object_Manipulation "example". | ||
38 | */ | ||
39 | } | ||
40 | values { | 19 | values { |
41 | type: string; [[The type of the object.]] | 20 | type: string; [[The type of the object.]] |
42 | } | 21 | } |
@@ -875,6 +854,9 @@ abstract Evas.Object (Eo.Base, Evas.Common_Interface, Efl.Gfx, Efl.Gfx.Stack, | |||
875 | } | 854 | } |
876 | } | 855 | } |
877 | } | 856 | } |
857 | constructors { | ||
858 | .type; | ||
859 | } | ||
878 | implements { | 860 | implements { |
879 | Eo.Base.constructor; | 861 | Eo.Base.constructor; |
880 | Eo.Base.destructor; | 862 | Eo.Base.destructor; |
diff --git a/src/lib/evas/canvas/evas_object_main.c b/src/lib/evas/canvas/evas_object_main.c index a79cc5250f..b9ae7da67b 100644 --- a/src/lib/evas/canvas/evas_object_main.c +++ b/src/lib/evas/canvas/evas_object_main.c | |||
@@ -2071,16 +2071,14 @@ _evas_canvas_objects_in_rectangle_get(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e, | |||
2071 | return in; | 2071 | return in; |
2072 | } | 2072 | } |
2073 | 2073 | ||
2074 | EOLIAN static const char * | ||
2075 | _evas_object_type_get(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj) | ||
2076 | { | ||
2077 | if (obj->delete_me) return ""; | ||
2078 | return obj->type; | ||
2079 | } | ||
2080 | |||
2081 | EOLIAN static void | 2074 | EOLIAN static void |
2082 | _evas_object_type_set(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj, const char *type) | 2075 | _evas_object_type_set(Eo *eo_obj, Evas_Object_Protected_Data *obj, const char *type) |
2083 | { | 2076 | { |
2077 | if (eo_finalized_get(eo_obj)) | ||
2078 | { | ||
2079 | ERR("This function is only allowed during construction."); | ||
2080 | return; | ||
2081 | } | ||
2084 | obj->type = type; // Store it as the top type of this class | 2082 | obj->type = type; // Store it as the top type of this class |
2085 | } | 2083 | } |
2086 | 2084 | ||
@@ -2189,6 +2187,15 @@ _evas_object_legacy_ctor(Eo *eo_obj, Evas_Object_Protected_Data *obj) | |||
2189 | 2187 | ||
2190 | /* legacy */ | 2188 | /* legacy */ |
2191 | 2189 | ||
2190 | EAPI const char * | ||
2191 | evas_object_type_get(const Evas_Object *eo_obj) | ||
2192 | { | ||
2193 | Evas_Object_Protected_Data *obj = eo_isa(eo_obj, EVAS_OBJECT_CLASS) ? | ||
2194 | eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS) : NULL; | ||
2195 | if (!obj || obj->delete_me) return ""; | ||
2196 | return obj->type; | ||
2197 | } | ||
2198 | |||
2192 | EAPI void | 2199 | EAPI void |
2193 | evas_object_size_hint_aspect_set(Evas_Object *obj, Evas_Aspect_Control aspect, Evas_Coord w, Evas_Coord h) | 2200 | evas_object_size_hint_aspect_set(Evas_Object *obj, Evas_Aspect_Control aspect, Evas_Coord w, Evas_Coord h) |
2194 | { | 2201 | { |
diff --git a/src/lib/evas/include/evas_common_private.h b/src/lib/evas/include/evas_common_private.h index 53abc4594f..c10962fca3 100644 --- a/src/lib/evas/include/evas_common_private.h +++ b/src/lib/evas/include/evas_common_private.h | |||
@@ -54,6 +54,11 @@ | |||
54 | #ifdef BUILD_LOADER_EET | 54 | #ifdef BUILD_LOADER_EET |
55 | # include <Eet.h> | 55 | # include <Eet.h> |
56 | #endif | 56 | #endif |
57 | |||
58 | #ifndef EVAS_OBJECT_PROTECTED | ||
59 | # define EVAS_OBJECT_PROTECTED | ||
60 | #endif | ||
61 | |||
57 | #include "Evas.h" | 62 | #include "Evas.h" |
58 | 63 | ||
59 | #ifdef EAPI | 64 | #ifdef EAPI |
diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h index dc3060db84..7c9b72699d 100644 --- a/src/lib/evas/include/evas_private.h +++ b/src/lib/evas/include/evas_private.h | |||
@@ -5,6 +5,10 @@ | |||
5 | # include <config.h> | 5 | # include <config.h> |
6 | #endif | 6 | #endif |
7 | 7 | ||
8 | #ifndef EVAS_OBJECT_PROTECTED | ||
9 | # define EVAS_OBJECT_PROTECTED | ||
10 | #endif | ||
11 | |||
8 | #include "Evas.h" | 12 | #include "Evas.h" |
9 | #include "Eet.h" | 13 | #include "Eet.h" |
10 | 14 | ||