summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lib/efl/interfaces/efl_ui_factory.eo8
-rw-r--r--src/lib/elementary/efl_ui_caching_factory.c1
-rw-r--r--src/lib/elementary/efl_ui_layout_factory.c10
-rw-r--r--src/lib/elementary/efl_ui_layout_factory.eo1
-rw-r--r--src/lib/elementary/efl_ui_widget_factory.c43
-rw-r--r--src/lib/elementary/efl_ui_widget_factory.eo1
6 files changed, 51 insertions, 13 deletions
diff --git a/src/lib/efl/interfaces/efl_ui_factory.eo b/src/lib/efl/interfaces/efl_ui_factory.eo
index 38bb514..9b98ece 100644
--- a/src/lib/efl/interfaces/efl_ui_factory.eo
+++ b/src/lib/efl/interfaces/efl_ui_factory.eo
@@ -22,6 +22,14 @@ interface @beta Efl.Ui.Factory extends Efl.Ui.Property_Bind, Efl.Ui.Factory_Bind
22 ui_view: Efl.Gfx.Entity; [[Efl canvas]] 22 ui_view: Efl.Gfx.Entity; [[Efl canvas]]
23 } 23 }
24 } 24 }
25 building @const {
26 [[This function is called during the creation of an UI object between the @Efl.Object.constructor and @Efl.Object.finalize call.
27
28 Note: if the @Efl.Ui.Factory does keep a cache of object, this won't be called when object are pulled out of the cache.]]
29 params {
30 ui_view: Efl.Gfx.Entity; [[The UI object being created.]]
31 }
32 }
25 } 33 }
26 events { 34 events {
27 created: Efl.Ui.Factory_Item_Created_Event; [[Event triggered when an item has been successfully created.]] 35 created: Efl.Ui.Factory_Item_Created_Event; [[Event triggered when an item has been successfully created.]]
diff --git a/src/lib/elementary/efl_ui_caching_factory.c b/src/lib/elementary/efl_ui_caching_factory.c
index a7fb277..2d32572 100644
--- a/src/lib/elementary/efl_ui_caching_factory.c
+++ b/src/lib/elementary/efl_ui_caching_factory.c
@@ -244,6 +244,7 @@ _efl_ui_caching_factory_efl_ui_factory_create(Eo *obj,
244 EINA_ITERATOR_FOREACH(models, model) 244 EINA_ITERATOR_FOREACH(models, model)
245 { 245 {
246 w = efl_add(pd->klass, parent, 246 w = efl_add(pd->klass, parent,
247 efl_ui_factory_building(obj, efl_added),
247 efl_ui_view_model_set(efl_added, model)); 248 efl_ui_view_model_set(efl_added, model));
248 eina_value_array_append(&gr->done, w); 249 eina_value_array_append(&gr->done, w);
249 } 250 }
diff --git a/src/lib/elementary/efl_ui_layout_factory.c b/src/lib/elementary/efl_ui_layout_factory.c
index 4ab6d19..bc3a5d1 100644
--- a/src/lib/elementary/efl_ui_layout_factory.c
+++ b/src/lib/elementary/efl_ui_layout_factory.c
@@ -77,8 +77,6 @@ _efl_ui_layout_factory_bind(Eo *obj EINA_UNUSED, void *data, const Eina_Value va
77 77
78 EINA_VALUE_ARRAY_FOREACH(&value, len, i, layout) 78 EINA_VALUE_ARRAY_FOREACH(&value, len, i, layout)
79 { 79 {
80 efl_ui_layout_theme_set(layout, pd->klass, pd->group, pd->style);
81
82 eina_hash_foreach(pd->bind.properties, _property_bind, layout); 80 eina_hash_foreach(pd->bind.properties, _property_bind, layout);
83 eina_hash_foreach(pd->bind.factories, _factory_bind, layout); 81 eina_hash_foreach(pd->bind.factories, _factory_bind, layout);
84 82
@@ -89,6 +87,14 @@ _efl_ui_layout_factory_bind(Eo *obj EINA_UNUSED, void *data, const Eina_Value va
89 return value; 87 return value;
90} 88}
91 89
90static void
91_efl_ui_layout_factory_efl_ui_factory_building(const Eo *obj, Efl_Ui_Layout_Factory_Data *pd, Efl_Gfx_Entity *ui_view)
92{
93 efl_ui_layout_theme_set(ui_view, pd->klass, pd->group, pd->style);
94
95 efl_ui_factory_building(efl_super(obj, EFL_UI_LAYOUT_FACTORY_CLASS), ui_view);
96}
97
92EOLIAN static Eina_Future * 98EOLIAN static Eina_Future *
93_efl_ui_layout_factory_efl_ui_factory_create(Eo *obj, Efl_Ui_Layout_Factory_Data *pd, 99_efl_ui_layout_factory_efl_ui_factory_create(Eo *obj, Efl_Ui_Layout_Factory_Data *pd,
94 Eina_Iterator *models, Efl_Gfx_Entity *parent) 100 Eina_Iterator *models, Efl_Gfx_Entity *parent)
diff --git a/src/lib/elementary/efl_ui_layout_factory.eo b/src/lib/elementary/efl_ui_layout_factory.eo
index b31486d..d6d473e 100644
--- a/src/lib/elementary/efl_ui_layout_factory.eo
+++ b/src/lib/elementary/efl_ui_layout_factory.eo
@@ -16,6 +16,7 @@ class @beta Efl.Ui.Layout_Factory extends Efl.Ui.Caching_Factory
16 Efl.Object.constructor; 16 Efl.Object.constructor;
17 Efl.Object.destructor; 17 Efl.Object.destructor;
18 Efl.Ui.Factory.create; 18 Efl.Ui.Factory.create;
19 Efl.Ui.Factory.building;
19 Efl.Ui.Property_Bind.property_bind; 20 Efl.Ui.Property_Bind.property_bind;
20 Efl.Ui.Factory_Bind.factory_bind; 21 Efl.Ui.Factory_Bind.factory_bind;
21 } 22 }
diff --git a/src/lib/elementary/efl_ui_widget_factory.c b/src/lib/elementary/efl_ui_widget_factory.c
index 1ae33b2..3e325e1 100644
--- a/src/lib/elementary/efl_ui_widget_factory.c
+++ b/src/lib/elementary/efl_ui_widget_factory.c
@@ -39,6 +39,7 @@ struct _Efl_Ui_Widget_Factory_Data
39struct _Efl_Ui_Widget_Factory_Request 39struct _Efl_Ui_Widget_Factory_Request
40{ 40{
41 Efl_Ui_Widget_Factory_Data *pd; 41 Efl_Ui_Widget_Factory_Data *pd;
42 Efl_Ui_Factory *factory;
42 Eo *parent; 43 Eo *parent;
43}; 44};
44 45
@@ -66,9 +67,31 @@ _efl_ui_widget_factory_item_class_get(const Eo *obj EINA_UNUSED,
66 return pd->klass; 67 return pd->klass;
67} 68}
68 69
70static void
71_efl_ui_widget_factory_efl_ui_factory_building(const Eo *obj EINA_UNUSED, Efl_Ui_Widget_Factory_Data *pd EINA_UNUSED, Efl_Gfx_Entity *ui_view)
72{
73 const Efl_Model *model;
74 Eina_Value *property;
75 char *style;
76
77 if (!pd->style) return ;
78
79 model = efl_ui_view_model_get(ui_view);
80 // As we have already waited for the property to be ready, we should get the right style now
81 property = efl_model_property_get(model, pd->style);
82 if (!property) return ;
83
84 style = eina_value_to_string(property);
85 if (style) efl_ui_widget_style_set(ui_view, style);
86 free(style);
87
88 eina_value_free(property);
89}
90
69static Efl_Ui_Widget * 91static Efl_Ui_Widget *
70_efl_ui_widget_create(const Efl_Class *klass, Eo *parent, 92_efl_ui_widget_create(const Efl_Ui_Factory *factory,
71 const char *style, Efl_Model *model, 93 const Efl_Class *klass, Eo *parent,
94 Efl_Model *model,
72 const Eina_Hash *parts) 95 const Eina_Hash *parts)
73{ 96{
74 Efl_Ui_Bind_Part_Data *bpd; 97 Efl_Ui_Bind_Part_Data *bpd;
@@ -76,8 +99,8 @@ _efl_ui_widget_create(const Efl_Class *klass, Eo *parent,
76 Efl_Ui_Widget *w; 99 Efl_Ui_Widget *w;
77 100
78 w = efl_add(klass, parent, 101 w = efl_add(klass, parent,
79 style ? efl_ui_widget_style_set(efl_added, style) : (void) 0, 102 efl_ui_view_model_set(efl_added, model),
80 efl_ui_view_model_set(efl_added, model)); 103 efl_ui_factory_building(factory, efl_added));
81 if (!parts) return w; 104 if (!parts) return w;
82 105
83 it = eina_hash_iterator_data_new(parts); 106 it = eina_hash_iterator_data_new(parts);
@@ -97,16 +120,12 @@ _efl_ui_widget_create(const Efl_Class *klass, Eo *parent,
97} 120}
98 121
99static Eina_Value 122static Eina_Value
100_efl_ui_widget_factory_create_then(Eo *model, void *data, const Eina_Value v) 123_efl_ui_widget_factory_create_then(Eo *model, void *data, const Eina_Value v EINA_UNUSED)
101{ 124{
102 Efl_Ui_Widget_Factory_Request *r = data; 125 Efl_Ui_Widget_Factory_Request *r = data;
103 Efl_Ui_Widget *w; 126 Efl_Ui_Widget *w;
104 const char *string = NULL;
105
106 if (!eina_value_string_get(&v, &string))
107 return eina_value_error_init(EFL_MODEL_ERROR_NOT_SUPPORTED);
108 127
109 w = _efl_ui_widget_create(r->pd->klass, r->parent, string, model, r->pd->parts); 128 w = _efl_ui_widget_create(r->factory, r->pd->klass, r->parent, model, r->pd->parts);
110 if (!w) return eina_value_error_init(ENOMEM); 129 if (!w) return eina_value_error_init(ENOMEM);
111 return eina_value_object_init(w); 130 return eina_value_object_init(w);
112} 131}
@@ -122,6 +141,7 @@ _efl_ui_widget_factory_create_cleanup(Eo *o EINA_UNUSED, void *data, const Eina_
122{ 141{
123 Efl_Ui_Widget_Factory_Request *r = data; 142 Efl_Ui_Widget_Factory_Request *r = data;
124 143
144 efl_unref(r->factory);
125 efl_unref(r->parent); 145 efl_unref(r->parent);
126 free(r); 146 free(r);
127} 147}
@@ -147,7 +167,7 @@ _efl_ui_widget_factory_efl_ui_factory_create(Eo *obj, Efl_Ui_Widget_Factory_Data
147 167
148 EINA_ITERATOR_FOREACH(models, model) 168 EINA_ITERATOR_FOREACH(models, model)
149 { 169 {
150 w = _efl_ui_widget_create(pd->klass, parent, NULL, model, pd->parts); 170 w = _efl_ui_widget_create(obj, pd->klass, parent, model, pd->parts);
151 171
152 if (!w) return efl_loop_future_rejected(obj, ENOMEM); 172 if (!w) return efl_loop_future_rejected(obj, ENOMEM);
153 eina_value_array_append(&r, w); 173 eina_value_array_append(&r, w);
@@ -162,6 +182,7 @@ _efl_ui_widget_factory_efl_ui_factory_create(Eo *obj, Efl_Ui_Widget_Factory_Data
162 182
163 r->pd = pd; 183 r->pd = pd;
164 r->parent = efl_ref(parent); 184 r->parent = efl_ref(parent);
185 r->factory = efl_ref(obj);
165 186
166 f = calloc(count + 1, sizeof (Eina_Future *)); 187 f = calloc(count + 1, sizeof (Eina_Future *));
167 if (!f) return efl_loop_future_rejected(obj, ENOMEM); 188 if (!f) return efl_loop_future_rejected(obj, ENOMEM);
diff --git a/src/lib/elementary/efl_ui_widget_factory.eo b/src/lib/elementary/efl_ui_widget_factory.eo
index d439c5b..fdf537c 100644
--- a/src/lib/elementary/efl_ui_widget_factory.eo
+++ b/src/lib/elementary/efl_ui_widget_factory.eo
@@ -20,6 +20,7 @@ class @beta Efl.Ui.Widget_Factory extends Efl.Loop_Consumer implements Efl.Ui.Fa
20 implements { 20 implements {
21 Efl.Ui.Factory.create; 21 Efl.Ui.Factory.create;
22 Efl.Ui.Factory.release; 22 Efl.Ui.Factory.release;
23 Efl.Ui.Factory.building;
23 Efl.Ui.Property_Bind.property_bind; 24 Efl.Ui.Property_Bind.property_bind;
24 Efl.Part.part_get; 25 Efl.Part.part_get;
25 } 26 }