2016-11-03 08:45:42 -07:00
|
|
|
#include "edje_private.h"
|
|
|
|
|
edje/elm: Rename _internal_ to _part_ (EO)
In Edje and Elementary, we have part objects, which are what is returned
by the interface efl_part(). Those objects can't be of an opaque type as
this doesn't work nicely with strongly typed languages such as C++ or
C#. In JS, Lua, C the types are weak and mostly runtime-based so it
doesn't matter much.
As a consequence, the documentation and the types need to look nice in
this EO API. Thus, we remove the abusive term "internal" and explicitly
call all those classes "part" something.
Eventually we want the types to be declared in the EO file so bindings
(C#, C++, ...) can generate the proper access methods, returning the
best possible types.
Note that right now a few of those part types are used in the legacy API
but don't actually need to be exposed externally.
This is kind of a mega commit that does all the renaming at once, but
it's really just a big sed operation. The power of good IDEs :)
Ref T5315
Ref T5306
2017-09-12 21:29:25 -07:00
|
|
|
typedef struct _Efl_Canvas_Layout_Part_Data Efl_Canvas_Layout_Part_Data;
|
2017-05-25 18:52:57 -07:00
|
|
|
|
edje/elm: Rename _internal_ to _part_ (EO)
In Edje and Elementary, we have part objects, which are what is returned
by the interface efl_part(). Those objects can't be of an opaque type as
this doesn't work nicely with strongly typed languages such as C++ or
C#. In JS, Lua, C the types are weak and mostly runtime-based so it
doesn't matter much.
As a consequence, the documentation and the types need to look nice in
this EO API. Thus, we remove the abusive term "internal" and explicitly
call all those classes "part" something.
Eventually we want the types to be declared in the EO file so bindings
(C#, C++, ...) can generate the proper access methods, returning the
best possible types.
Note that right now a few of those part types are used in the legacy API
but don't actually need to be exposed externally.
This is kind of a mega commit that does all the renaming at once, but
it's really just a big sed operation. The power of good IDEs :)
Ref T5315
Ref T5306
2017-09-12 21:29:25 -07:00
|
|
|
struct _Efl_Canvas_Layout_Part_Data
|
2016-11-03 08:45:42 -07:00
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
const char *part;
|
2017-06-21 17:05:41 -07:00
|
|
|
Eo *obj;
|
2016-11-03 08:45:42 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _Part_Item_Iterator
|
|
|
|
{
|
|
|
|
Eina_Iterator iterator;
|
|
|
|
Eina_List *list;
|
|
|
|
Eina_Iterator *real_iterator;
|
|
|
|
Eo *object;
|
|
|
|
};
|
|
|
|
|
edje/elm: Rename _internal_ to _part_ (EO)
In Edje and Elementary, we have part objects, which are what is returned
by the interface efl_part(). Those objects can't be of an opaque type as
this doesn't work nicely with strongly typed languages such as C++ or
C#. In JS, Lua, C the types are weak and mostly runtime-based so it
doesn't matter much.
As a consequence, the documentation and the types need to look nice in
this EO API. Thus, we remove the abusive term "internal" and explicitly
call all those classes "part" something.
Eventually we want the types to be declared in the EO file so bindings
(C#, C++, ...) can generate the proper access methods, returning the
best possible types.
Note that right now a few of those part types are used in the legacy API
but don't actually need to be exposed externally.
This is kind of a mega commit that does all the renaming at once, but
it's really just a big sed operation. The power of good IDEs :)
Ref T5315
Ref T5306
2017-09-12 21:29:25 -07:00
|
|
|
void _part_reuse_error(Efl_Canvas_Layout_Part_Data *pd);
|
2017-09-05 22:39:22 -07:00
|
|
|
const char * _part_type_to_string(unsigned char type);
|
2017-06-21 17:05:41 -07:00
|
|
|
|
|
|
|
#define PROXY_STATIC_VAR(type) _##type##_proxy
|
2016-11-03 08:45:42 -07:00
|
|
|
|
2017-05-29 06:47:55 -07:00
|
|
|
#ifndef PROXY_ADD_EXTRA_OP
|
|
|
|
# define PROXY_ADD_EXTRA_OP
|
|
|
|
#endif
|
|
|
|
|
2017-06-21 17:05:41 -07:00
|
|
|
void _edje_real_part_set(Eo *obj, Edje *ed, Edje_Real_Part *rp, const char *part);
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
_part_proxy_del_cb(Eo *proxy, Eo **static_var)
|
|
|
|
{
|
|
|
|
if (*static_var)
|
|
|
|
{
|
|
|
|
if (*static_var != proxy)
|
2018-05-14 14:54:45 -07:00
|
|
|
{
|
|
|
|
efl_del_intercept_set(*static_var, NULL);
|
|
|
|
efl_unref(*static_var);
|
|
|
|
}
|
2017-06-21 17:05:41 -07:00
|
|
|
}
|
|
|
|
efl_reuse(proxy);
|
|
|
|
*static_var = proxy;
|
|
|
|
}
|
2017-05-25 19:33:58 -07:00
|
|
|
|
2016-11-03 08:45:42 -07:00
|
|
|
/* ugly macros to avoid code duplication */
|
|
|
|
|
|
|
|
#define PROXY_RESET(type) \
|
2017-06-21 17:05:41 -07:00
|
|
|
do { if (PROXY_STATIC_VAR(type)) \
|
2016-11-03 08:45:42 -07:00
|
|
|
{ \
|
2017-06-21 17:05:41 -07:00
|
|
|
efl_del_intercept_set(PROXY_STATIC_VAR(type), NULL); \
|
2018-03-20 10:21:19 -07:00
|
|
|
efl_unref(PROXY_STATIC_VAR(type)); \
|
2017-06-21 17:05:41 -07:00
|
|
|
PROXY_STATIC_VAR(type) = NULL; \
|
2016-11-03 08:45:42 -07:00
|
|
|
} } while (0)
|
|
|
|
|
|
|
|
#define PROXY_INIT(type) \
|
|
|
|
void \
|
|
|
|
_ ## type ## _shutdown(void); \
|
|
|
|
|
2017-05-25 18:52:57 -07:00
|
|
|
#define PROXY_DATA_GET(obj, pd) \
|
2017-10-13 02:16:41 -07:00
|
|
|
Efl_Canvas_Layout_Part_Data *pd = efl_data_scope_get(obj, EFL_CANVAS_LAYOUT_PART_CLASS);
|
2017-05-25 18:52:57 -07:00
|
|
|
|
2017-06-21 17:05:41 -07:00
|
|
|
#define PROXY_IMPLEMENTATION(type, KLASS, no_del_cb, ...) \
|
|
|
|
static Eo * PROXY_STATIC_VAR(type) = NULL; \
|
2016-11-03 08:45:42 -07:00
|
|
|
\
|
|
|
|
static void \
|
2017-05-25 19:33:58 -07:00
|
|
|
_ ## type ## _del_cb(Eo *proxy) \
|
2016-11-03 08:45:42 -07:00
|
|
|
{ \
|
2017-06-21 17:05:41 -07:00
|
|
|
_part_proxy_del_cb(proxy, &(PROXY_STATIC_VAR(type))); \
|
2016-11-03 08:45:42 -07:00
|
|
|
} \
|
|
|
|
\
|
|
|
|
void \
|
|
|
|
_ ## type ## _shutdown(void) \
|
|
|
|
{ \
|
|
|
|
PROXY_RESET(type); \
|
|
|
|
} \
|
|
|
|
\
|
|
|
|
Eo * \
|
2018-01-15 23:02:33 -08:00
|
|
|
_edje_ ## type ## _internal_proxy_get(Edje_Object *obj EINA_UNUSED, Edje *ed, Edje_Real_Part *rp, const char *part) \
|
2016-11-03 08:45:42 -07:00
|
|
|
{ \
|
edje/elm: Rename _internal_ to _part_ (EO)
In Edje and Elementary, we have part objects, which are what is returned
by the interface efl_part(). Those objects can't be of an opaque type as
this doesn't work nicely with strongly typed languages such as C++ or
C#. In JS, Lua, C the types are weak and mostly runtime-based so it
doesn't matter much.
As a consequence, the documentation and the types need to look nice in
this EO API. Thus, we remove the abusive term "internal" and explicitly
call all those classes "part" something.
Eventually we want the types to be declared in the EO file so bindings
(C#, C++, ...) can generate the proper access methods, returning the
best possible types.
Note that right now a few of those part types are used in the legacy API
but don't actually need to be exposed externally.
This is kind of a mega commit that does all the renaming at once, but
it's really just a big sed operation. The power of good IDEs :)
Ref T5315
Ref T5306
2017-09-12 21:29:25 -07:00
|
|
|
Efl_Canvas_Layout_Part_Data *pd; \
|
2017-09-18 20:07:13 -07:00
|
|
|
Eo *proxy = PROXY_STATIC_VAR(type); \
|
|
|
|
pd = proxy ? efl_data_scope_get(proxy, EFL_CANVAS_LAYOUT_PART_CLASS) : NULL; \
|
2016-11-03 08:45:42 -07:00
|
|
|
if (!pd) \
|
|
|
|
{ \
|
2018-01-15 23:02:33 -08:00
|
|
|
if (EINA_UNLIKELY(proxy != NULL)) \
|
2017-06-21 17:05:41 -07:00
|
|
|
ERR("Found invalid handle for efl_part. Reset."); \
|
2018-01-15 23:02:33 -08:00
|
|
|
proxy = efl_add(KLASS, ed->obj, _edje_real_part_set(efl_added, ed, rp, part)); \
|
|
|
|
} \
|
|
|
|
else \
|
|
|
|
{ \
|
|
|
|
PROXY_STATIC_VAR(type) = NULL; \
|
|
|
|
_edje_real_part_set(proxy, ed, rp, part); \
|
2016-11-03 08:45:42 -07:00
|
|
|
} \
|
2017-05-29 06:47:55 -07:00
|
|
|
__VA_ARGS__; \
|
2017-10-13 02:16:41 -07:00
|
|
|
if (!no_del_cb) efl_del_intercept_set(proxy, _ ## type ## _del_cb); \
|
2016-11-03 08:45:42 -07:00
|
|
|
return proxy; \
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
#define PART_TABLE_GET(obj, part, ...) ({ \
|
|
|
|
Eo *__table = efl_part(obj, part); \
|
edje/elm: Rename _internal_ to _part_ (EO)
In Edje and Elementary, we have part objects, which are what is returned
by the interface efl_part(). Those objects can't be of an opaque type as
this doesn't work nicely with strongly typed languages such as C++ or
C#. In JS, Lua, C the types are weak and mostly runtime-based so it
doesn't matter much.
As a consequence, the documentation and the types need to look nice in
this EO API. Thus, we remove the abusive term "internal" and explicitly
call all those classes "part" something.
Eventually we want the types to be declared in the EO file so bindings
(C#, C++, ...) can generate the proper access methods, returning the
best possible types.
Note that right now a few of those part types are used in the legacy API
but don't actually need to be exposed externally.
This is kind of a mega commit that does all the renaming at once, but
it's really just a big sed operation. The power of good IDEs :)
Ref T5315
Ref T5306
2017-09-12 21:29:25 -07:00
|
|
|
if (!__table || !efl_isa(__table, EFL_CANVAS_LAYOUT_PART_TABLE_CLASS)) \
|
2016-11-03 08:45:42 -07:00
|
|
|
{ \
|
|
|
|
ERR("No such table part '%s' in layout %p", part, obj); \
|
|
|
|
return __VA_ARGS__; \
|
|
|
|
} \
|
|
|
|
__table; })
|
|
|
|
#else
|
|
|
|
#define PART_TABLE_GET(obj, part, ...) ({ \
|
|
|
|
Eo *__table = efl_part(obj, part); \
|
|
|
|
if (!__table) return __VA_ARGS__; \
|
|
|
|
__table; })
|
|
|
|
#endif
|