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
This commit is contained in:
Jean-Philippe Andre 2016-04-12 14:08:35 +09:00
parent bb036dbceb
commit 57e64ee65b
8 changed files with 287 additions and 0 deletions

View File

@ -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 \

View File

@ -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

View File

@ -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"

View File

@ -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;
}
}

View File

@ -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;
}
}
}
}

View File

@ -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* */
}
}
}
}

View File

@ -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;
}
}
}
}

View File

@ -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 *;
}
}
}
}