aboutsummaryrefslogtreecommitdiffstats
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
parentelementary: add model connect in efl_ui_image (diff)
downloadefl-f04ff73deac25bea7e025249214cbfc5abffd7fe.tar.gz
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 = \
lib/efl/interfaces/efl_ui_progress.eo \
lib/efl/interfaces/efl_ui_view.eo \
lib/efl/interfaces/efl_ui_model_connect.eo \
+ lib/efl/interfaces/efl_ui_factory.eo \
lib/efl/interfaces/efl_event.eo \
lib/efl/interfaces/efl_input_interface.eo \
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 = \
lib/elementary/efl_ui_text.eo \
lib/elementary/efl_ui_text_editable.eo \
lib/elementary/efl_config_global.eo \
+ lib/elementary/efl_ui_image_factory.eo \
$(NULL)
# Private classes (not exposed or shipped)
@@ -697,6 +698,7 @@ lib_elementary_libelementary_la_SOURCES = \
lib/elementary/efl_ui_grid_static.c \
lib/elementary/efl_ui_grid_private.h \
lib/elementary/efl_ui_text.c \
+ lib/elementary/efl_ui_image_factory.c \
$(NULL)
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;
#include "interfaces/efl_ui_view.eo.h"
#include "interfaces/efl_ui_model_connect.eo.h"
+#include "interfaces/efl_ui_factory.eo.h"
/* Packing & containers */
#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 =
#include "interfaces/efl_ui_progress.eo.c"
#include "interfaces/efl_ui_view.eo.c"
#include "interfaces/efl_ui_model_connect.eo.c"
+#include "interfaces/efl_ui_factory.eo.c"
#include "interfaces/efl_event.eo.c"
#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 @@
+interface Efl.Ui.Factory (Efl.Ui.Model.Connect)
+{
+ methods {
+ create {
+ [[Create a UI object from the necessary properties in the specified model.]]
+ params {
+ model: Efl.Model;
+ }
+ return: Efl.Canvas;
+ }
+ }
+}
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;
# include <efl_ui_text_interactive.eo.h>
# include <efl_ui_text.eo.h>
# include <efl_ui_text_editable.eo.h>
+# include <efl_ui_image_factory.eo.h>
#endif
/* 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 @@
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+
+#include <Elementary.h>
+#include "elm_priv.h"
+
+#define MY_CLASS EFL_UI_IMAGE_FACTORY_CLASS
+#define MY_CLASS_NAME "Efl.Ui.Image_Factory"
+
+typedef struct _Efl_Ui_Image_Factory_Data
+{
+ Eina_Stringshare *property;
+} Efl_Ui_Image_Factory_Data;
+
+static Eo *
+_efl_ui_image_factory_eo_base_constructor(Eo *obj, Efl_Ui_Image_Factory_Data *pd)
+{
+ obj = eo_constructor(eo_super(obj, MY_CLASS));
+
+ pd->property = NULL;
+
+ return obj;
+}
+
+static void
+_efl_ui_image_factory_eo_base_destructor(Eo *obj EINA_UNUSED, Efl_Ui_Image_Factory_Data *pd)
+{
+ eina_stringshare_del(pd->property);
+ pd->property = NULL;
+}
+
+static Efl_Canvas *
+_efl_ui_image_factory_efl_ui_factory_create(Eo *obj EINA_UNUSED, Efl_Ui_Image_Factory_Data *pd, Efl_Model *model)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(pd->property, NULL);
+ Efl_Canvas *ev = eo_add(EFL_UI_IMAGE_CLASS, eo_parent_get(obj));
+ efl_ui_view_model_set(ev, model);
+ efl_ui_model_connect(ev, NULL, pd->property);
+
+ return ev;
+}
+
+EOLIAN static void
+_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)
+{
+ eina_stringshare_replace(&pd->property, property);
+}
+
+#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 @@
+class Efl.Ui.Image.Factory (Eo.Base, Efl.Ui.Factory)
+{
+ implements {
+ Eo.Base.constructor;
+ Eo.Base.destructor;
+ Efl.Ui.Factory.create;
+ Efl.Ui.Model.Connect.connect;
+ }
+}