summaryrefslogtreecommitdiff
path: root/src/lib/evas/canvas/evas_object_table.c
diff options
context:
space:
mode:
authorYossi Kantor <yossi.kantor@samsung.com>2014-03-10 14:13:06 +0200
committerDaniel Zaoui <daniel.zaoui@samsung.com>2014-03-11 07:37:48 +0200
commit1b2f732d2a21e23e63426e99b2a47a80fbe6207f (patch)
treeb3cf43ca482336f0f0e5c212db698298de4f9319 /src/lib/evas/canvas/evas_object_table.c
parente203ec008e8ae68f793cb6c0b835ed23de1dd61f (diff)
Eolian: Integration of Evas Table
Diffstat (limited to 'src/lib/evas/canvas/evas_object_table.c')
-rw-r--r--src/lib/evas/canvas/evas_object_table.c439
1 files changed, 88 insertions, 351 deletions
diff --git a/src/lib/evas/canvas/evas_object_table.c b/src/lib/evas/canvas/evas_object_table.c
index aef6b94..b64a0bb 100644
--- a/src/lib/evas/canvas/evas_object_table.c
+++ b/src/lib/evas/canvas/evas_object_table.c
@@ -4,14 +4,12 @@
4 4
5#include <Eo.h> 5#include <Eo.h>
6 6
7EAPI Eo_Op EVAS_OBJ_TABLE_BASE_ID = EO_NOOP;
8
9#define MY_CLASS EVAS_OBJ_TABLE_CLASS 7#define MY_CLASS EVAS_OBJ_TABLE_CLASS
10 8
11#define MY_CLASS_NAME "Evas_Table" 9#define MY_CLASS_NAME "Evas_Table"
12#define MY_CLASS_NAME_LEGACY "Evas_Object_Table" 10#define MY_CLASS_NAME_LEGACY "Evas_Object_Table"
13 11
14typedef struct _Evas_Object_Table_Data Evas_Object_Table_Data; 12typedef struct _Evas_Table_Data Evas_Table_Data;
15typedef struct _Evas_Object_Table_Option Evas_Object_Table_Option; 13typedef struct _Evas_Object_Table_Option Evas_Object_Table_Option;
16typedef struct _Evas_Object_Table_Cache Evas_Object_Table_Cache; 14typedef struct _Evas_Object_Table_Cache Evas_Object_Table_Cache;
17typedef struct _Evas_Object_Table_Iterator Evas_Object_Table_Iterator; 15typedef struct _Evas_Object_Table_Iterator Evas_Object_Table_Iterator;
@@ -61,7 +59,7 @@ struct _Evas_Object_Table_Cache
61 double ___pad; // padding to make sure doubles at end can be aligned 59 double ___pad; // padding to make sure doubles at end can be aligned
62}; 60};
63 61
64struct _Evas_Object_Table_Data 62struct _Evas_Table_Data
65{ 63{
66 Eina_List *children; 64 Eina_List *children;
67 struct { 65 struct {
@@ -98,7 +96,7 @@ struct _Evas_Object_Table_Accessor
98}; 96};
99 97
100#define EVAS_OBJECT_TABLE_DATA_GET(o, ptr) \ 98#define EVAS_OBJECT_TABLE_DATA_GET(o, ptr) \
101 Evas_Object_Table_Data *ptr = eo_data_scope_get(o, MY_CLASS) 99 Evas_Table_Data *ptr = eo_data_scope_get(o, MY_CLASS)
102 100
103#define EVAS_OBJECT_TABLE_DATA_GET_OR_RETURN(o, ptr) \ 101#define EVAS_OBJECT_TABLE_DATA_GET_OR_RETURN(o, ptr) \
104 EVAS_OBJECT_TABLE_DATA_GET(o, ptr); \ 102 EVAS_OBJECT_TABLE_DATA_GET(o, ptr); \
@@ -202,7 +200,7 @@ _evas_object_table_cache_free(Evas_Object_Table_Cache *cache)
202} 200}
203 201
204static void 202static void
205_evas_object_table_cache_reset(Evas_Object_Table_Data *priv) 203_evas_object_table_cache_reset(Evas_Table_Data *priv)
206{ 204{
207 Evas_Object_Table_Cache *c = priv->cache; 205 Evas_Object_Table_Cache *c = priv->cache;
208 int size; 206 int size;
@@ -219,7 +217,7 @@ _evas_object_table_cache_reset(Evas_Object_Table_Data *priv)
219} 217}
220 218
221static void 219static void
222_evas_object_table_cache_invalidate(Evas_Object_Table_Data *priv) 220_evas_object_table_cache_invalidate(Evas_Table_Data *priv)
223{ 221{
224 priv->hints_changed = 1; 222 priv->hints_changed = 1;
225 if (priv->cache) 223 if (priv->cache)
@@ -326,7 +324,7 @@ _evas_object_table_calculate_cell(const Evas_Object_Table_Option *opt, Evas_Coor
326} 324}
327 325
328static void 326static void
329_evas_object_table_calculate_hints_homogeneous(Evas_Object *o, Evas_Object_Table_Data *priv) 327_evas_object_table_calculate_hints_homogeneous(Evas_Object *o, Evas_Table_Data *priv)
330{ 328{
331 Eina_List *l; 329 Eina_List *l;
332 Evas_Object_Table_Option *opt; 330 Evas_Object_Table_Option *opt;
@@ -432,7 +430,7 @@ _evas_object_table_calculate_hints_homogeneous(Evas_Object *o, Evas_Object_Table
432} 430}
433 431
434static void 432static void
435_evas_object_table_calculate_layout_homogeneous_sizes_item(const Evas_Object *o, const Evas_Object_Table_Data *priv, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h) 433_evas_object_table_calculate_layout_homogeneous_sizes_item(const Evas_Object *o, const Evas_Table_Data *priv, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
436{ 434{
437 Evas_Coord minw, minh; 435 Evas_Coord minw, minh;
438 Eina_Bool expand_h, expand_v; 436 Eina_Bool expand_h, expand_v;
@@ -459,7 +457,7 @@ _evas_object_table_calculate_layout_homogeneous_sizes_item(const Evas_Object *o,
459} 457}
460 458
461static void 459static void
462_evas_object_table_calculate_layout_homogeneous_sizes(const Evas_Object *o, const Evas_Object_Table_Data *priv, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h, Evas_Coord *cellw, Evas_Coord *cellh) 460_evas_object_table_calculate_layout_homogeneous_sizes(const Evas_Object *o, const Evas_Table_Data *priv, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h, Evas_Coord *cellw, Evas_Coord *cellh)
463{ 461{
464 evas_object_geometry_get(o, x, y, w, h); 462 evas_object_geometry_get(o, x, y, w, h);
465 if (priv->homogeneous == EVAS_OBJECT_TABLE_HOMOGENEOUS_ITEM) 463 if (priv->homogeneous == EVAS_OBJECT_TABLE_HOMOGENEOUS_ITEM)
@@ -471,7 +469,7 @@ _evas_object_table_calculate_layout_homogeneous_sizes(const Evas_Object *o, cons
471} 469}
472 470
473static void 471static void
474_evas_object_table_calculate_layout_homogeneous(Evas_Object *o, Evas_Object_Table_Data *priv) 472_evas_object_table_calculate_layout_homogeneous(Evas_Object *o, Evas_Table_Data *priv)
475{ 473{
476 Evas_Coord x = 0, y = 0, w = 0, h = 0, ww, hh, cellw = 0, cellh = 0; 474 Evas_Coord x = 0, y = 0, w = 0, h = 0, ww, hh, cellw = 0, cellh = 0;
477 Eina_List *l; 475 Eina_List *l;
@@ -529,7 +527,7 @@ _evas_object_table_calculate_layout_homogeneous(Evas_Object *o, Evas_Object_Tabl
529} 527}
530 528
531static void 529static void
532_evas_object_table_smart_calculate_homogeneous(Evas_Object *o, Evas_Object_Table_Data *priv) 530_evas_object_table_smart_calculate_homogeneous(Evas_Object *o, Evas_Table_Data *priv)
533{ 531{
534 if (priv->hints_changed) 532 if (priv->hints_changed)
535 _evas_object_table_calculate_hints_homogeneous(o, priv); 533 _evas_object_table_calculate_hints_homogeneous(o, priv);
@@ -632,7 +630,7 @@ _evas_object_table_sizes_calc_expand(Evas_Coord *sizes, int start, int end, Evas
632} 630}
633 631
634static void 632static void
635_evas_object_table_calculate_hints_regular(Evas_Object *o, Evas_Object_Table_Data *priv) 633_evas_object_table_calculate_hints_regular(Evas_Object *o, Evas_Table_Data *priv)
636{ 634{
637 Evas_Object_Table_Option *opt; 635 Evas_Object_Table_Option *opt;
638 Evas_Object_Table_Cache *c; 636 Evas_Object_Table_Cache *c;
@@ -777,7 +775,7 @@ _evas_object_table_calculate_hints_regular(Evas_Object *o, Evas_Object_Table_Dat
777} 775}
778 776
779static void 777static void
780_evas_object_table_calculate_layout_regular(Evas_Object *o, Evas_Object_Table_Data *priv) 778_evas_object_table_calculate_layout_regular(Evas_Object *o, Evas_Table_Data *priv)
781{ 779{
782 Evas_Object_Table_Option *opt; 780 Evas_Object_Table_Option *opt;
783 Evas_Object_Table_Cache *c; 781 Evas_Object_Table_Cache *c;
@@ -874,17 +872,16 @@ _evas_object_table_calculate_layout_regular(Evas_Object *o, Evas_Object_Table_Da
874} 872}
875 873
876static void 874static void
877_evas_object_table_smart_calculate_regular(Evas_Object *o, Evas_Object_Table_Data *priv) 875_evas_object_table_smart_calculate_regular(Evas_Object *o, Evas_Table_Data *priv)
878{ 876{
879 if (priv->hints_changed) 877 if (priv->hints_changed)
880 _evas_object_table_calculate_hints_regular(o, priv); 878 _evas_object_table_calculate_hints_regular(o, priv);
881 _evas_object_table_calculate_layout_regular(o, priv); 879 _evas_object_table_calculate_layout_regular(o, priv);
882} 880}
883 881
884static void 882EOLIAN static void
885_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED) 883_evas_table_evas_smart_add(Eo *obj, Evas_Table_Data *priv)
886{ 884{
887 Evas_Object_Table_Data *priv = _pd;
888 priv->pad.h = 0; 885 priv->pad.h = 0;
889 priv->pad.v = 0; 886 priv->pad.v = 0;
890 priv->align.h = 0.5; 887 priv->align.h = 0.5;
@@ -900,10 +897,9 @@ _smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
900 eo_do_super(obj, MY_CLASS, evas_obj_smart_add()); 897 eo_do_super(obj, MY_CLASS, evas_obj_smart_add());
901} 898}
902 899
903static void 900EOLIAN static void
904_smart_del(Eo *obj, void *_pd, va_list *list EINA_UNUSED) 901_evas_table_evas_smart_del(Eo *obj, Evas_Table_Data *priv)
905{ 902{
906 Evas_Object_Table_Data *priv = _pd;
907 Eina_List *l; 903 Eina_List *l;
908 904
909 l = priv->children; 905 l = priv->children;
@@ -925,22 +921,18 @@ _smart_del(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
925 eo_do_super(obj, MY_CLASS, evas_obj_smart_del()); 921 eo_do_super(obj, MY_CLASS, evas_obj_smart_del());
926} 922}
927 923
928static void 924EOLIAN static void
929_smart_resize(Eo *obj, void *_pd EINA_UNUSED, va_list *list) 925_evas_table_evas_smart_resize(Eo *obj, Evas_Table_Data *_pd EINA_UNUSED, Evas_Coord w, Evas_Coord h)
930{ 926{
931 Evas_Coord w = va_arg(*list, Evas_Coord);
932 Evas_Coord h = va_arg(*list, Evas_Coord);
933 Evas_Coord ow, oh; 927 Evas_Coord ow, oh;
934 evas_object_geometry_get(obj, NULL, NULL, &ow, &oh); 928 evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
935 if ((ow == w) && (oh == h)) return; 929 if ((ow == w) && (oh == h)) return;
936 evas_object_smart_changed(obj); 930 evas_object_smart_changed(obj);
937} 931}
938 932
939static void 933EOLIAN static void
940_smart_calculate(Eo *o, void *_pd, va_list *list EINA_UNUSED) 934_evas_table_evas_smart_calculate(Eo *o, Evas_Table_Data *priv)
941{ 935{
942 Evas_Object_Table_Data *priv = _pd;
943
944 if ((priv->size.cols < 1) || (priv->size.rows < 1)) 936 if ((priv->size.cols < 1) || (priv->size.rows < 1))
945 { 937 {
946 DBG("Nothing to do: cols=%d, rows=%d", 938 DBG("Nothing to do: cols=%d, rows=%d",
@@ -962,44 +954,29 @@ evas_object_table_add(Evas *evas)
962 return obj; 954 return obj;
963} 955}
964 956
965static void 957EOLIAN static void
966_constructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED) 958_evas_table_constructor(Eo *obj, Evas_Table_Data *class_data EINA_UNUSED)
967{ 959{
968 eo_do_super(obj, MY_CLASS, eo_constructor()); 960 eo_do_super(obj, MY_CLASS, eo_constructor());
969 eo_do(obj, evas_obj_type_set(MY_CLASS_NAME_LEGACY)); 961 eo_do(obj, evas_obj_type_set(MY_CLASS_NAME_LEGACY));
970} 962}
971 963
972EAPI Evas_Object * 964EOLIAN static Evas_Object*
973evas_object_table_add_to(Evas_Object *parent) 965_evas_table_add_to(Eo *parent, Evas_Table_Data *_pd EINA_UNUSED)
974{ 966{
975 Evas_Object *ret = NULL; 967 Evas_Object *ret;
976 eo_do(parent, evas_obj_table_add_to(&ret));
977 return ret;
978}
979
980static void
981_add_to(Eo *parent, void *_pd EINA_UNUSED, va_list *list)
982{
983 Evas_Object **ret = va_arg(*list, Evas_Object **);
984 Evas *evas; 968 Evas *evas;
985 969
986 evas = evas_object_evas_get(parent); 970 evas = evas_object_evas_get(parent);
987 *ret = evas_object_table_add(evas); 971 ret = evas_object_table_add(evas);
988 evas_object_smart_member_add(*ret, parent); 972 evas_object_smart_member_add(ret, parent);
989}
990 973
991EAPI void 974 return ret;
992evas_object_table_homogeneous_set(Evas_Object *o, Evas_Object_Table_Homogeneous_Mode homogeneous)
993{
994 eo_do(o, evas_obj_table_homogeneous_set(homogeneous));
995} 975}
996 976
997static void 977EOLIAN static void
998_homogeneous_set(Eo *o, void *_pd, va_list *list) 978_evas_table_homogeneous_set(Eo *o, Evas_Table_Data *priv, Evas_Object_Table_Homogeneous_Mode homogeneous)
999{ 979{
1000 Evas_Object_Table_Homogeneous_Mode homogeneous = va_arg(*list, Evas_Object_Table_Homogeneous_Mode);
1001
1002 Evas_Object_Table_Data *priv = _pd;
1003 if (priv->homogeneous == homogeneous) 980 if (priv->homogeneous == homogeneous)
1004 return; 981 return;
1005 priv->homogeneous = homogeneous; 982 priv->homogeneous = homogeneous;
@@ -1007,35 +984,15 @@ _homogeneous_set(Eo *o, void *_pd, va_list *list)
1007 evas_object_smart_changed(o); 984 evas_object_smart_changed(o);
1008} 985}
1009 986
1010EAPI Evas_Object_Table_Homogeneous_Mode 987EOLIAN static Evas_Object_Table_Homogeneous_Mode
1011evas_object_table_homogeneous_get(const Evas_Object *o) 988_evas_table_homogeneous_get(Eo *o EINA_UNUSED, Evas_Table_Data *priv)
1012{ 989{
1013 Evas_Object_Table_Homogeneous_Mode ret = EVAS_OBJECT_TABLE_HOMOGENEOUS_NONE; 990 return priv->homogeneous;
1014 eo_do((Eo *)o, evas_obj_table_homogeneous_get(&ret));
1015 return ret;
1016} 991}
1017 992
1018static void 993EOLIAN static void
1019_homogeneous_get(Eo *o EINA_UNUSED, void *_pd, va_list *list) 994_evas_table_align_set(Eo *o, Evas_Table_Data *priv, double horizontal, double vertical)
1020{ 995{
1021 Evas_Object_Table_Homogeneous_Mode *ret = va_arg(*list, Evas_Object_Table_Homogeneous_Mode *);
1022 const Evas_Object_Table_Data *priv = _pd;
1023 *ret = priv->homogeneous;
1024}
1025
1026EAPI void
1027evas_object_table_align_set(Evas_Object *o, double horizontal, double vertical)
1028{
1029 eo_do(o, evas_obj_table_align_set(horizontal, vertical));
1030}
1031
1032static void
1033_align_set(Eo *o, void *_pd, va_list *list)
1034{
1035 double horizontal = va_arg(*list, double);
1036 double vertical = va_arg(*list, double);
1037
1038 Evas_Object_Table_Data *priv = _pd;
1039 if (priv->align.h == horizontal && priv->align.v == vertical) 996 if (priv->align.h == horizontal && priv->align.v == vertical)
1040 return; 997 return;
1041 priv->align.h = horizontal; 998 priv->align.h = horizontal;
@@ -1043,19 +1000,9 @@ _align_set(Eo *o, void *_pd, va_list *list)
1043 evas_object_smart_changed(o); 1000 evas_object_smart_changed(o);
1044} 1001}
1045 1002
1046EAPI void 1003EOLIAN static void
1047evas_object_table_align_get(const Evas_Object *o, double *horizontal, double *vertical) 1004_evas_table_align_get(Eo *o EINA_UNUSED, Evas_Table_Data *priv, double *horizontal, double *vertical)
1048{
1049 eo_do((Eo *)o, evas_obj_table_align_get(horizontal, vertical));
1050}
1051
1052static void
1053_align_get(Eo *o EINA_UNUSED, void *_pd, va_list *list)
1054{ 1005{
1055 double *horizontal = va_arg(*list, double *);
1056 double *vertical = va_arg(*list, double *);
1057
1058 const Evas_Object_Table_Data *priv = _pd;
1059 if (priv) 1006 if (priv)
1060 { 1007 {
1061 if (horizontal) *horizontal = priv->align.h; 1008 if (horizontal) *horizontal = priv->align.h;
@@ -1068,19 +1015,9 @@ _align_get(Eo *o EINA_UNUSED, void *_pd, va_list *list)
1068 } 1015 }
1069} 1016}
1070 1017
1071EAPI void 1018EOLIAN static void
1072evas_object_table_padding_set(Evas_Object *o, Evas_Coord horizontal, Evas_Coord vertical) 1019_evas_table_padding_set(Eo *o, Evas_Table_Data *priv, Evas_Coord horizontal, Evas_Coord vertical)
1073{ 1020{
1074 eo_do(o, evas_obj_table_padding_set(horizontal, vertical));
1075}
1076
1077static void
1078_padding_set(Eo *o, void *_pd, va_list *list)
1079{
1080 Evas_Coord horizontal = va_arg(*list, Evas_Coord);
1081 Evas_Coord vertical = va_arg(*list, Evas_Coord);
1082
1083 Evas_Object_Table_Data *priv = _pd;
1084 if (priv->pad.h == horizontal && priv->pad.v == vertical) 1021 if (priv->pad.h == horizontal && priv->pad.v == vertical)
1085 return; 1022 return;
1086 priv->pad.h = horizontal; 1023 priv->pad.h = horizontal;
@@ -1089,19 +1026,9 @@ _padding_set(Eo *o, void *_pd, va_list *list)
1089 evas_object_smart_changed(o); 1026 evas_object_smart_changed(o);
1090} 1027}
1091 1028
1092EAPI void 1029EOLIAN static void
1093evas_object_table_padding_get(const Evas_Object *o, Evas_Coord *horizontal, Evas_Coord *vertical) 1030_evas_table_padding_get(Eo *o EINA_UNUSED, Evas_Table_Data *priv, Evas_Coord *horizontal, Evas_Coord *vertical)
1094{ 1031{
1095 eo_do((Eo *)o, evas_obj_table_padding_get(horizontal, vertical));
1096}
1097
1098static void
1099_padding_get(Eo *o EINA_UNUSED, void *_pd, va_list *list)
1100{
1101 Evas_Coord *horizontal = va_arg(*list, Evas_Coord *);
1102 Evas_Coord *vertical = va_arg(*list, Evas_Coord *);
1103
1104 const Evas_Object_Table_Data *priv = _pd;
1105 if (priv) 1032 if (priv)
1106 { 1033 {
1107 if (horizontal) *horizontal = priv->pad.h; 1034 if (horizontal) *horizontal = priv->pad.h;
@@ -1114,25 +1041,9 @@ _padding_get(Eo *o EINA_UNUSED, void *_pd, va_list *list)
1114 } 1041 }
1115} 1042}
1116 1043
1117EAPI Eina_Bool 1044EOLIAN static Eina_Bool
1118evas_object_table_pack_get(const Evas_Object *o, Evas_Object *child, unsigned short *col, unsigned short *row, unsigned short *colspan, unsigned short *rowspan) 1045_evas_table_pack_get(Eo *o EINA_UNUSED, Evas_Table_Data *_pd EINA_UNUSED, Evas_Object *child, unsigned short *col, unsigned short *row, unsigned short *colspan, unsigned short *rowspan)
1119{ 1046{
1120 Eina_Bool ret = EINA_FALSE;
1121 eo_do((Eo *)o, evas_obj_table_pack_get(child, col, row, colspan, rowspan, &ret));
1122 return ret;
1123}
1124
1125static void
1126_pack_get(Eo *o EINA_UNUSED, void *_pd EINA_UNUSED, va_list *list)
1127{
1128 Evas_Object *child = va_arg(*list, Evas_Object *);
1129 unsigned short *col = va_arg(*list, unsigned short *);
1130 unsigned short *row = va_arg(*list, unsigned short *);
1131 unsigned short *colspan = va_arg(*list, unsigned short *);
1132 unsigned short *rowspan = va_arg(*list, unsigned short *);
1133 Eina_Bool *ret = va_arg(*list, Eina_Bool *);
1134 if (ret) *ret = EINA_FALSE;
1135
1136 Evas_Object_Table_Option *opt; 1047 Evas_Object_Table_Option *opt;
1137 1048
1138 opt = _evas_object_table_option_get(child); 1049 opt = _evas_object_table_option_get(child);
@@ -1142,48 +1053,32 @@ _pack_get(Eo *o EINA_UNUSED, void *_pd EINA_UNUSED, va_list *list)
1142 if (row) *row = 0; 1053 if (row) *row = 0;
1143 if (colspan) *colspan = 0; 1054 if (colspan) *colspan = 0;
1144 if (rowspan) *rowspan = 0; 1055 if (rowspan) *rowspan = 0;
1145 return; 1056 return EINA_FALSE;
1146 } 1057 }
1147 if (col) *col = opt->col; 1058 if (col) *col = opt->col;
1148 if (row) *row = opt->row; 1059 if (row) *row = opt->row;
1149 if (colspan) *colspan = opt->colspan; 1060 if (colspan) *colspan = opt->colspan;
1150 if (rowspan) *rowspan = opt->rowspan; 1061 if (rowspan) *rowspan = opt->rowspan;
1151 if (ret) *ret = EINA_TRUE; 1062
1152} 1063 return EINA_TRUE;
1153
1154EAPI Eina_Bool
1155evas_object_table_pack(Evas_Object *o, Evas_Object *child, unsigned short col, unsigned short row, unsigned short colspan, unsigned short rowspan)
1156{
1157 Eina_Bool ret = EINA_FALSE;
1158 eo_do(o, evas_obj_table_pack(child, col, row, colspan, rowspan, &ret));
1159 return ret;
1160} 1064}
1161 1065
1162static void 1066EOLIAN static Eina_Bool
1163_pack(Eo *o, void *_pd, va_list *list) 1067_evas_table_pack(Eo *o, Evas_Table_Data *priv, Evas_Object *child, unsigned short col, unsigned short row, unsigned short colspan, unsigned short rowspan)
1164{ 1068{
1165 Evas_Object *child = va_arg(*list, Evas_Object *);
1166 unsigned short col = va_arg(*list, int);
1167 unsigned short row = va_arg(*list, int);
1168 unsigned short colspan = va_arg(*list, int);
1169 unsigned short rowspan = va_arg(*list, int);
1170 Eina_Bool *ret = va_arg(*list, Eina_Bool *);
1171 if (ret) *ret = EINA_FALSE;
1172 Eina_Bool optalloc = EINA_FALSE; 1069 Eina_Bool optalloc = EINA_FALSE;
1173 1070
1174 Evas_Object_Table_Option *opt; 1071 Evas_Object_Table_Option *opt;
1175 1072
1176 Evas_Object_Table_Data *priv = _pd;
1177
1178 if (colspan < 1) 1073 if (colspan < 1)
1179 { 1074 {
1180 ERR("colspan < 1"); 1075 ERR("colspan < 1");
1181 return; 1076 return EINA_FALSE;
1182 } 1077 }
1183 if ((0xffff - col) < colspan) 1078 if ((0xffff - col) < colspan)
1184 { 1079 {
1185 ERR("col + colspan > 0xffff"); 1080 ERR("col + colspan > 0xffff");
1186 return; 1081 return EINA_FALSE;
1187 } 1082 }
1188 if ((col + colspan) >= 0x7ffff) 1083 if ((col + colspan) >= 0x7ffff)
1189 { 1084 {
@@ -1192,12 +1087,12 @@ _pack(Eo *o, void *_pd, va_list *list)
1192 if (rowspan < 1) 1087 if (rowspan < 1)
1193 { 1088 {
1194 ERR("rowspan < 1"); 1089 ERR("rowspan < 1");
1195 return; 1090 return EINA_FALSE;
1196 } 1091 }
1197 if ((0xffff - row) < rowspan) 1092 if ((0xffff - row) < rowspan)
1198 { 1093 {
1199 ERR("row + rowspan > 0xffff"); 1094 ERR("row + rowspan > 0xffff");
1200 return; 1095 return EINA_FALSE;
1201 } 1096 }
1202 if ((row + rowspan) >= 0x7ffff) 1097 if ((row + rowspan) >= 0x7ffff)
1203 { 1098 {
@@ -1211,7 +1106,7 @@ _pack(Eo *o, void *_pd, va_list *list)
1211 if (!opt) 1106 if (!opt)
1212 { 1107 {
1213 ERR("could not allocate table option data."); 1108 ERR("could not allocate table option data.");
1214 return; 1109 return EINA_FALSE;
1215 } 1110 }
1216 optalloc = EINA_TRUE; 1111 optalloc = EINA_TRUE;
1217 } 1112 }
@@ -1281,11 +1176,12 @@ _pack(Eo *o, void *_pd, va_list *list)
1281 } 1176 }
1282 _evas_object_table_cache_invalidate(priv); 1177 _evas_object_table_cache_invalidate(priv);
1283 evas_object_smart_changed(o); 1178 evas_object_smart_changed(o);
1284 if (ret) *ret = EINA_TRUE; 1179
1180 return EINA_TRUE;
1285} 1181}
1286 1182
1287static void 1183static void
1288_evas_object_table_remove_opt(Evas_Object_Table_Data *priv, Evas_Object_Table_Option *opt) 1184_evas_object_table_remove_opt(Evas_Table_Data *priv, Evas_Object_Table_Option *opt)
1289{ 1185{
1290 Eina_List *l; 1186 Eina_List *l;
1291 int max_row, max_col, was_greatest; 1187 int max_row, max_col, was_greatest;
@@ -1330,36 +1226,22 @@ _evas_object_table_remove_opt(Evas_Object_Table_Data *priv, Evas_Object_Table_Op
1330 } 1226 }
1331} 1227}
1332 1228
1333EAPI Eina_Bool 1229EOLIAN static Eina_Bool
1334evas_object_table_unpack(Evas_Object *o, Evas_Object *child) 1230_evas_table_unpack(Eo *o, Evas_Table_Data *priv, Evas_Object *child)
1335{
1336 Eina_Bool ret = EINA_FALSE;
1337 eo_do(o, evas_obj_table_unpack(child, &ret));
1338 return ret;
1339}
1340
1341static void
1342_unpack(Eo *o, void *_pd, va_list *list)
1343{ 1231{
1344 Evas_Object *child = va_arg(*list, Evas_Object *);
1345 Eina_Bool *ret = va_arg(*list, Eina_Bool *);
1346 if (ret) *ret = EINA_FALSE;
1347
1348 Evas_Object_Table_Option *opt; 1232 Evas_Object_Table_Option *opt;
1349 1233
1350 Evas_Object_Table_Data *priv = _pd;
1351
1352 if (o != evas_object_smart_parent_get(child)) 1234 if (o != evas_object_smart_parent_get(child))
1353 { 1235 {
1354 ERR("cannot unpack child from incorrect table!"); 1236 ERR("cannot unpack child from incorrect table!");
1355 return; 1237 return EINA_FALSE;
1356 } 1238 }
1357 1239
1358 opt = _evas_object_table_option_del(child); 1240 opt = _evas_object_table_option_del(child);
1359 if (!opt) 1241 if (!opt)
1360 { 1242 {
1361 ERR("cannot unpack child with no packing option!"); 1243 ERR("cannot unpack child with no packing option!");
1362 return; 1244 return EINA_FALSE;
1363 } 1245 }
1364 1246
1365 _evas_object_table_child_disconnect(o, child); 1247 _evas_object_table_child_disconnect(o, child);
@@ -1369,24 +1251,14 @@ _unpack(Eo *o, void *_pd, va_list *list)
1369 _evas_object_table_cache_invalidate(priv); 1251 _evas_object_table_cache_invalidate(priv);
1370 evas_object_smart_changed(o); 1252 evas_object_smart_changed(o);
1371 1253
1372 if (ret) *ret = EINA_TRUE; 1254 return EINA_TRUE;
1373}
1374
1375EAPI void
1376evas_object_table_clear(Evas_Object *o, Eina_Bool clear)
1377{
1378 eo_do(o, evas_obj_table_clear(clear));
1379} 1255}
1380 1256
1381static void 1257EOLIAN static void
1382_clear(Eo *o, void *_pd, va_list *list) 1258_evas_table_clear(Eo *o, Evas_Table_Data *priv, Eina_Bool clear)
1383{ 1259{
1384 Eina_Bool clear = va_arg(*list, int);
1385
1386 Evas_Object_Table_Option *opt; 1260 Evas_Object_Table_Option *opt;
1387 1261
1388 Evas_Object_Table_Data *priv = _pd;
1389
1390 EINA_LIST_FREE(priv->children, opt) 1262 EINA_LIST_FREE(priv->children, opt)
1391 { 1263 {
1392 _evas_object_table_child_disconnect(o, opt->obj); 1264 _evas_object_table_child_disconnect(o, opt->obj);
@@ -1402,19 +1274,9 @@ _clear(Eo *o, void *_pd, va_list *list)
1402 evas_object_smart_changed(o); 1274 evas_object_smart_changed(o);
1403} 1275}
1404 1276
1405EAPI void 1277EOLIAN static void
1406evas_object_table_col_row_size_get(const Evas_Object *o, int *cols, int *rows) 1278_evas_table_col_row_size_get(Eo *o EINA_UNUSED, Evas_Table_Data *priv, int *cols, int *rows)
1407{
1408 eo_do((Eo *)o, evas_obj_table_col_row_size_get(cols, rows));
1409}
1410
1411static void
1412_col_row_size_get(Eo *o EINA_UNUSED, void *_pd, va_list *list)
1413{ 1279{
1414 int *cols = va_arg(*list, int *);
1415 int *rows = va_arg(*list, int *);
1416
1417 const Evas_Object_Table_Data *priv = _pd;
1418 if (priv) 1280 if (priv)
1419 { 1281 {
1420 if (cols) *cols = priv->size.cols; 1282 if (cols) *cols = priv->size.cols;
@@ -1427,34 +1289,20 @@ _col_row_size_get(Eo *o EINA_UNUSED, void *_pd, va_list *list)
1427 } 1289 }
1428} 1290}
1429 1291
1430EAPI Eina_Iterator * 1292EOLIAN static Eina_Iterator*
1431evas_object_table_iterator_new(const Evas_Object *o) 1293_evas_table_iterator_new(Eo *o, Evas_Table_Data *priv)
1432{ 1294{
1433 Eina_Iterator *ret = NULL;
1434 eo_do((Eo *)o, evas_obj_table_iterator_new(&ret));
1435 return ret;
1436}
1437
1438static void
1439_iterator_new(Eo *o, void *_pd, va_list *list)
1440{
1441 Eina_Iterator **ret = va_arg(*list, Eina_Iterator **);
1442
1443 Evas_Object_Table_Iterator *it; 1295 Evas_Object_Table_Iterator *it;
1444 1296
1445 const Evas_Object_Table_Data *priv = _pd;
1446
1447 if (!priv->children) 1297 if (!priv->children)
1448 { 1298 {
1449 *ret = NULL; 1299 return NULL;
1450 return;
1451 } 1300 }
1452 1301
1453 it = calloc(1, sizeof(Evas_Object_Table_Iterator)); 1302 it = calloc(1, sizeof(Evas_Object_Table_Iterator));
1454 if (!it) 1303 if (!it)
1455 { 1304 {
1456 *ret = NULL; 1305 return NULL;
1457 return;
1458 } 1306 }
1459 1307
1460 EINA_MAGIC_SET(&it->iterator, EINA_MAGIC_ITERATOR); 1308 EINA_MAGIC_SET(&it->iterator, EINA_MAGIC_ITERATOR);
@@ -1466,38 +1314,18 @@ _iterator_new(Eo *o, void *_pd, va_list *list)
1466 it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(_evas_object_table_iterator_get_container); 1314 it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(_evas_object_table_iterator_get_container);
1467 it->iterator.free = FUNC_ITERATOR_FREE(_evas_object_table_iterator_free); 1315 it->iterator.free = FUNC_ITERATOR_FREE(_evas_object_table_iterator_free);
1468 1316
1469 *ret = &it->iterator; 1317 return &it->iterator;
1470}
1471
1472EAPI Eina_Accessor *
1473evas_object_table_accessor_new(const Evas_Object *o)
1474{
1475 Eina_Accessor *ret = NULL;
1476 eo_do((Eo *)o, evas_obj_table_accessor_new(&ret));
1477 return ret;
1478} 1318}
1479 1319
1480static void 1320EOLIAN static Eina_Accessor*
1481_accessor_new(Eo *o, void *_pd, va_list *list) 1321_evas_table_accessor_new(Eo *o, Evas_Table_Data *priv)
1482{ 1322{
1483 Eina_Accessor **ret = va_arg(*list, Eina_Accessor **);
1484
1485 Evas_Object_Table_Accessor *it; 1323 Evas_Object_Table_Accessor *it;
1486 1324
1487 const Evas_Object_Table_Data *priv = _pd; 1325 if (!priv->children) return NULL;
1488
1489 if (!priv->children)
1490 {
1491 *ret = NULL;
1492 return;
1493 }
1494 1326
1495 it = calloc(1, sizeof(Evas_Object_Table_Accessor)); 1327 it = calloc(1, sizeof(Evas_Object_Table_Accessor));
1496 if (!it) 1328 if (!it) return NULL;
1497 {
1498 *ret = NULL;
1499 return;
1500 }
1501 1329
1502 EINA_MAGIC_SET(&it->accessor, EINA_MAGIC_ACCESSOR); 1330 EINA_MAGIC_SET(&it->accessor, EINA_MAGIC_ACCESSOR);
1503 1331
@@ -1508,31 +1336,19 @@ _accessor_new(Eo *o, void *_pd, va_list *list)
1508 it->accessor.get_container = FUNC_ACCESSOR_GET_CONTAINER(_evas_object_table_accessor_get_container); 1336 it->accessor.get_container = FUNC_ACCESSOR_GET_CONTAINER(_evas_object_table_accessor_get_container);
1509 it->accessor.free = FUNC_ACCESSOR_FREE(_evas_object_table_accessor_free); 1337 it->accessor.free = FUNC_ACCESSOR_FREE(_evas_object_table_accessor_free);
1510 1338
1511 *ret = &it->accessor; 1339 return &it->accessor;
1512}
1513
1514EAPI Eina_List *
1515evas_object_table_children_get(const Evas_Object *o)
1516{
1517 Eina_List *ret = NULL;
1518 eo_do((Eo *)o, evas_obj_table_children_get(&ret));
1519 return ret;
1520} 1340}
1521 1341
1522static void 1342EOLIAN static Eina_List*
1523_children_get(Eo *o EINA_UNUSED, void *_pd, va_list *list) 1343_evas_table_children_get(Eo *o EINA_UNUSED, Evas_Table_Data *priv)
1524{ 1344{
1525 Eina_List **ret = va_arg(*list, Eina_List **);
1526
1527 Eina_List *new_list = NULL, *l; 1345 Eina_List *new_list = NULL, *l;
1528 Evas_Object_Table_Option *opt; 1346 Evas_Object_Table_Option *opt;
1529 1347
1530 const Evas_Object_Table_Data *priv = _pd;
1531
1532 EINA_LIST_FOREACH(priv->children, l, opt) 1348 EINA_LIST_FOREACH(priv->children, l, opt)
1533 new_list = eina_list_append(new_list, opt->obj); 1349 new_list = eina_list_append(new_list, opt->obj);
1534 1350
1535 *ret = new_list; 1351 return new_list;
1536} 1352}
1537 1353
1538Evas_Object * 1354Evas_Object *
@@ -1549,36 +1365,15 @@ evas_object_table_child_get(const Evas_Object *o, unsigned short col, unsigned s
1549 return NULL; 1365 return NULL;
1550} 1366}
1551 1367
1552EAPI Eina_Bool 1368EOLIAN static Eina_Bool
1553evas_object_table_mirrored_get(const Evas_Object *obj) 1369_evas_table_mirrored_get(Eo *o EINA_UNUSED, Evas_Table_Data *priv)
1554{ 1370{
1555 Eina_Bool ret = EINA_FALSE; 1371 return priv->is_mirrored;
1556 eo_do((Eo *)obj, evas_obj_table_mirrored_get(&ret));
1557 return ret;
1558}
1559
1560static void
1561_mirrored_get(Eo *o EINA_UNUSED, void *_pd, va_list *list)
1562{
1563 Eina_Bool *ret = va_arg(*list, Eina_Bool *);
1564
1565 const Evas_Object_Table_Data *priv = _pd;
1566
1567 *ret = priv->is_mirrored;
1568}
1569
1570EAPI void
1571evas_object_table_mirrored_set(Evas_Object *obj, Eina_Bool mirrored)
1572{
1573 eo_do(obj, evas_obj_table_mirrored_set(mirrored));
1574} 1372}
1575 1373
1576static void 1374EOLIAN static void
1577_mirrored_set(Eo *o, void *_pd, va_list *list) 1375_evas_table_mirrored_set(Eo *o, Evas_Table_Data *priv, Eina_Bool mirrored)
1578{ 1376{
1579 Eina_Bool mirrored = va_arg(*list, int);
1580
1581 Evas_Object_Table_Data *priv = _pd;
1582 if (priv->is_mirrored != mirrored) 1377 if (priv->is_mirrored != mirrored)
1583 { 1378 {
1584 priv->is_mirrored = mirrored; 1379 priv->is_mirrored = mirrored;
@@ -1586,68 +1381,10 @@ _mirrored_set(Eo *o, void *_pd, va_list *list)
1586 } 1381 }
1587} 1382}
1588 1383
1589static void 1384EOLIAN static void
1590_class_constructor(Eo_Class *klass) 1385_evas_table_class_constructor(Eo_Class *klass)
1591{ 1386{
1592 const Eo_Op_Func_Description func_desc[] = { 1387 evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
1593 EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
1594 EO_OP_FUNC(EVAS_OBJ_TABLE_ID(EVAS_OBJ_TABLE_SUB_ID_ADD_TO), _add_to),
1595 EO_OP_FUNC(EVAS_OBJ_TABLE_ID(EVAS_OBJ_TABLE_SUB_ID_HOMOGENEOUS_SET), _homogeneous_set),
1596 EO_OP_FUNC(EVAS_OBJ_TABLE_ID(EVAS_OBJ_TABLE_SUB_ID_HOMOGENEOUS_GET), _homogeneous_get),
1597 EO_OP_FUNC(EVAS_OBJ_TABLE_ID(EVAS_OBJ_TABLE_SUB_ID_ALIGN_SET), _align_set),
1598 EO_OP_FUNC(EVAS_OBJ_TABLE_ID(EVAS_OBJ_TABLE_SUB_ID_ALIGN_GET), _align_get),
1599 EO_OP_FUNC(EVAS_OBJ_TABLE_ID(EVAS_OBJ_TABLE_SUB_ID_PADDING_SET), _padding_set),
1600 EO_OP_FUNC(EVAS_OBJ_TABLE_ID(EVAS_OBJ_TABLE_SUB_ID_PADDING_GET), _padding_get),
1601 EO_OP_FUNC(EVAS_OBJ_TABLE_ID(EVAS_OBJ_TABLE_SUB_ID_PACK_GET), _pack_get),
1602 EO_OP_FUNC(EVAS_OBJ_TABLE_ID(EVAS_OBJ_TABLE_SUB_ID_PACK), _pack),
1603 EO_OP_FUNC(EVAS_OBJ_TABLE_ID(EVAS_OBJ_TABLE_SUB_ID_UNPACK), _unpack),
1604 EO_OP_FUNC(EVAS_OBJ_TABLE_ID(EVAS_OBJ_TABLE_SUB_ID_CLEAR), _clear),
1605 EO_OP_FUNC(EVAS_OBJ_TABLE_ID(EVAS_OBJ_TABLE_SUB_ID_COL_ROW_SIZE_GET), _col_row_size_get),
1606 EO_OP_FUNC(EVAS_OBJ_TABLE_ID(EVAS_OBJ_TABLE_SUB_ID_ITERATOR_NEW), _iterator_new),
1607 EO_OP_FUNC(EVAS_OBJ_TABLE_ID(EVAS_OBJ_TABLE_SUB_ID_ACCESSOR_NEW), _accessor_new),
1608 EO_OP_FUNC(EVAS_OBJ_TABLE_ID(EVAS_OBJ_TABLE_SUB_ID_CHILDREN_GET), _children_get),
1609 EO_OP_FUNC(EVAS_OBJ_TABLE_ID(EVAS_OBJ_TABLE_SUB_ID_MIRRORED_GET), _mirrored_get),
1610 EO_OP_FUNC(EVAS_OBJ_TABLE_ID(EVAS_OBJ_TABLE_SUB_ID_MIRRORED_SET), _mirrored_set),
1611 EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_ADD), _smart_add),
1612 EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_DEL), _smart_del),
1613 EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_RESIZE), _smart_resize),
1614 EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_CALCULATE), _smart_calculate),
1615 EO_OP_FUNC_SENTINEL
1616 };
1617 eo_class_funcs_set(klass, func_desc);
1618
1619 evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
1620} 1388}
1621static const Eo_Op_Description op_desc[] = {
1622 EO_OP_DESCRIPTION(EVAS_OBJ_TABLE_SUB_ID_ADD_TO, "Create a table that is child of a given element parent."),
1623 EO_OP_DESCRIPTION(EVAS_OBJ_TABLE_SUB_ID_HOMOGENEOUS_SET, "Set how this table should layout children."),
1624 EO_OP_DESCRIPTION(EVAS_OBJ_TABLE_SUB_ID_HOMOGENEOUS_GET, "Get the current layout homogeneous mode."),
1625 EO_OP_DESCRIPTION(EVAS_OBJ_TABLE_SUB_ID_ALIGN_SET, "Set the alignment of the whole bounding box of contents."),
1626 EO_OP_DESCRIPTION(EVAS_OBJ_TABLE_SUB_ID_ALIGN_GET, "Get alignment of the whole bounding box of contents."),
1627 EO_OP_DESCRIPTION(EVAS_OBJ_TABLE_SUB_ID_PADDING_SET, "Set padding between cells."),
1628 EO_OP_DESCRIPTION(EVAS_OBJ_TABLE_SUB_ID_PADDING_GET, "Get padding between cells."),
1629 EO_OP_DESCRIPTION(EVAS_OBJ_TABLE_SUB_ID_PACK_GET, "Get packing location of a child of table."),
1630 EO_OP_DESCRIPTION(EVAS_OBJ_TABLE_SUB_ID_PACK, "Add a new child to a table object or set its current packing."),
1631 EO_OP_DESCRIPTION(EVAS_OBJ_TABLE_SUB_ID_UNPACK, "Remove child from table."),
1632 EO_OP_DESCRIPTION(EVAS_OBJ_TABLE_SUB_ID_CLEAR, "Faster way to remove all child objects from a table object."),
1633 EO_OP_DESCRIPTION(EVAS_OBJ_TABLE_SUB_ID_COL_ROW_SIZE_GET, "Get the number of columns and rows this table takes."),
1634 EO_OP_DESCRIPTION(EVAS_OBJ_TABLE_SUB_ID_ITERATOR_NEW, "Get an iterator to walk the list of children for the table."),
1635 EO_OP_DESCRIPTION(EVAS_OBJ_TABLE_SUB_ID_ACCESSOR_NEW, "Get an accessor to get random access to the list of children for the table."),
1636 EO_OP_DESCRIPTION(EVAS_OBJ_TABLE_SUB_ID_CHILDREN_GET, "Get the list of children for the table."),
1637 EO_OP_DESCRIPTION(EVAS_OBJ_TABLE_SUB_ID_MIRRORED_GET, "Gets the mirrored mode of the table."),
1638 EO_OP_DESCRIPTION(EVAS_OBJ_TABLE_SUB_ID_MIRRORED_SET, "Sets the mirrored mode of the table."),
1639 EO_OP_DESCRIPTION_SENTINEL
1640};
1641static const Eo_Class_Description class_desc = {
1642 EO_VERSION,
1643 MY_CLASS_NAME,
1644 EO_CLASS_TYPE_REGULAR,
1645 EO_CLASS_DESCRIPTION_OPS(&EVAS_OBJ_TABLE_BASE_ID, op_desc, EVAS_OBJ_TABLE_SUB_ID_LAST),
1646 NULL,
1647 sizeof(Evas_Object_Table_Data),
1648 _class_constructor,
1649 NULL
1650};
1651
1652EO_DEFINE_CLASS(evas_object_table_class_get, &class_desc, EVAS_OBJ_SMART_CLIPPED_CLASS, NULL);
1653 1389
1390#include "canvas/evas_table.eo.c"