summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLarry Jr <larry.olj@gmail.com>2016-07-01 21:18:51 -0300
committerVitor Sousa <vitorsousasilva@gmail.com>2016-07-05 14:13:03 -0300
commitf04ff73deac25bea7e025249214cbfc5abffd7fe (patch)
tree08c6016ae411499c90a0f0963fe4b42c638b0588
parent7cff7432ccefe75aadf42de515460a0e28252025 (diff)
elementary: add efl_ui_image_factory
new interface efl_ui_factory used to make new widget with model contents efl_ui_model_connect(factory, "part_name", "property") new_canvas = efl_ui_factory_create(factory, model)
-rw-r--r--src/Makefile_Efl.am1
-rw-r--r--src/Makefile_Elementary.am2
-rw-r--r--src/lib/efl/Efl.h1
-rw-r--r--src/lib/efl/interfaces/efl_interfaces_main.c1
-rw-r--r--src/lib/efl/interfaces/efl_ui_factory.eo12
-rw-r--r--src/lib/elementary/Elementary.h.in1
-rw-r--r--src/lib/elementary/efl_ui_image_factory.c50
-rw-r--r--src/lib/elementary/efl_ui_image_factory.eo9
8 files changed, 77 insertions, 0 deletions
diff --git a/src/Makefile_Efl.am b/src/Makefile_Efl.am
index 375adc6af6..40909316f4 100644
--- a/src/Makefile_Efl.am
+++ b/src/Makefile_Efl.am
@@ -44,6 +44,7 @@ efl_eolian_files = \
44 lib/efl/interfaces/efl_ui_progress.eo \ 44 lib/efl/interfaces/efl_ui_progress.eo \
45 lib/efl/interfaces/efl_ui_view.eo \ 45 lib/efl/interfaces/efl_ui_view.eo \
46 lib/efl/interfaces/efl_ui_model_connect.eo \ 46 lib/efl/interfaces/efl_ui_model_connect.eo \
47 lib/efl/interfaces/efl_ui_factory.eo \
47 lib/efl/interfaces/efl_event.eo \ 48 lib/efl/interfaces/efl_event.eo \
48 lib/efl/interfaces/efl_input_interface.eo \ 49 lib/efl/interfaces/efl_input_interface.eo \
49 lib/efl/interfaces/efl_input_state.eo \ 50 lib/efl/interfaces/efl_input_state.eo \
diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am
index 9011b24e3d..973f2a0c4f 100644
--- a/src/Makefile_Elementary.am
+++ b/src/Makefile_Elementary.am
@@ -142,6 +142,7 @@ elm_public_eolian_files = \
142 lib/elementary/efl_ui_text.eo \ 142 lib/elementary/efl_ui_text.eo \
143 lib/elementary/efl_ui_text_editable.eo \ 143 lib/elementary/efl_ui_text_editable.eo \
144 lib/elementary/efl_config_global.eo \ 144 lib/elementary/efl_config_global.eo \
145 lib/elementary/efl_ui_image_factory.eo \
145 $(NULL) 146 $(NULL)
146 147
147# Private classes (not exposed or shipped) 148# Private classes (not exposed or shipped)
@@ -697,6 +698,7 @@ lib_elementary_libelementary_la_SOURCES = \
697 lib/elementary/efl_ui_grid_static.c \ 698 lib/elementary/efl_ui_grid_static.c \
698 lib/elementary/efl_ui_grid_private.h \ 699 lib/elementary/efl_ui_grid_private.h \
699 lib/elementary/efl_ui_text.c \ 700 lib/elementary/efl_ui_text.c \
701 lib/elementary/efl_ui_image_factory.c \
700 $(NULL) 702 $(NULL)
701 703
702 704
diff --git a/src/lib/efl/Efl.h b/src/lib/efl/Efl.h
index 0105cdd329..79a39f0922 100644
--- a/src/lib/efl/Efl.h
+++ b/src/lib/efl/Efl.h
@@ -116,6 +116,7 @@ EAPI extern const Eo_Event_Description _EFL_GFX_PATH_CHANGED;
116 116
117#include "interfaces/efl_ui_view.eo.h" 117#include "interfaces/efl_ui_view.eo.h"
118#include "interfaces/efl_ui_model_connect.eo.h" 118#include "interfaces/efl_ui_model_connect.eo.h"
119#include "interfaces/efl_ui_factory.eo.h"
119 120
120/* Packing & containers */ 121/* Packing & containers */
121#include "interfaces/efl_container.eo.h" 122#include "interfaces/efl_container.eo.h"
diff --git a/src/lib/efl/interfaces/efl_interfaces_main.c b/src/lib/efl/interfaces/efl_interfaces_main.c
index 52cebf33ac..25e909b371 100644
--- a/src/lib/efl/interfaces/efl_interfaces_main.c
+++ b/src/lib/efl/interfaces/efl_interfaces_main.c
@@ -55,6 +55,7 @@ EAPI const Eo_Event_Description _EFL_GFX_PATH_CHANGED =
55#include "interfaces/efl_ui_progress.eo.c" 55#include "interfaces/efl_ui_progress.eo.c"
56#include "interfaces/efl_ui_view.eo.c" 56#include "interfaces/efl_ui_view.eo.c"
57#include "interfaces/efl_ui_model_connect.eo.c" 57#include "interfaces/efl_ui_model_connect.eo.c"
58#include "interfaces/efl_ui_factory.eo.c"
58 59
59#include "interfaces/efl_event.eo.c" 60#include "interfaces/efl_event.eo.c"
60#include "interfaces/efl_input_state.eo.c" 61#include "interfaces/efl_input_state.eo.c"
diff --git a/src/lib/efl/interfaces/efl_ui_factory.eo b/src/lib/efl/interfaces/efl_ui_factory.eo
new file mode 100644
index 0000000000..1f95f05670
--- /dev/null
+++ b/src/lib/efl/interfaces/efl_ui_factory.eo
@@ -0,0 +1,12 @@
1interface Efl.Ui.Factory (Efl.Ui.Model.Connect)
2{
3 methods {
4 create {
5 [[Create a UI object from the necessary properties in the specified model.]]
6 params {
7 model: Efl.Model;
8 }
9 return: Efl.Canvas;
10 }
11 }
12}
diff --git a/src/lib/elementary/Elementary.h.in b/src/lib/elementary/Elementary.h.in
index 0257805a6c..44d2ee68e3 100644
--- a/src/lib/elementary/Elementary.h.in
+++ b/src/lib/elementary/Elementary.h.in
@@ -280,6 +280,7 @@ EAPI extern Elm_Version *elm_version;
280# include <efl_ui_text_interactive.eo.h> 280# include <efl_ui_text_interactive.eo.h>
281# include <efl_ui_text.eo.h> 281# include <efl_ui_text.eo.h>
282# include <efl_ui_text_editable.eo.h> 282# include <efl_ui_text_editable.eo.h>
283# include <efl_ui_image_factory.eo.h>
283#endif 284#endif
284 285
285/* include deprecated calls last of all */ 286/* include deprecated calls last of all */
diff --git a/src/lib/elementary/efl_ui_image_factory.c b/src/lib/elementary/efl_ui_image_factory.c
new file mode 100644
index 0000000000..d91d289ff9
--- /dev/null
+++ b/src/lib/elementary/efl_ui_image_factory.c
@@ -0,0 +1,50 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4
5#include <Elementary.h>
6#include "elm_priv.h"
7
8#define MY_CLASS EFL_UI_IMAGE_FACTORY_CLASS
9#define MY_CLASS_NAME "Efl.Ui.Image_Factory"
10
11typedef struct _Efl_Ui_Image_Factory_Data
12{
13 Eina_Stringshare *property;
14} Efl_Ui_Image_Factory_Data;
15
16static Eo *
17_efl_ui_image_factory_eo_base_constructor(Eo *obj, Efl_Ui_Image_Factory_Data *pd)
18{
19 obj = eo_constructor(eo_super(obj, MY_CLASS));
20
21 pd->property = NULL;
22
23 return obj;
24}
25
26static void
27_efl_ui_image_factory_eo_base_destructor(Eo *obj EINA_UNUSED, Efl_Ui_Image_Factory_Data *pd)
28{
29 eina_stringshare_del(pd->property);
30 pd->property = NULL;
31}
32
33static Efl_Canvas *
34_efl_ui_image_factory_efl_ui_factory_create(Eo *obj EINA_UNUSED, Efl_Ui_Image_Factory_Data *pd, Efl_Model *model)
35{
36 EINA_SAFETY_ON_NULL_RETURN_VAL(pd->property, NULL);
37 Efl_Canvas *ev = eo_add(EFL_UI_IMAGE_CLASS, eo_parent_get(obj));
38 efl_ui_view_model_set(ev, model);
39 efl_ui_model_connect(ev, NULL, pd->property);
40
41 return ev;
42}
43
44EOLIAN static void
45_efl_ui_image_factory_efl_ui_model_connect_connect(Eo *obj EINA_UNUSED, Efl_Ui_Image_Factory_Data *pd, const char *name EINA_UNUSED, const char *property)
46{
47 eina_stringshare_replace(&pd->property, property);
48}
49
50#include "efl_ui_image_factory.eo.c"
diff --git a/src/lib/elementary/efl_ui_image_factory.eo b/src/lib/elementary/efl_ui_image_factory.eo
new file mode 100644
index 0000000000..7229b0fb9b
--- /dev/null
+++ b/src/lib/elementary/efl_ui_image_factory.eo
@@ -0,0 +1,9 @@
1class Efl.Ui.Image.Factory (Eo.Base, Efl.Ui.Factory)
2{
3 implements {
4 Eo.Base.constructor;
5 Eo.Base.destructor;
6 Efl.Ui.Factory.create;
7 Efl.Ui.Model.Connect.connect;
8 }
9}