efl: use a @static function so that binding can pick it up.

Reviewed-by: Lauro Neto <Lauro Moura <lauromoura@expertisesolutions.com.br>>
Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D9604
This commit is contained in:
Cedric BAIL 2019-08-16 15:59:36 -07:00
parent 869d7b05f1
commit fcaec29be7
5 changed files with 27 additions and 20 deletions

View File

@ -146,6 +146,7 @@ typedef Efl_Gfx_Path_Command_Type Efl_Gfx_Path_Command;
#include "interfaces/efl_ui_view.eo.h" #include "interfaces/efl_ui_view.eo.h"
#include "interfaces/efl_ui_property_bind.eo.h" #include "interfaces/efl_ui_property_bind.eo.h"
#include "interfaces/efl_ui_factory.eo.h" #include "interfaces/efl_ui_factory.eo.h"
#include "interfaces/efl_ui_view_factory.eo.h"
#include "interfaces/efl_ui_factory_bind.eo.h" #include "interfaces/efl_ui_factory_bind.eo.h"
#include "interfaces/efl_model_provider.eo.h" #include "interfaces/efl_model_provider.eo.h"
#include "interfaces/efl_cached_item.eo.h" #include "interfaces/efl_cached_item.eo.h"
@ -203,22 +204,6 @@ EAPI void efl_observable_tuple_free(Efl_Observable_Tuple *tuple);
*/ */
EAPI Efl_Object *efl_part(const Eo *obj, const char *name); EAPI Efl_Object *efl_part(const Eo *obj, const char *name);
/**
* @brief This triggers the create method of a factory and trigger the item created event.
*
* @param[in] factory The factory that will provide the item
* @param[in] model The model to use to fetch information from
* @param[in] parent The parent of the newly created item
* @return A future that will resolve with the newly created item.
*
* @since 1.23
* @note This exists as we always want to trigger the event once all the logic
* of every factory in the chain has done what it planned to do. Basically we
* want the inverse of inheritance call like efl_super. So we do setup the future
* in this way.
*/
EAPI Eina_Future *efl_ui_view_factory_create_with_event(Efl_Ui_Factory *factory, Eina_Iterator *models, Efl_Gfx_Entity *parent);
#else #else
#ifndef EFL_NOLEGACY_API_SUPPORT #ifndef EFL_NOLEGACY_API_SUPPORT

View File

@ -67,8 +67,8 @@
#include "interfaces/efl_ui_range_interactive.eo.c" #include "interfaces/efl_ui_range_interactive.eo.c"
#include "interfaces/efl_ui_autorepeat.eo.c" #include "interfaces/efl_ui_autorepeat.eo.c"
#include "interfaces/efl_ui_view.eo.c" #include "interfaces/efl_ui_view.eo.c"
#include "interfaces/efl_ui_property_bind.eo.c"
#include "interfaces/efl_ui_factory.eo.c" #include "interfaces/efl_ui_factory.eo.c"
#include "interfaces/efl_ui_property_bind.eo.c"
#include "interfaces/efl_ui_factory_bind.eo.c" #include "interfaces/efl_ui_factory_bind.eo.c"
#include "interfaces/efl_ui_draggable.eo.c" #include "interfaces/efl_ui_draggable.eo.c"
@ -131,10 +131,12 @@ _efl_ui_view_factory_item_created(Eo *factory, void *data EINA_UNUSED, const Ein
return v; return v;
} }
EAPI Eina_Future * static Eina_Future *
efl_ui_view_factory_create_with_event(Efl_Ui_Factory *factory, Eina_Iterator *models, Efl_Gfx_Entity *parent) _efl_ui_view_factory_create_with_event(Efl_Ui_Factory *factory, Eina_Iterator *models, Efl_Gfx_Entity *parent)
{ {
return efl_future_then(factory, efl_ui_factory_create(factory, models, parent), return efl_future_then(factory, efl_ui_factory_create(factory, models, parent),
.success_type = EINA_VALUE_TYPE_ARRAY, .success_type = EINA_VALUE_TYPE_ARRAY,
.success = _efl_ui_view_factory_item_created); .success = _efl_ui_view_factory_item_created);
} }
#include "efl_ui_view_factory.eo.c"

View File

@ -9,7 +9,10 @@ interface @beta Efl.Ui.Factory extends Efl.Ui.Property_Bind, Efl.Ui.Factory_Bind
[[Efl UI factory interface]] [[Efl UI factory interface]]
methods { methods {
create { create {
[[Create a UI object from the necessary properties in the specified model.]] [[Create a UI object from the necessary properties in the specified model.
Note: This is the function you need to implement for a custom factory, but if you want to use a factory, you should rely on @Efl.Ui.View_Factory.create_with_event.]]
params { params {
models: iterator<Efl.Model>; [[Efl iterator providing the model to be associated to the new item. It should remain valid until the end of the function call.]] models: iterator<Efl.Model>; [[Efl iterator providing the model to be associated to the new item. It should remain valid until the end of the function call.]]
parent: Efl.Gfx.Entity; [[Efl canvas]] parent: Efl.Gfx.Entity; [[Efl canvas]]

View File

@ -0,0 +1,16 @@
class @beta Efl.Ui.View_Factory
{
[[This class provide a utility function that class that wish to use @Efl.Ui.Factory.create should use.]]
data: null;
methods {
create_with_event @static {
[[Create a UI object from the necessary properties in the specified model and generate the created event on the factory when the object is done building. This function must be use by all @Efl.Ui.View that need to create object. They should not use @Efl.Ui.Factory.create directly.]]
params {
factory: Efl.Ui.Factory; [[The factory to use for requesting the new object from and generating the created event onto.]]
models: iterator<Efl.Model>; [[Efl iterator providing the model to be associated to the new item. It should remain valid until the end of the function call.]]
parent: Efl.Gfx.Entity; [[Efl canvas]]
}
return: future<Efl.Gfx.Entity>; [[Created UI object]]
}
}
}

View File

@ -83,6 +83,7 @@ pub_eo_files = [
'efl_ui_view.eo', 'efl_ui_view.eo',
'efl_ui_property_bind.eo', 'efl_ui_property_bind.eo',
'efl_ui_factory.eo', 'efl_ui_factory.eo',
'efl_ui_view_factory.eo',
'efl_ui_factory_bind.eo', 'efl_ui_factory_bind.eo',
'efl_screen.eo', 'efl_screen.eo',
'efl_io_closer.eo', 'efl_io_closer.eo',