summaryrefslogtreecommitdiff
path: root/src/bin/elementary/test_ui_box.c
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2016-07-18 18:00:26 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-07-18 18:00:26 +0900
commit03ec8204bf62e8a0f3491ac2dd8fb46f431833da (patch)
treeea865f3ef975d7bd60e9b5523d63bc55095b8233 /src/bin/elementary/test_ui_box.c
parentcae939e2085f4c4ec4961f9815e1a270ee196691 (diff)
downloadefl-03ec8204bf62e8a0f3491ac2dd8fb46f431833da.tar.gz
tests: Show use of eo_override for custom layout
This requires the previous fix in eo to actually work.
Diffstat (limited to 'src/bin/elementary/test_ui_box.c')
-rw-r--r--src/bin/elementary/test_ui_box.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/bin/elementary/test_ui_box.c b/src/bin/elementary/test_ui_box.c
index 435376fe6e..e5e1a35b05 100644
--- a/src/bin/elementary/test_ui_box.c
+++ b/src/bin/elementary/test_ui_box.c
@@ -147,8 +147,7 @@ left_check_cb(void *data, const Eo_Event *event)
}
static void
-_custom_engine_layout_do(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED,
- Efl_Pack *pack, const void *data EINA_UNUSED)
+_custom_layout_update(Eo *pack, const void *data EINA_UNUSED)
{
Eina_Iterator *it = efl_content_iterate(pack);
int count = efl_content_count(pack), i = 0;
@@ -177,21 +176,25 @@ _custom_engine_layout_do(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED,
/* Common Eo Class boilerplate. */
static const Eo_Op_Description custom_engine_op_desc[] = {
- EO_OP_CLASS_FUNC_OVERRIDE(efl_pack_layout_do, _custom_engine_layout_do),
+ EO_OP_FUNC_OVERRIDE(efl_pack_layout_update, _custom_layout_update),
};
-static const Eo_Class_Description custom_engine_class_desc = {
- EO_VERSION, "Custom Layout Engine", EO_CLASS_TYPE_INTERFACE,
- EO_CLASS_DESCRIPTION_OPS(custom_engine_op_desc), NULL, 0, NULL, NULL
-};
-
-EO_DEFINE_CLASS(_test_ui_box_custom_engine_class_get, &custom_engine_class_desc, EFL_PACK_LAYOUT_INTERFACE, NULL)
-
static void
custom_check_cb(void *data, const Eo_Event *event)
{
Eina_Bool chk = elm_check_selected_get(event->object);
- efl_pack_layout_engine_set(data, chk ? _test_ui_box_custom_engine_class_get() : NULL, NULL);
+ Eo *obj = data;
+
+ // Overriding just the one function we need
+ eo_override(obj, chk ? EO_OVERRIDE_OPS(custom_engine_op_desc)
+ : ((Eo_Ops) { NULL, 0 }));
+
+ // Layout request is required as the pack object doesn't know the layout
+ // function was just overridden.
+ efl_pack_layout_request(obj);
+
+ // See also test_ui_grid.c for another method for custom layouts (create
+ // a custom layout engine).
}
void