forked from enlightenment/efl
Added version and insert_after to box api
SVN revision: 42862
This commit is contained in:
parent
4821f141a7
commit
1d3f50027a
|
@ -1107,12 +1107,15 @@ extern "C" {
|
||||||
typedef struct _Evas_Object_Box_Option Evas_Object_Box_Option;
|
typedef struct _Evas_Object_Box_Option Evas_Object_Box_Option;
|
||||||
typedef void (*Evas_Object_Box_Layout)(Evas_Object *o, Evas_Object_Box_Data *priv, void *user_data);
|
typedef void (*Evas_Object_Box_Layout)(Evas_Object *o, Evas_Object_Box_Data *priv, void *user_data);
|
||||||
|
|
||||||
|
#define EVAS_OBJECT_BOX_API_VERSION 1
|
||||||
struct _Evas_Object_Box_Api
|
struct _Evas_Object_Box_Api
|
||||||
{
|
{
|
||||||
Evas_Smart_Class base;
|
Evas_Smart_Class base;
|
||||||
|
int version;
|
||||||
Evas_Object_Box_Option *(*append)(Evas_Object *o, Evas_Object_Box_Data *priv, Evas_Object *child);
|
Evas_Object_Box_Option *(*append)(Evas_Object *o, Evas_Object_Box_Data *priv, Evas_Object *child);
|
||||||
Evas_Object_Box_Option *(*prepend)(Evas_Object *o, Evas_Object_Box_Data *priv, Evas_Object *child);
|
Evas_Object_Box_Option *(*prepend)(Evas_Object *o, Evas_Object_Box_Data *priv, Evas_Object *child);
|
||||||
Evas_Object_Box_Option *(*insert_before)(Evas_Object *o, Evas_Object_Box_Data *priv, Evas_Object *child, const Evas_Object *reference);
|
Evas_Object_Box_Option *(*insert_before)(Evas_Object *o, Evas_Object_Box_Data *priv, Evas_Object *child, const Evas_Object *reference);
|
||||||
|
Evas_Object_Box_Option *(*insert_after)(Evas_Object *o, Evas_Object_Box_Data *priv, Evas_Object *child, const Evas_Object *reference);
|
||||||
Evas_Object_Box_Option *(*insert_at)(Evas_Object *o, Evas_Object_Box_Data *priv, Evas_Object *child, unsigned int pos);
|
Evas_Object_Box_Option *(*insert_at)(Evas_Object *o, Evas_Object_Box_Data *priv, Evas_Object *child, unsigned int pos);
|
||||||
Evas_Object *(*remove)(Evas_Object *o, Evas_Object_Box_Data *priv, Evas_Object *child);
|
Evas_Object *(*remove)(Evas_Object *o, Evas_Object_Box_Data *priv, Evas_Object *child);
|
||||||
Evas_Object *(*remove_at)(Evas_Object *o, Evas_Object_Box_Data *priv, unsigned int pos);
|
Evas_Object *(*remove_at)(Evas_Object *o, Evas_Object_Box_Data *priv, unsigned int pos);
|
||||||
|
@ -1137,7 +1140,7 @@ extern "C" {
|
||||||
* @see EVAS_OBJECT_BOX_API_INIT_VERSION
|
* @see EVAS_OBJECT_BOX_API_INIT_VERSION
|
||||||
* @see EVAS_OBJECT_BOX_API_INIT_NAME_VERSION
|
* @see EVAS_OBJECT_BOX_API_INIT_NAME_VERSION
|
||||||
*/
|
*/
|
||||||
#define EVAS_OBJECT_BOX_API_INIT(smart_class_init) {smart_class_init, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}
|
#define EVAS_OBJECT_BOX_API_INIT(smart_class_init) {smart_class_init, EVAS_OBJECT_BOX_API_VERSION, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializer to zero a whole Evas_Object_Box_Api structure.
|
* Initializer to zero a whole Evas_Object_Box_Api structure.
|
||||||
|
@ -1225,6 +1228,7 @@ extern "C" {
|
||||||
EAPI Evas_Object_Box_Option *evas_object_box_append(Evas_Object *o, Evas_Object *child) EINA_ARG_NONNULL(1, 2);
|
EAPI Evas_Object_Box_Option *evas_object_box_append(Evas_Object *o, Evas_Object *child) EINA_ARG_NONNULL(1, 2);
|
||||||
EAPI Evas_Object_Box_Option *evas_object_box_prepend(Evas_Object *o, Evas_Object *child) EINA_ARG_NONNULL(1, 2);
|
EAPI Evas_Object_Box_Option *evas_object_box_prepend(Evas_Object *o, Evas_Object *child) EINA_ARG_NONNULL(1, 2);
|
||||||
EAPI Evas_Object_Box_Option *evas_object_box_insert_before(Evas_Object *o, Evas_Object *child, const Evas_Object *reference) EINA_ARG_NONNULL(1, 2, 3);
|
EAPI Evas_Object_Box_Option *evas_object_box_insert_before(Evas_Object *o, Evas_Object *child, const Evas_Object *reference) EINA_ARG_NONNULL(1, 2, 3);
|
||||||
|
EAPI Evas_Object_Box_Option *evas_object_box_insert_after(Evas_Object *o, Evas_Object *child, const Evas_Object *referente) EINA_ARG_NONNULL(1, 2, 3);
|
||||||
EAPI Evas_Object_Box_Option *evas_object_box_insert_at(Evas_Object *o, Evas_Object *child, unsigned int pos) EINA_ARG_NONNULL(1, 2);
|
EAPI Evas_Object_Box_Option *evas_object_box_insert_at(Evas_Object *o, Evas_Object *child, unsigned int pos) EINA_ARG_NONNULL(1, 2);
|
||||||
EAPI Eina_Bool evas_object_box_remove(Evas_Object *o, Evas_Object *child) EINA_ARG_NONNULL(1, 2);
|
EAPI Eina_Bool evas_object_box_remove(Evas_Object *o, Evas_Object *child) EINA_ARG_NONNULL(1, 2);
|
||||||
EAPI Eina_Bool evas_object_box_remove_at(Evas_Object *o, unsigned int pos) EINA_ARG_NONNULL(1);
|
EAPI Eina_Bool evas_object_box_remove_at(Evas_Object *o, unsigned int pos) EINA_ARG_NONNULL(1);
|
||||||
|
|
|
@ -266,6 +266,31 @@ _evas_object_box_insert_before_default(Evas_Object *o, Evas_Object_Box_Data *pri
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Evas_Object_Box_Option *
|
||||||
|
_evas_object_box_insert_after_default(Evas_Object *o, Evas_Object_Box_Data *priv, Evas_Object *child, const Evas_Object *reference)
|
||||||
|
{
|
||||||
|
Eina_List *l;
|
||||||
|
Evas_Object_Box_Option *opt;
|
||||||
|
|
||||||
|
EINA_LIST_FOREACH(priv->children, l, opt)
|
||||||
|
{
|
||||||
|
if (opt->obj == reference)
|
||||||
|
{
|
||||||
|
Evas_Object_Box_Option *new_opt;
|
||||||
|
|
||||||
|
new_opt = _evas_object_box_option_new(o, priv, child);
|
||||||
|
if (!new_opt)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
priv->children = eina_list_append_relative
|
||||||
|
(priv->children, new_opt, opt);
|
||||||
|
return new_opt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static Evas_Object_Box_Option *
|
static Evas_Object_Box_Option *
|
||||||
_evas_object_box_insert_at_default(Evas_Object *o, Evas_Object_Box_Data *priv, Evas_Object *child, unsigned int pos)
|
_evas_object_box_insert_at_default(Evas_Object *o, Evas_Object_Box_Data *priv, Evas_Object *child, unsigned int pos)
|
||||||
{
|
{
|
||||||
|
@ -534,6 +559,7 @@ evas_object_box_smart_set(Evas_Object_Box_Api *api)
|
||||||
api->append = _evas_object_box_append_default;
|
api->append = _evas_object_box_append_default;
|
||||||
api->prepend = _evas_object_box_prepend_default;
|
api->prepend = _evas_object_box_prepend_default;
|
||||||
api->insert_before = _evas_object_box_insert_before_default;
|
api->insert_before = _evas_object_box_insert_before_default;
|
||||||
|
api->insert_after = _evas_object_box_insert_after_default;
|
||||||
api->insert_at = _evas_object_box_insert_at_default;
|
api->insert_at = _evas_object_box_insert_at_default;
|
||||||
api->remove = _evas_object_box_remove_default;
|
api->remove = _evas_object_box_remove_default;
|
||||||
api->remove_at = _evas_object_box_remove_at_default;
|
api->remove_at = _evas_object_box_remove_at_default;
|
||||||
|
@ -2022,6 +2048,37 @@ evas_object_box_insert_before(Evas_Object *o, Evas_Object *child, const Evas_Obj
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Append a new object @a child to the box @c o relative to element @a
|
||||||
|
* reference. If @a reference is not contained in the box or any other
|
||||||
|
* error occurs, @c NULL is returend.
|
||||||
|
*/
|
||||||
|
Evas_Object_Box_Option *
|
||||||
|
evas_object_box_insert_after(Evas_Object *o, Evas_Object *child, const Evas_Object *reference)
|
||||||
|
{
|
||||||
|
Evas_Object_Box_Option *opt;
|
||||||
|
const Evas_Object_Box_Api *api;
|
||||||
|
|
||||||
|
EVAS_OBJECT_BOX_DATA_GET_OR_RETURN_VAL(o, priv, NULL);
|
||||||
|
if (!child)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
api = priv->api;
|
||||||
|
if ((!api) || (!api->insert_after))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
opt = api->insert_after(o, priv, child, reference);
|
||||||
|
|
||||||
|
if (opt)
|
||||||
|
{
|
||||||
|
evas_object_smart_member_add(child, o);
|
||||||
|
evas_object_smart_changed(o);
|
||||||
|
return _evas_object_box_option_callbacks_register(o, priv, opt);
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Insert a new object @a child to the box @a o at position @a pos. On
|
* Insert a new object @a child to the box @a o at position @a pos. On
|
||||||
* error, @c NULL is returned.
|
* error, @c NULL is returned.
|
||||||
|
|
Loading…
Reference in New Issue