summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2016-04-12 14:08:35 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-04-20 10:47:40 +0900
commit57e64ee65b6ae35107f40ca155e2fb318a0082f6 (patch)
tree6cfed294e278f7cc587484e9491d321a87f31024
parentbb036dbcebd032ff312d7ceb40c8a864fa063dd4 (diff)
downloadefl-57e64ee65b6ae35107f40ca155e2fb318a0082f6.tar.gz
Efl: Add skeletton for new containers "Pack" API
I chose the name "pack" instead of containers because it is shorter, and allows out-of-the-box short C names like efl_pack_end() instead of efl_container_pack_end(). All Pack interfaces will use the same efl_pack eo prefix. This is still work in progress. @feature
-rw-r--r--src/Makefile_Efl.am5
-rw-r--r--src/lib/efl/Efl.h12
-rw-r--r--src/lib/efl/interfaces/efl_interfaces_main.c6
-rw-r--r--src/lib/efl/interfaces/efl_pack.eo78
-rw-r--r--src/lib/efl/interfaces/efl_pack_grid.eo88
-rw-r--r--src/lib/efl/interfaces/efl_pack_item.eo14
-rw-r--r--src/lib/efl/interfaces/efl_pack_linear.eo68
-rw-r--r--src/lib/efl/interfaces/efl_pack_named.eo16
8 files changed, 287 insertions, 0 deletions
diff --git a/src/Makefile_Efl.am b/src/Makefile_Efl.am
index 8b5bcf9dd1..d0ef34bb15 100644
--- a/src/Makefile_Efl.am
+++ b/src/Makefile_Efl.am
@@ -25,6 +25,11 @@ efl_eolian_files = \
lib/efl/interfaces/efl_animator.eo \
lib/efl/interfaces/efl_orientation.eo \
lib/efl/interfaces/efl_flipable.eo \
+ lib/efl/interfaces/efl_pack.eo \
+ lib/efl/interfaces/efl_pack_linear.eo \
+ lib/efl/interfaces/efl_pack_grid.eo \
+ lib/efl/interfaces/efl_pack_named.eo \
+ lib/efl/interfaces/efl_pack_item.eo \
lib/efl/interfaces/efl_vpath.eo \
lib/efl/interfaces/efl_vpath_manager.eo \
lib/efl/interfaces/efl_vpath_file.eo \
diff --git a/src/lib/efl/Efl.h b/src/lib/efl/Efl.h
index 1229c9ea39..dc9b094232 100644
--- a/src/lib/efl/Efl.h
+++ b/src/lib/efl/Efl.h
@@ -35,6 +35,11 @@ extern "C" {
#define EFL_VERSION_1_18 1
+/* Add here all the required ifdef for any @protected method */
+#ifdef EFL_EFL_BUILD
+# define EFL_PACK_PROTECTED
+#endif
+
/**
* @ingroup Efl
* @since 1.18
@@ -111,6 +116,13 @@ static inline void efl_gfx_color16_type_set(Efl_Gfx_Color *color,
#include "interfaces/efl_gfx.x"
+/* Packing & containers */
+#include "interfaces/efl_pack_item.eo.h"
+#include "interfaces/efl_pack.eo.h"
+#include "interfaces/efl_pack_linear.eo.h"
+#include "interfaces/efl_pack_grid.eo.h"
+#include "interfaces/efl_pack_named.eo.h"
+
#else
#ifndef EFL_NOLEGACY_API_SUPPORT
diff --git a/src/lib/efl/interfaces/efl_interfaces_main.c b/src/lib/efl/interfaces/efl_interfaces_main.c
index 987e9709d1..5f424f97d0 100644
--- a/src/lib/efl/interfaces/efl_interfaces_main.c
+++ b/src/lib/efl/interfaces/efl_interfaces_main.c
@@ -33,6 +33,12 @@ EAPI const Eo_Event_Description _EFL_GFX_CHANGED =
EAPI const Eo_Event_Description _EFL_GFX_PATH_CHANGED =
EO_EVENT_DESCRIPTION("Graphics path changed");
+#include "interfaces/efl_pack.eo.c"
+#include "interfaces/efl_pack_linear.eo.c"
+#include "interfaces/efl_pack_grid.eo.c"
+#include "interfaces/efl_pack_named.eo.c"
+#include "interfaces/efl_pack_item.eo.c"
+
#include "interfaces/efl_model_base.eo.c"
#include "interfaces/efl_animator.eo.c"
#include "interfaces/efl_orientation.eo.c"
diff --git a/src/lib/efl/interfaces/efl_pack.eo b/src/lib/efl/interfaces/efl_pack.eo
new file mode 100644
index 0000000000..7e9661b914
--- /dev/null
+++ b/src/lib/efl/interfaces/efl_pack.eo
@@ -0,0 +1,78 @@
+import eina_types;
+
+interface Efl.Pack (Efl.Pack_Item)
+{
+ [[API common to all UI container objects.]]
+ legacy_prefix: null;
+ methods
+ {
+ /* should this actually just be the eo children list? */
+ contents_iterate {
+ [[Begin iterating over this object's children.]]
+ return: free(own(iterator<Efl.Pack_Item *> *), eina_iterator_free) @warn_unused;
+ }
+ contents_count {
+ [[returns the number of UI elements packed in this container.]]
+ return: int;
+ }
+ clear {
+ [[removes all packed children, and unrefs them]]
+ }
+ unpack_all {
+ [[removes all packed children, without changing their refcount]]
+ }
+ unpack {
+ [[removes an existing item from the container, without unref.
+
+ delete the item directly if you actually wanted to pop and unref
+ ]]
+ return: bool; [[$false if $subobj wasn't a child or can't be removed]]
+ params {
+ subobj: Efl.Pack_Item*;
+ }
+ }
+ /* FIXME: confusing? two meanings: named slot vs. append */
+ pack {
+ [[Adds an item to this container.
+
+ Depending on the container this will either fill in the default
+ spot, replacing any already existing element or append to the end
+ of the container if there is no default part.
+
+ The container takes ownership of this object. This means if packing
+ failed, the object will be unrefed.
+ ]]
+ params {
+ subobj: Efl.Pack_Item*;
+ }
+ }
+ @property padding {
+ [[Padding between items contained in this object.]]
+ set {}
+ get {}
+ values {
+ pad_horiz: double;
+ pad_vert: double;
+ scalable: bool;
+ }
+ }
+ layout_update @protected {
+ [[Implementation of this container's layout algorithm.
+
+ EFL will call this function whenever the contents of this
+ container need to be re-layed out on the canvas.
+
+ This can be overriden to implement highly specific layout
+ behaviours.
+ ]]
+ }
+ layout_request {
+ [[Requests EFL to call the @.layout_update method on this object.]]
+ }
+ }
+ events {
+ child,added;
+ child,removed;
+ layout,updated;
+ }
+}
diff --git a/src/lib/efl/interfaces/efl_pack_grid.eo b/src/lib/efl/interfaces/efl_pack_grid.eo
new file mode 100644
index 0000000000..eda8ebb320
--- /dev/null
+++ b/src/lib/efl/interfaces/efl_pack_grid.eo
@@ -0,0 +1,88 @@
+import efl_gfx_types;
+
+interface Efl.Pack_Grid (Efl.Pack_Linear)
+{
+ [[2D containers aligned on a grid with rows and columns]]
+ legacy_prefix: null;
+ eo_prefix: efl_pack;
+ methods {
+ pack_grid {
+ params {
+ subobj: Efl.Pack_Item *;
+ col: int;
+ row: int;
+ colspan: int @optional; [[0 means 1, -1 means @.max_span]]
+ rowspan: int @optional; [[0 means 1, -1 means @.max_span]]
+ }
+ }
+ grid_children_at {
+ [[grids can have overlapping children - returns a list because
+ we expect only few items per cell
+ ]]
+ return: free(own(list<Efl.Pack_Item *> *), eina_list_free);
+ params {
+ @in col: int;
+ @in row: int;
+ }
+ }
+ @property grid_child_position {
+ [[position and span of the $subobj in this container, may be modified to move the $subobj]]
+ set { [[same as grid_pack]] }
+ get {}
+ keys {
+ subobj: Efl.Pack_Item*;
+ }
+ values {
+ col: int;
+ row: int;
+ colspan: int;
+ rowspan: int;
+ }
+ }
+ /* FIXME: the below SET apis need to be well defined. they are not. yet */
+ @property grid_size {
+ [[combines @.columns and @.rows]]
+ set {}
+ get {}
+ values {
+ cols: int;
+ rows: int;
+ }
+ }
+ @property columns {
+ set {}
+ get {}
+ values {
+ cols: int;
+ }
+ }
+ @property rows {
+ set {}
+ get {}
+ values {
+ rows: int;
+ }
+ }
+ @property max_span {
+ [[Max column or row when used with linear apis. Default is 0 (no limit)
+ only valid if direction is horizontal
+ ]]
+ set {}
+ get {}
+ values {
+ maxx: int;
+ }
+ }
+ @property directions {
+ [[primary and secondary up/left/right/down orientation for linear apis. default is right and down
+ overrides @Efl.Pack_Linear.direction
+ ]]
+ set {}
+ get {}
+ values {
+ primary: Efl.Orient;
+ secondary: Efl.Orient;
+ }
+ }
+ }
+}
diff --git a/src/lib/efl/interfaces/efl_pack_item.eo b/src/lib/efl/interfaces/efl_pack_item.eo
new file mode 100644
index 0000000000..a7969ef6c7
--- /dev/null
+++ b/src/lib/efl/interfaces/efl_pack_item.eo
@@ -0,0 +1,14 @@
+interface Efl.Pack_Item
+{
+ [[Describes an item that can be packed in a container.]]
+ legacy_prefix: null;
+ methods {
+ /* FIXME: is this same as eo_parent? shouldn't it be? */
+ @property container {
+ get {}
+ values {
+ obj: const(Eo.Base)*; /* FIXME: this is an Efl.Pack* */
+ }
+ }
+ }
+}
diff --git a/src/lib/efl/interfaces/efl_pack_linear.eo b/src/lib/efl/interfaces/efl_pack_linear.eo
new file mode 100644
index 0000000000..301fa3121b
--- /dev/null
+++ b/src/lib/efl/interfaces/efl_pack_linear.eo
@@ -0,0 +1,68 @@
+/* FIXME: Efl.Pack.Linear */
+interface Efl.Pack_Linear (Efl.Pack)
+{
+ [[API for containers ]]
+ legacy_prefix: null;
+ eo_prefix: efl_pack;
+ methods {
+ pack_begin {
+ [[prepend, same as $pack_at($subobj, 0)]]
+ params {
+ @in subobj: Efl.Pack_Item*;
+ }
+ }
+ pack_end {
+ [[prepend, same as $pack_at($subobj, -1)]]
+ params {
+ @in subobj: Efl.Pack_Item*;
+ }
+ }
+ pack_before {
+ [[prepend before other subobj]]
+ return: bool @warn_unused; [[returns $false if $existing could not be found]]
+ params {
+ @in subobj: Efl.Pack_Item*;
+ @in existing: const(Efl.Pack_Item)*;
+ }
+ }
+ pack_after {
+ [[append after other subobj]]
+ return: bool @warn_unused; [[returns $false if $existing could not be found]]
+ params {
+ @in subobj: Efl.Pack_Item*;
+ @in existing: const(Efl.Pack_Item)*;
+ }
+ }
+ @property child_at {
+ set { [[Insert child at a specified index.]] }
+ get {}
+ keys {
+ index: int;
+ }
+ values {
+ subobj: Efl.Pack_Item *;
+ }
+ }
+ @property child_index {
+ [[index of the $subobj in this container, may be modified to move the $subobj]]
+ set {
+ return: bool; [[returns $false if $subobj is not a child]]
+ }
+ get {}
+ keys {
+ subobj: const(Efl.Pack_Item *);
+ }
+ values {
+ index: int;
+ }
+ }
+ @property direction {
+ [[primary up/left/right/down orientation for linear apis. default is right]]
+ set {}
+ get {}
+ values {
+ orient: Efl.Orient;
+ }
+ }
+ }
+}
diff --git a/src/lib/efl/interfaces/efl_pack_named.eo b/src/lib/efl/interfaces/efl_pack_named.eo
new file mode 100644
index 0000000000..eadb503cb6
--- /dev/null
+++ b/src/lib/efl/interfaces/efl_pack_named.eo
@@ -0,0 +1,16 @@
+interface Efl.Pack_Named (Efl.Pack)
+{
+ [[Common API for containers of named parts.]]
+ legacy_prefix: null;
+ eo_prefix: efl_pack;
+ methods {
+ pack_as /* @part */ {
+ [[Insert element in a named spot (swallow, part).]]
+ params {
+ part: const(char) *;
+ subobj: Efl.Pack_Item *;
+ }
+ }
+
+ }
+}