summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJee-Yong Um <jc9.um@samsung.com>2016-05-27 18:22:55 +0900
committerJee-Yong Um <jc9.um@samsung.com>2016-05-27 18:22:55 +0900
commit078c07a7d3ede67dab6e1c8f2dd847e25aea18bc (patch)
treeaad90c6e0cd6a46f590aeb54f50ae58083babbca
parentec464939d9b8e4daabb55fab07e369a7e00cc941 (diff)
downloadefl-078c07a7d3ede67dab6e1c8f2dd847e25aea18bc.tar.gz
efl_ui_grid_static: create skeleton
-rw-r--r--src/Makefile_Elementary.am3
-rw-r--r--src/lib/elementary/Elementary.h.in1
-rw-r--r--src/lib/elementary/Makefile.am3
-rw-r--r--src/lib/elementary/efl_ui_grid.c58
-rw-r--r--src/lib/elementary/efl_ui_grid_private.h62
-rw-r--r--src/lib/elementary/efl_ui_grid_static.c69
-rw-r--r--src/lib/elementary/efl_ui_grid_static.eo7
7 files changed, 146 insertions, 57 deletions
diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am
index 550a54a36a..e4b956ac16 100644
--- a/src/Makefile_Elementary.am
+++ b/src/Makefile_Elementary.am
@@ -117,6 +117,7 @@ elm_public_eolian_files = \
lib/elementary/efl_ui_box.eo \
lib/elementary/efl_ui_box_flow.eo \
lib/elementary/efl_ui_grid.eo \
+ lib/elementary/efl_ui_grid_static.eo \
lib/elementary/efl_ui_layout_internal_box.eo \
lib/elementary/efl_ui_layout_internal_table.eo \
lib/elementary/elm_button_internal_part.eo \
@@ -524,6 +525,7 @@ includesub_HEADERS = \
lib/elementary/elm_win_standard.h \
lib/elementary/elm_helper.h \
lib/elementary/efl_ui_box_private.h \
+ lib/elementary/efl_ui_grid_private.h \
lib/elementary/elm_part_helper.h \
$(NULL)
@@ -656,6 +658,7 @@ lib_elementary_libelementary_la_SOURCES = \
lib/elementary/efl_ui_box_flow.c \
lib/elementary/efl_ui_box_layout.c \
lib/elementary/efl_ui_grid.c \
+ lib/elementary/efl_ui_grid_static.c \
$(NULL)
diff --git a/src/lib/elementary/Elementary.h.in b/src/lib/elementary/Elementary.h.in
index b85eaffaec..b59a194905 100644
--- a/src/lib/elementary/Elementary.h.in
+++ b/src/lib/elementary/Elementary.h.in
@@ -271,6 +271,7 @@ EAPI extern Elm_Version *elm_version;
# include <efl_ui_box.eo.h>
# include <efl_ui_box_flow.eo.h>
# include <efl_ui_grid.eo.h>
+# include <efl_ui_grid_static.eo.h>
#endif
/* include deprecated calls last of all */
diff --git a/src/lib/elementary/Makefile.am b/src/lib/elementary/Makefile.am
index 976897b624..0720ae64c9 100644
--- a/src/lib/elementary/Makefile.am
+++ b/src/lib/elementary/Makefile.am
@@ -124,6 +124,7 @@ elm_eolian_files = \
efl_ui_box.eo \
efl_ui_box_flow.eo \
efl_ui_grid.eo \
+ efl_ui_grid_static.eo \
efl_ui_layout_internal_box.eo \
efl_ui_layout_internal_table.eo \
$(NULL)
@@ -494,6 +495,7 @@ includesub_HEADERS = \
elm_win_standard.h \
elm_helper.h \
efl_ui_box_private.h \
+ efl_ui_grid_private.h \
$(NULL)
includesubdir = $(includedir)/elementary-@VMAJ@/
@@ -625,6 +627,7 @@ libelementary_la_SOURCES = \
efl_ui_box_flow.c \
efl_ui_box_layout.c \
efl_ui_grid.c \
+ efl_ui_grid_static.c \
$(NULL)
libelementary_la_CFLAGS = @ELEMENTARY_CFLAGS@
diff --git a/src/lib/elementary/efl_ui_grid.c b/src/lib/elementary/efl_ui_grid.c
index ce25f17fb1..9d97822bf3 100644
--- a/src/lib/elementary/efl_ui_grid.c
+++ b/src/lib/elementary/efl_ui_grid.c
@@ -1,65 +1,15 @@
-#ifdef HAVE_CONFIG_H
-# include "elementary_config.h"
-#endif
+#include "efl_ui_grid_private.h"
-#define EFL_PACK_LAYOUT_PROTECTED
-
-#include <Elementary.h>
-#include "elm_priv.h"
-
-#include "efl_ui_grid.eo.h"
#include "../evas/canvas/evas_table.eo.h"
#define MY_CLASS EFL_UI_GRID_CLASS
#define MY_CLASS_NAME "Efl.Ui.Grid"
-typedef struct _Efl_Ui_Grid_Data Efl_Ui_Grid_Data;
-typedef struct _Grid_Item_Iterator Grid_Item_Iterator;
-typedef struct _Grid_Item Grid_Item;
typedef struct _Custom_Table_Data Custom_Table_Data;
static Eina_Bool _subobj_del_cb(void *data, const Eo_Event *event);
static void _item_remove(Efl_Ui_Grid *obj, Efl_Ui_Grid_Data *pd, Efl_Gfx *subobj);
-#define GRID_ITEM_KEY "__grid_item"
-
-struct _Grid_Item
-{
- EINA_INLIST;
-
- Efl_Gfx *object;
- int col_span, row_span;
- int col, row;
-
- Eina_Bool linear : 1;
-};
-
-struct _Efl_Ui_Grid_Data
-{
- const Eo_Class *layout_engine;
- const void *layout_data;
-
- Grid_Item *items;
- int count;
-
- int req_cols, req_rows; // requested - 0 means infinite
- int last_col, last_row; // only used by linear apis
- Efl_Orient dir1, dir2; // must be orthogonal (H,V or V,H)
- struct {
- double h, v;
- Eina_Bool scalable: 1;
- } pad;
- Eina_Bool linear_recalc : 1;
-};
-
-struct _Grid_Item_Iterator
-{
- Eina_Iterator iterator;
- Eina_Iterator *real_iterator;
- Eina_List *list;
- Efl_Ui_Grid *object;
-};
-
struct _Custom_Table_Data
{
Efl_Ui_Grid *parent;
@@ -69,12 +19,6 @@ struct _Custom_Table_Data
EO_CALLBACKS_ARRAY_DEFINE(subobj_callbacks,
{ EO_EVENT_DEL, _subobj_del_cb });
-static inline Eina_Bool
-_horiz(Efl_Orient dir)
-{
- return dir % 180 == EFL_ORIENT_RIGHT;
-}
-
EOLIAN static Eina_Bool
_efl_ui_grid_elm_widget_focus_next_manager_is(Eo *obj EINA_UNUSED, Efl_Ui_Grid_Data *pd EINA_UNUSED)
{
diff --git a/src/lib/elementary/efl_ui_grid_private.h b/src/lib/elementary/efl_ui_grid_private.h
new file mode 100644
index 0000000000..ab2aa85a20
--- /dev/null
+++ b/src/lib/elementary/efl_ui_grid_private.h
@@ -0,0 +1,62 @@
+#ifndef EFL_UI_GRID_PRIVATE_H
+#define EFL_UI_GRID_PRIVATE_H
+
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+
+#define EFL_PACK_LAYOUT_PROTECTED
+
+#include <Elementary.h>
+#include "elm_priv.h"
+
+typedef struct _Efl_Ui_Grid_Data Efl_Ui_Grid_Data;
+typedef struct _Grid_Item_Iterator Grid_Item_Iterator;
+typedef struct _Grid_Item Grid_Item;
+
+#define GRID_ITEM_KEY "__grid_item"
+
+struct _Grid_Item
+{
+ EINA_INLIST;
+
+ Efl_Gfx *object;
+ int col_span, row_span;
+ int col, row;
+
+ Eina_Bool linear : 1;
+};
+
+struct _Efl_Ui_Grid_Data
+{
+ const Eo_Class *layout_engine;
+ const void *layout_data;
+
+ Grid_Item *items;
+ int count;
+
+ int req_cols, req_rows; // requested - 0 means infinite
+ int last_col, last_row; // only used by linear apis
+ Efl_Orient dir1, dir2; // must be orthogonal (H,V or V,H)
+ struct {
+ double h, v;
+ Eina_Bool scalable: 1;
+ } pad;
+ Eina_Bool linear_recalc : 1;
+};
+
+struct _Grid_Item_Iterator
+{
+ Eina_Iterator iterator;
+ Eina_Iterator *real_iterator;
+ Eina_List *list;
+ Efl_Ui_Grid *object;
+};
+
+static inline Eina_Bool
+_horiz(Efl_Orient dir)
+{
+ return dir % 180 == EFL_ORIENT_RIGHT;
+}
+
+#endif
diff --git a/src/lib/elementary/efl_ui_grid_static.c b/src/lib/elementary/efl_ui_grid_static.c
new file mode 100644
index 0000000000..d74c230a65
--- /dev/null
+++ b/src/lib/elementary/efl_ui_grid_static.c
@@ -0,0 +1,69 @@
+#include "efl_ui_grid_private.h"
+
+#define MY_CLASS EFL_UI_GRID_STATIC_CLASS
+
+typedef struct _Efl_Ui_Grid_Static_Data Efl_Ui_Grid_Static_Data;
+
+struct _Efl_Ui_Grid_Static_Data
+{
+};
+
+EOLIAN static void
+_efl_ui_grid_static_efl_pack_layout_layout_update(Eo *obj, Efl_Ui_Grid_Static_Data *pd EINA_UNUSED)
+{
+ Efl_Ui_Grid_Data *gd = eo_data_scope_get(obj, EFL_UI_GRID_CLASS);
+ efl_pack_layout_do(gd->layout_engine, obj, gd->layout_data);
+}
+
+EOLIAN static void
+_efl_ui_grid_static_efl_pack_layout_layout_do(Eo_Class *klass EINA_UNUSED,
+ void *_pd EINA_UNUSED,
+ Eo *obj, const void *data EINA_UNUSED)
+{
+ Efl_Ui_Grid_Data *gd;
+ Grid_Item *gi;
+ Evas *e;
+ Evas_Coord x, y, w, h;
+ long long xl, yl, wl, hl, vwl, vhl;
+ Eina_Bool mirror;
+
+ gd = eo_data_scope_get(obj, EFL_UI_GRID_CLASS);
+ if (!gd->items) return;
+
+ e = evas_common_evas_get(obj);
+ eo_event_freeze(e);
+
+ efl_gfx_position_get(obj, &x, &y);
+ efl_gfx_size_get(obj, &w, &h);
+ xl = x;
+ yl = y;
+ wl = w;
+ hl = h;
+ mirror = elm_widget_mirrored_get(obj);
+ vwl = gd->req_cols;
+ vhl = gd->req_rows;
+
+ EINA_INLIST_FOREACH(gd->items, gi)
+ {
+ long long x1, y1, x2, y2;
+
+ if (!mirror)
+ {
+ x1 = xl + ((wl * (long long)gi->col) / vwl);
+ x2 = xl + ((wl * (long long)(gi->col + gi->col_span)) / vwl);
+ }
+ else
+ {
+ x1 = xl + ((wl * (vwl - (long long)(gi->col + gi->col_span))) / vwl);
+ x2 = xl + ((wl * (vwl - (long long)gi->col)) / vwl);
+ }
+ y1 = yl + ((hl * (long long)gi->row) / vhl);
+ y2 = yl + ((hl * (long long)(gi->row + gi->row_span)) / vhl);
+ efl_gfx_position_set(gi->object, x1, y1);
+ efl_gfx_size_set(gi->object, x2 - x1, y2 - y1);
+ }
+
+ eo_event_thaw(e);
+}
+
+#include "efl_ui_grid_static.eo.c"
diff --git a/src/lib/elementary/efl_ui_grid_static.eo b/src/lib/elementary/efl_ui_grid_static.eo
new file mode 100644
index 0000000000..2350708a5a
--- /dev/null
+++ b/src/lib/elementary/efl_ui_grid_static.eo
@@ -0,0 +1,7 @@
+class Efl.Ui.Grid.Static (Efl.Ui.Grid)
+{
+ implements {
+ Efl.Pack.Layout.layout_do;
+ Efl.Pack.Layout.layout_update;
+ }
+}