evas_object_table.c | evas_object_table.c | |||
---|---|---|---|---|
skipping to change at line 36 | skipping to change at line 36 | |||
Eina_Bool fill_v : 1; | Eina_Bool fill_v : 1; | |||
}; | }; | |||
struct _Evas_Object_Table_Cache | struct _Evas_Object_Table_Cache | |||
{ | { | |||
struct { | struct { | |||
struct { | struct { | |||
double h, v; | double h, v; | |||
} weights; | } weights; | |||
struct { | struct { | |||
int h, v; | int h, v; | |||
} expands; | } expands; | |||
struct { | struct { | |||
Evas_Coord w, h; | Evas_Coord w, h; | |||
} min; | } min; | |||
} total; | } total; | |||
struct { | struct { | |||
double *h, *v; | double *h, *v; | |||
} weights; | } weights; | |||
struct { | struct { | |||
Evas_Coord *h, *v; | Evas_Coord *h, *v; | |||
} sizes; | } sizes; | |||
struct { | struct { | |||
Eina_Bool *h, *v; | Eina_Bool *h, *v; | |||
skipping to change at line 91 | skipping to change at line 91 | |||
}; | }; | |||
struct _Evas_Object_Table_Accessor | struct _Evas_Object_Table_Accessor | |||
{ | { | |||
Eina_Accessor accessor; | Eina_Accessor accessor; | |||
Eina_Accessor *real_accessor; | Eina_Accessor *real_accessor; | |||
const Evas_Object *table; | const Evas_Object *table; | |||
}; | }; | |||
#define EVAS_OBJECT_TABLE_DATA_GET(o, ptr) \ | #define EVAS_OBJECT_TABLE_DATA_GET(o, ptr) \ | |||
Evas_Object_Table_Data *ptr = evas_object_smart_data_get(o) | Evas_Object_Table_Data *ptr = evas_object_smart_data_get(o) | |||
#define EVAS_OBJECT_TABLE_DATA_GET_OR_RETURN(o, ptr) \ | #define EVAS_OBJECT_TABLE_DATA_GET_OR_RETURN(o, ptr) \ | |||
EVAS_OBJECT_TABLE_DATA_GET(o, ptr); \ | EVAS_OBJECT_TABLE_DATA_GET(o, ptr); \ | |||
if (!ptr) \ | if (!ptr) \ | |||
{ \ | { \ | |||
CRIT("no widget data for object %p (%s)", \ | CRIT("no widget data for object %p (%s)", \ | |||
o, evas_object_type_get(o)); \ | o, evas_object_type_get(o)); \ | |||
abort(); | return; \ | |||
\ | } | |||
return; \ | ||||
} | #define EVAS_OBJECT_TABLE_DATA_GET_OR_RETURN_VAL(o, ptr, val) \ | |||
EVAS_OBJECT_TABLE_DATA_GET(o, ptr); \ | ||||
#define EVAS_OBJECT_TABLE_DATA_GET_OR_RETURN_VAL(o, ptr, val) \ | if (!ptr) \ | |||
EVAS_OBJECT_TABLE_DATA_GET(o, ptr); \ | { \ | |||
if (!ptr) \ | CRIT("No widget data for object %p (%s)", \ | |||
{ \ | o, evas_object_type_get(o)); \ | |||
CRIT("No widget data for object %p (%s)", \ | return val; \ | |||
o, evas_object_type_get(o)); \ | } | |||
abort(); | ||||
\ | ||||
return val; \ | ||||
} | ||||
static const char EVAS_OBJECT_TABLE_OPTION_KEY[] = "|EvTb"; | static const char EVAS_OBJECT_TABLE_OPTION_KEY[] = "|EvTb"; | |||
static Eina_Bool | static Eina_Bool | |||
_evas_object_table_iterator_next(Evas_Object_Table_Iterator *it, void **dat a) | _evas_object_table_iterator_next(Evas_Object_Table_Iterator *it, void **dat a) | |||
{ | { | |||
Evas_Object_Table_Option *opt; | Evas_Object_Table_Option *opt; | |||
if (!eina_iterator_next(it->real_iterator, (void **)&opt)) | if (!eina_iterator_next(it->real_iterator, (void **)&opt)) | |||
return EINA_FALSE; | return EINA_FALSE; | |||
skipping to change at line 176 | skipping to change at line 174 | |||
{ | { | |||
Evas_Object_Table_Cache *cache; | Evas_Object_Table_Cache *cache; | |||
int size; | int size; | |||
size = sizeof(Evas_Object_Table_Cache) + | size = sizeof(Evas_Object_Table_Cache) + | |||
((cols + rows) * | ((cols + rows) * | |||
(sizeof(double) + sizeof(Evas_Coord) + sizeof(Eina_Bool))); | (sizeof(double) + sizeof(Evas_Coord) + sizeof(Eina_Bool))); | |||
cache = malloc(size); | cache = malloc(size); | |||
if (!cache) | if (!cache) | |||
{ | { | |||
ERR("Could not allocate table cache %dx%d (%d bytes): %s", | ERR("Could not allocate table cache %dx%d (%d bytes): %s", | |||
cols, rows, size, strerror(errno)); | cols, rows, size, strerror(errno)); | |||
return NULL; | return NULL; | |||
} | } | |||
cache->weights.h = (double *)(cache + 1); | cache->weights.h = (double *)(cache + 1); | |||
cache->weights.v = (double *)(cache->weights.h + cols); | cache->weights.v = (double *)(cache->weights.h + cols); | |||
cache->sizes.h = (Evas_Coord *)(cache->weights.v + rows); | cache->sizes.h = (Evas_Coord *)(cache->weights.v + rows); | |||
cache->sizes.v = (Evas_Coord *)(cache->sizes.h + cols); | cache->sizes.v = (Evas_Coord *)(cache->sizes.h + cols); | |||
cache->expands.h = (Eina_Bool *)(cache->sizes.v + rows); | cache->expands.h = (Eina_Bool *)(cache->sizes.v + rows); | |||
cache->expands.v = (Eina_Bool *)(cache->expands.h + cols); | cache->expands.v = (Eina_Bool *)(cache->expands.h + cols); | |||
return cache; | return cache; | |||
skipping to change at line 209 | skipping to change at line 207 | |||
{ | { | |||
Evas_Object_Table_Cache *c = priv->cache; | Evas_Object_Table_Cache *c = priv->cache; | |||
int size; | int size; | |||
c->total.expands.v = 0; | c->total.expands.v = 0; | |||
c->total.expands.h = 0; | c->total.expands.h = 0; | |||
c->total.min.w = 0; | c->total.min.w = 0; | |||
c->total.min.h = 0; | c->total.min.h = 0; | |||
size = ((priv->size.rows + priv->size.cols) * | size = ((priv->size.rows + priv->size.cols) * | |||
(sizeof(double) + sizeof(Evas_Coord) + sizeof(Eina_Bool))); | (sizeof(double) + sizeof(Evas_Coord) + sizeof(Eina_Bool))); | |||
memset(c + 1, 0, size); | memset(c + 1, 0, size); | |||
} | } | |||
static void | static void | |||
_evas_object_table_cache_invalidate(Evas_Object_Table_Data *priv) | _evas_object_table_cache_invalidate(Evas_Object_Table_Data *priv) | |||
{ | { | |||
priv->hints_changed = 1; | priv->hints_changed = 1; | |||
if (priv->cache) | if (priv->cache) | |||
{ | { | |||
_evas_object_table_cache_free(priv->cache); | _evas_object_table_cache_free(priv->cache); | |||
priv->cache = NULL; | priv->cache = NULL; | |||
} | } | |||
} | } | |||
static Evas_Object_Table_Option * | static Evas_Object_Table_Option * | |||
_evas_object_table_option_get(Evas_Object *o) | _evas_object_table_option_get(Evas_Object *o) | |||
{ | { | |||
return evas_object_data_get(o, EVAS_OBJECT_TABLE_OPTION_KEY); | return evas_object_data_get(o, EVAS_OBJECT_TABLE_OPTION_KEY); | |||
} | } | |||
static void | static void | |||
skipping to change at line 304 | skipping to change at line 302 | |||
else if ((opt->max.h > -1) && (*h > opt->max.h)) | else if ((opt->max.h > -1) && (*h > opt->max.h)) | |||
ch = opt->max.h; | ch = opt->max.h; | |||
else if (opt->fill_v) | else if (opt->fill_v) | |||
ch = *h; | ch = *h; | |||
else | else | |||
ch = opt->min.h; | ch = opt->min.h; | |||
*x += opt->pad.l; | *x += opt->pad.l; | |||
if (cw != *w) | if (cw != *w) | |||
{ | { | |||
*x += (*w - cw) * opt->align.h; | *x += (*w - cw) * opt->align.h; | |||
*w = cw; | *w = cw; | |||
} | } | |||
*y += opt->pad.t; | *y += opt->pad.t; | |||
if (ch != *h) | if (ch != *h) | |||
{ | { | |||
*y += (*h - ch) * opt->align.v; | *y += (*h - ch) * opt->align.v; | |||
*h = ch; | *h = ch; | |||
} | } | |||
} | } | |||
static void | static void | |||
_evas_object_table_calculate_hints_homogeneous(Evas_Object *o, Evas_Object_ Table_Data *priv) | _evas_object_table_calculate_hints_homogeneous(Evas_Object *o, Evas_Object_ Table_Data *priv) | |||
{ | { | |||
Eina_List *l; | Eina_List *l; | |||
Evas_Object_Table_Option *opt; | Evas_Object_Table_Option *opt; | |||
Evas_Coord minw, minh, o_minw, o_minh; | Evas_Coord minw, minh, o_minw, o_minh; | |||
Eina_Bool expand_h, expand_v; | Eina_Bool expand_h, expand_v; | |||
o_minw = 0; | o_minw = 0; | |||
o_minh = 0; | o_minh = 0; | |||
minw = 0; | minw = 0; | |||
minh = 0; | minh = 0; | |||
expand_h = 0; | expand_h = 0; | |||
expand_v = 0; | expand_v = 0; | |||
EINA_LIST_FOREACH(priv->children, l, opt) | EINA_LIST_FOREACH(priv->children, l, opt) | |||
{ | { | |||
Evas_Object *child = opt->obj; | Evas_Object *child = opt->obj; | |||
Evas_Coord child_minw, child_minh, cell_minw, cell_minh; | Evas_Coord child_minw, child_minh, cell_minw, cell_minh; | |||
double weightw, weighth; | double weightw, weighth; | |||
evas_object_size_hint_min_get(child, &opt->min.w, &opt->min.h); | evas_object_size_hint_min_get(child, &opt->min.w, &opt->min.h); | |||
evas_object_size_hint_max_get(child, &opt->max.w, &opt->max.h); | evas_object_size_hint_max_get(child, &opt->max.w, &opt->max.h); | |||
evas_object_size_hint_padding_get | evas_object_size_hint_padding_get | |||
(child, &opt->pad.l, &opt->pad.r, &opt->pad.t, &opt->pad.b); | (child, &opt->pad.l, &opt->pad.r, &opt->pad.t, &opt->pad.b); | |||
evas_object_size_hint_align_get(child, &opt->align.h, &opt->align.v) | evas_object_size_hint_align_get(child, &opt->align.h, &opt->align.v | |||
; | ); | |||
evas_object_size_hint_weight_get(child, &weightw, &weighth); | evas_object_size_hint_weight_get(child, &weightw, &weighth); | |||
child_minw = opt->min.w + opt->pad.l + opt->pad.r; | child_minw = opt->min.w + opt->pad.l + opt->pad.r; | |||
child_minh = opt->min.h + opt->pad.t + opt->pad.b; | child_minh = opt->min.h + opt->pad.t + opt->pad.b; | |||
cell_minw = (child_minw + opt->colspan - 1) / opt->colspan; | cell_minw = (child_minw + opt->colspan - 1) / opt->colspan; | |||
cell_minh = (child_minh + opt->rowspan - 1) / opt->rowspan; | cell_minh = (child_minh + opt->rowspan - 1) / opt->rowspan; | |||
opt->expand_h = 0; | opt->expand_h = 0; | |||
if ((weightw > 0.0) && | if ((weightw > 0.0) && | |||
((opt->max.w < 0) || | ((opt->max.w < 0) || | |||
((opt->max.w > -1) && (opt->min.w < opt->max.w)))) | ((opt->max.w > -1) && (opt->min.w < opt->max.w)))) | |||
{ | { | |||
opt->expand_h = 1; | opt->expand_h = 1; | |||
expand_h = 1; | expand_h = 1; | |||
} | } | |||
opt->expand_v = 0; | opt->expand_v = 0; | |||
if ((weighth > 0.0) && | if ((weighth > 0.0) && | |||
((opt->max.h < 0) || | ((opt->max.h < 0) || | |||
((opt->max.h > -1) && (opt->min.h < opt->max.h)))) | ((opt->max.h > -1) && (opt->min.h < opt->max.h)))) | |||
{ | { | |||
opt->expand_v = 1; | opt->expand_v = 1; | |||
expand_v = 1; | expand_v = 1; | |||
} | } | |||
opt->fill_h = 0; | opt->fill_h = 0; | |||
if (opt->align.h < 0.0) | if (opt->align.h < 0.0) | |||
{ | { | |||
opt->align.h = 0.5; | opt->align.h = 0.5; | |||
opt->fill_h = 1; | opt->fill_h = 1; | |||
} | } | |||
opt->fill_v = 0; | opt->fill_v = 0; | |||
if (opt->align.v < 0.0) | if (opt->align.v < 0.0) | |||
{ | { | |||
opt->align.v = 0.5; | opt->align.v = 0.5; | |||
opt->fill_v = 1; | opt->fill_v = 1; | |||
} | } | |||
/* greatest mininum values, with paddings */ | /* greatest mininum values, with paddings */ | |||
if (minw < cell_minw) | if (minw < cell_minw) | |||
minw = cell_minw; | minw = cell_minw; | |||
if (minh < cell_minh) | if (minh < cell_minh) | |||
minh = cell_minh; | minh = cell_minh; | |||
/* greatest mininum values, without paddings */ | /* greatest mininum values, without paddings */ | |||
if (o_minw < opt->min.w) | if (o_minw < opt->min.w) | |||
o_minw = opt->min.w; | o_minw = opt->min.w; | |||
if (o_minh < opt->min.h) | if (o_minh < opt->min.h) | |||
o_minh = opt->min.h; | o_minh = opt->min.h; | |||
} | } | |||
if (priv->homogeneous == EVAS_OBJECT_TABLE_HOMOGENEOUS_ITEM) | if (priv->homogeneous == EVAS_OBJECT_TABLE_HOMOGENEOUS_ITEM) | |||
{ | { | |||
if (o_minw < 1) | if (o_minw < 1) | |||
{ | { | |||
ERR("homogeneous table based on item size but no " | ERR("homogeneous table based on item size but no " | |||
"horizontal mininum size specified! Using expand."); | "horizontal mininum size specified! Using expand."); | |||
expand_h = 1; | expand_h = 1; | |||
} | } | |||
if (o_minh < 1) | if (o_minh < 1) | |||
{ | { | |||
ERR("homogeneous table based on item size but no " | ERR("homogeneous table based on item size but no " | |||
"vertical mininum size specified! Using expand."); | "vertical mininum size specified! Using expand."); | |||
expand_v = 1; | expand_v = 1; | |||
} | } | |||
} | } | |||
minw = priv->size.cols * (minw + priv->pad.h) - priv->pad.h; | minw = priv->size.cols * (minw + priv->pad.h) - priv->pad.h; | |||
minh = priv->size.rows * (minh + priv->pad.v) - priv->pad.v; | minh = priv->size.rows * (minh + priv->pad.v) - priv->pad.v; | |||
priv->hints_changed = 0; | priv->hints_changed = 0; | |||
priv->expand_h = expand_h; | priv->expand_h = expand_h; | |||
priv->expand_v = expand_v; | priv->expand_v = expand_v; | |||
if ((minw > 0 ) || (minh > 0)) | if ((minw > 0 ) || (minh > 0)) | |||
skipping to change at line 436 | skipping to change at line 434 | |||
Eina_Bool expand_h, expand_v; | Eina_Bool expand_h, expand_v; | |||
evas_object_size_hint_min_get(o, &minw, &minh); | evas_object_size_hint_min_get(o, &minw, &minh); | |||
expand_h = priv->expand_h; | expand_h = priv->expand_h; | |||
expand_v = priv->expand_v; | expand_v = priv->expand_v; | |||
if (*w < minw) | if (*w < minw) | |||
expand_h = 0; | expand_h = 0; | |||
if (!expand_h) | if (!expand_h) | |||
{ | { | |||
*x += (*w - minw) * priv->align.h; | *x += (*w - minw) * priv->align.h; | |||
*w = minw; | *w = minw; | |||
} | } | |||
if (*h < minh) | if (*h < minh) | |||
expand_v = 0; | expand_v = 0; | |||
if (!expand_v) | if (!expand_v) | |||
{ | { | |||
*y += (*h - minh) * priv->align.v; | *y += (*h - minh) * priv->align.v; | |||
*h = minh; | *h = minh; | |||
} | } | |||
} | } | |||
static void | static void | |||
_evas_object_table_calculate_layout_homogeneous_sizes(const Evas_Object *o, const Evas_Object_Table_Data *priv, Evas_Coord *x, Evas_Coord *y, Evas_Coo rd *w, Evas_Coord *h, Evas_Coord *cellw, Evas_Coord *cellh) | _evas_object_table_calculate_layout_homogeneous_sizes(const Evas_Object *o, const Evas_Object_Table_Data *priv, Evas_Coord *x, Evas_Coord *y, Evas_Coo rd *w, Evas_Coord *h, Evas_Coord *cellw, Evas_Coord *cellh) | |||
{ | { | |||
evas_object_geometry_get(o, x, y, w, h); | evas_object_geometry_get(o, x, y, w, h); | |||
if (priv->homogeneous == EVAS_OBJECT_TABLE_HOMOGENEOUS_ITEM) | if (priv->homogeneous == EVAS_OBJECT_TABLE_HOMOGENEOUS_ITEM) | |||
_evas_object_table_calculate_layout_homogeneous_sizes_item | _evas_object_table_calculate_layout_homogeneous_sizes_item | |||
(o, priv, x, y, w, h); | (o, priv, x, y, w, h); | |||
skipping to change at line 469 | skipping to change at line 467 | |||
} | } | |||
static void | static void | |||
_evas_object_table_calculate_layout_homogeneous(Evas_Object *o, Evas_Object _Table_Data *priv) | _evas_object_table_calculate_layout_homogeneous(Evas_Object *o, Evas_Object _Table_Data *priv) | |||
{ | { | |||
Evas_Coord x = 0, y = 0, w = 0, h = 0, ww, hh, cellw = 0, cellh = 0; | Evas_Coord x = 0, y = 0, w = 0, h = 0, ww, hh, cellw = 0, cellh = 0; | |||
Eina_List *l; | Eina_List *l; | |||
Evas_Object_Table_Option *opt; | Evas_Object_Table_Option *opt; | |||
_evas_object_table_calculate_layout_homogeneous_sizes | _evas_object_table_calculate_layout_homogeneous_sizes | |||
(o, priv, &x, &y, &w, &h, &cellw, &cellh); | (o, priv, &x, &y, &w, &h, &cellw, &cellh); | |||
ww = w - ((priv->size.cols - 1) * priv->pad.h); | ww = w - ((priv->size.cols - 1) * priv->pad.h); | |||
hh = h - ((priv->size.rows - 1) * priv->pad.v); | hh = h - ((priv->size.rows - 1) * priv->pad.v); | |||
if (ww < 0) ww = 0; | if (ww < 0) ww = 0; | |||
if (ww < 0) ww = 0; | if (ww < 0) ww = 0; | |||
EINA_LIST_FOREACH(priv->children, l, opt) | EINA_LIST_FOREACH(priv->children, l, opt) | |||
{ | { | |||
Evas_Object *child = opt->obj; | Evas_Object *child = opt->obj; | |||
Evas_Coord cx, cy, cw, ch, cox, coy, cow, coh; | Evas_Coord cx, cy, cw, ch, cox, coy, cow, coh; | |||
cx = x + ((opt->col * ww) / priv->size.cols); | cx = x + ((opt->col * ww) / priv->size.cols); | |||
cw = x + (((opt->col + opt->colspan) * ww) / priv->size.cols) - cx; | cw = x + (((opt->col + opt->colspan) * ww) / priv->size.cols) - cx; | |||
cy = y + ((opt->row * hh) / priv->size.rows); | cy = y + ((opt->row * hh) / priv->size.rows); | |||
ch = y + (((opt->row + opt->rowspan) * hh) / priv->size.rows) - cy; | ch = y + (((opt->row + opt->rowspan) * hh) / priv->size.rows) - cy; | |||
cx += (opt->col) * priv->pad.h; | cx += (opt->col) * priv->pad.h; | |||
cy += (opt->row) * priv->pad.v; | cy += (opt->row) * priv->pad.v; | |||
cox = cx; | cox = cx; | |||
coy = cy; | coy = cy; | |||
cow = cw; | cow = cw; | |||
coh = ch; | coh = ch; | |||
_evas_object_table_calculate_cell(opt, &cx, &cy, &cw, &ch); | _evas_object_table_calculate_cell(opt, &cx, &cy, &cw, &ch); | |||
if (cw > cow) | if (cw > cow) | |||
{ | { | |||
cx = cox; | cx = cox; | |||
cw = cow; | cw = cow; | |||
} | } | |||
if (ch > coh) | if (ch > coh) | |||
{ | { | |||
cy = coy; | cy = coy; | |||
ch = coh; | ch = coh; | |||
} | } | |||
if (priv->is_mirrored) | if (priv->is_mirrored) | |||
{ | { | |||
evas_object_move(opt->obj, x + w - (cx - x + cw), cy); | evas_object_move(opt->obj, x + w - (cx - x + cw), cy); | |||
} | } | |||
else | else | |||
{ | { | |||
evas_object_move(child, cx, cy); | evas_object_move(child, cx, cy); | |||
} | } | |||
evas_object_resize(child, cw, ch); | evas_object_resize(child, cw, ch); | |||
} | } | |||
} | } | |||
static void | static void | |||
_evas_object_table_smart_calculate_homogeneous(Evas_Object *o, Evas_Object_ Table_Data *priv) | _evas_object_table_smart_calculate_homogeneous(Evas_Object *o, Evas_Object_ Table_Data *priv) | |||
{ | { | |||
if (priv->hints_changed) | if (priv->hints_changed) | |||
_evas_object_table_calculate_hints_homogeneous(o, priv); | _evas_object_table_calculate_hints_homogeneous(o, priv); | |||
_evas_object_table_calculate_layout_homogeneous(o, priv); | _evas_object_table_calculate_layout_homogeneous(o, priv); | |||
} | } | |||
skipping to change at line 633 | skipping to change at line 631 | |||
_evas_object_table_calculate_hints_regular(Evas_Object *o, Evas_Object_Tabl e_Data *priv) | _evas_object_table_calculate_hints_regular(Evas_Object *o, Evas_Object_Tabl e_Data *priv) | |||
{ | { | |||
Evas_Object_Table_Option *opt; | Evas_Object_Table_Option *opt; | |||
Evas_Object_Table_Cache *c; | Evas_Object_Table_Cache *c; | |||
Eina_List *l; | Eina_List *l; | |||
double totweightw = 0.0, totweighth = 0.0; | double totweightw = 0.0, totweighth = 0.0; | |||
int i; | int i; | |||
if (!priv->cache) | if (!priv->cache) | |||
{ | { | |||
priv->cache = _evas_object_table_cache_alloc | priv->cache = _evas_object_table_cache_alloc | |||
(priv->size.cols, priv->size.rows); | (priv->size.cols, priv->size.rows); | |||
if (!priv->cache) | if (!priv->cache) | |||
return; | return; | |||
} | } | |||
c = priv->cache; | c = priv->cache; | |||
_evas_object_table_cache_reset(priv); | _evas_object_table_cache_reset(priv); | |||
/* cache interesting data */ | /* cache interesting data */ | |||
memset(c->expands.h, 1, priv->size.cols); | memset(c->expands.h, 1, priv->size.cols); | |||
memset(c->expands.v, 1, priv->size.rows); | memset(c->expands.v, 1, priv->size.rows); | |||
memset(c->weights.h, 0, priv->size.cols); | memset(c->weights.h, 0, priv->size.cols); | |||
memset(c->weights.v, 0, priv->size.rows); | memset(c->weights.v, 0, priv->size.rows); | |||
EINA_LIST_FOREACH(priv->children, l, opt) | EINA_LIST_FOREACH(priv->children, l, opt) | |||
{ | { | |||
Evas_Object *child = opt->obj; | Evas_Object *child = opt->obj; | |||
double weightw, weighth; | double weightw, weighth; | |||
evas_object_size_hint_min_get(child, &opt->min.w, &opt->min.h); | evas_object_size_hint_min_get(child, &opt->min.w, &opt->min.h); | |||
evas_object_size_hint_max_get(child, &opt->max.w, &opt->max.h); | evas_object_size_hint_max_get(child, &opt->max.w, &opt->max.h); | |||
evas_object_size_hint_padding_get | evas_object_size_hint_padding_get | |||
(child, &opt->pad.l, &opt->pad.r, &opt->pad.t, &opt->pad.b); | (child, &opt->pad.l, &opt->pad.r, &opt->pad.t, &opt->pad.b); | |||
evas_object_size_hint_align_get(child, &opt->align.h, &opt->align.v) | evas_object_size_hint_align_get(child, &opt->align.h, &opt->align.v | |||
; | ); | |||
evas_object_size_hint_weight_get(child, &weightw, &weighth); | evas_object_size_hint_weight_get(child, &weightw, &weighth); | |||
opt->expand_h = 0; | opt->expand_h = 0; | |||
if ((weightw > 0.0) && | if ((weightw > 0.0) && | |||
((opt->max.w < 0) || | ((opt->max.w < 0) || | |||
((opt->max.w > -1) && (opt->min.w < opt->max.w)))) | ((opt->max.w > -1) && (opt->min.w < opt->max.w)))) | |||
opt->expand_h = 1; | opt->expand_h = 1; | |||
opt->expand_v = 0; | opt->expand_v = 0; | |||
if ((weighth > 0.0) && | if ((weighth > 0.0) && | |||
((opt->max.h < 0) || | ((opt->max.h < 0) || | |||
((opt->max.h > -1) && (opt->min.h < opt->max.h)))) | ((opt->max.h > -1) && (opt->min.h < opt->max.h)))) | |||
opt->expand_v = 1; | opt->expand_v = 1; | |||
opt->fill_h = 0; | opt->fill_h = 0; | |||
if (opt->align.h < 0.0) | if (opt->align.h < 0.0) | |||
{ | { | |||
opt->align.h = 0.5; | opt->align.h = 0.5; | |||
opt->fill_h = 1; | opt->fill_h = 1; | |||
} | } | |||
opt->fill_v = 0; | opt->fill_v = 0; | |||
if (opt->align.v < 0.0) | if (opt->align.v < 0.0) | |||
{ | { | |||
opt->align.v = 0.5; | opt->align.v = 0.5; | |||
opt->fill_v = 1; | opt->fill_v = 1; | |||
} | } | |||
if (!opt->expand_h) | if (!opt->expand_h) | |||
memset(c->expands.h + opt->col, 0, opt->colspan); | memset(c->expands.h + opt->col, 0, opt->colspan); | |||
else | else | |||
{ | { | |||
for (i = opt->col; i < opt->col + opt->colspan; i++) | for (i = opt->col; i < opt->col + opt->colspan; i++) | |||
c->weights.h[i] += (weightw / (double)opt->colspan); | c->weights.h[i] += (weightw / (double)opt->colspan); | |||
} | } | |||
if (!opt->expand_v) | if (!opt->expand_v) | |||
memset(c->expands.v + opt->row, 0, opt->rowspan); | memset(c->expands.v + opt->row, 0, opt->rowspan); | |||
else | else | |||
{ | { | |||
for (i = opt->row; i < opt->row + opt->rowspan; i++) | for (i = opt->row; i < opt->row + opt->rowspan; i++) | |||
c->weights.v[i] += (weighth / (double)opt->rowspan); | c->weights.v[i] += (weighth / (double)opt->rowspan); | |||
} | } | |||
} | } | |||
for (i = 0; i < priv->size.cols; i++) totweightw += c->weights.h[i]; | for (i = 0; i < priv->size.cols; i++) totweightw += c->weights.h[i]; | |||
for (i = 0; i < priv->size.rows; i++) totweighth += c->weights.v[i]; | for (i = 0; i < priv->size.rows; i++) totweighth += c->weights.v[i]; | |||
/* calculate sizes for each row and column */ | /* calculate sizes for each row and column */ | |||
EINA_LIST_FOREACH(priv->children, l, opt) | EINA_LIST_FOREACH(priv->children, l, opt) | |||
{ | { | |||
Evas_Coord tot, need; | Evas_Coord tot, need; | |||
/* handle horizontal */ | ||||
tot = _evas_object_table_sum_sizes(c->sizes.h, opt->col, opt->end_c | ||||
ol); | ||||
need = opt->min.w + opt->pad.l + opt->pad.r; | ||||
if (tot < need) | ||||
{ | ||||
Evas_Coord space = need - tot; | ||||
int count; | ||||
/* handle horizontal */ | count = _evas_object_table_count_expands | |||
tot = _evas_object_table_sum_sizes(c->sizes.h, opt->col, opt->end_co | (c->expands.h, opt->col, opt->end_col); | |||
l); | ||||
need = opt->min.w + opt->pad.l + opt->pad.r; | if (count > 0) | |||
if (tot < need) | _evas_object_table_sizes_calc_expand | |||
{ | (c->sizes.h, opt->col, opt->end_col, space, | |||
Evas_Coord space = need - tot; | c->expands.h, count, c->weights.h, totweightw); | |||
int count; | else | |||
_evas_object_table_sizes_calc_noexpand | ||||
count = _evas_object_table_count_expands | (c->sizes.h, opt->col, opt->end_col, space); | |||
(c->expands.h, opt->col, opt->end_col); | } | |||
if (count > 0) | /* handle vertical */ | |||
_evas_object_table_sizes_calc_expand | tot = _evas_object_table_sum_sizes(c->sizes.v, opt->row, opt->end_r | |||
(c->sizes.h, opt->col, opt->end_col, space, | ow); | |||
c->expands.h, count, c->weights.h, totweightw); | need = opt->min.h + opt->pad.t + opt->pad.b; | |||
else | if (tot < opt->min.h) | |||
_evas_object_table_sizes_calc_noexpand | { | |||
(c->sizes.h, opt->col, opt->end_col, space); | Evas_Coord space = need - tot; | |||
} | int count; | |||
/* handle vertical */ | count = _evas_object_table_count_expands | |||
tot = _evas_object_table_sum_sizes(c->sizes.v, opt->row, opt->end_ro | (c->expands.v, opt->row, opt->end_row); | |||
w); | ||||
need = opt->min.h + opt->pad.t + opt->pad.b; | if (count > 0) | |||
if (tot < opt->min.h) | _evas_object_table_sizes_calc_expand | |||
{ | (c->sizes.v, opt->row, opt->end_row, space, | |||
Evas_Coord space = need - tot; | c->expands.v, count, c->weights.v, totweighth); | |||
int count; | else | |||
_evas_object_table_sizes_calc_noexpand | ||||
count = _evas_object_table_count_expands | (c->sizes.v, opt->row, opt->end_row, space); | |||
(c->expands.v, opt->row, opt->end_row); | } | |||
if (count > 0) | ||||
_evas_object_table_sizes_calc_expand | ||||
(c->sizes.v, opt->row, opt->end_row, space, | ||||
c->expands.v, count, c->weights.v, totweighth); | ||||
else | ||||
_evas_object_table_sizes_calc_noexpand | ||||
(c->sizes.v, opt->row, opt->end_row, space); | ||||
} | ||||
} | } | |||
c->total.weights.h = totweightw; | c->total.weights.h = totweightw; | |||
c->total.weights.v = totweighth; | c->total.weights.v = totweighth; | |||
c->total.expands.h = _evas_object_table_count_expands | c->total.expands.h = _evas_object_table_count_expands | |||
(c->expands.h, 0, priv->size.cols); | (c->expands.h, 0, priv->size.cols); | |||
c->total.expands.v = _evas_object_table_count_expands | c->total.expands.v = _evas_object_table_count_expands | |||
(c->expands.v, 0, priv->size.rows); | (c->expands.v, 0, priv->size.rows); | |||
c->total.min.w = _evas_object_table_sum_sizes | c->total.min.w = _evas_object_table_sum_sizes | |||
(c->sizes.h, 0, priv->size.cols); | (c->sizes.h, 0, priv->size.cols); | |||
c->total.min.h = _evas_object_table_sum_sizes | c->total.min.h = _evas_object_table_sum_sizes | |||
(c->sizes.v, 0, priv->size.rows); | (c->sizes.v, 0, priv->size.rows); | |||
c->total.min.w += priv->pad.h * (priv->size.cols - 1); | c->total.min.w += priv->pad.h * (priv->size.cols - 1); | |||
c->total.min.h += priv->pad.v * (priv->size.rows - 1); | c->total.min.h += priv->pad.v * (priv->size.rows - 1); | |||
skipping to change at line 784 | skipping to change at line 782 | |||
Eina_List *l; | Eina_List *l; | |||
Evas_Coord *cols = NULL, *rows = NULL; | Evas_Coord *cols = NULL, *rows = NULL; | |||
Evas_Coord x, y, w, h; | Evas_Coord x, y, w, h; | |||
evas_object_geometry_get(o, &x, &y, &w, &h); | evas_object_geometry_get(o, &x, &y, &w, &h); | |||
c = priv->cache; | c = priv->cache; | |||
/* handle horizontal */ | /* handle horizontal */ | |||
if ((c->total.expands.h <= 0) || (c->total.min.w >= w)) | if ((c->total.expands.h <= 0) || (c->total.min.w >= w)) | |||
{ | { | |||
x += (w - c->total.min.w) * priv->align.h; | x += (w - c->total.min.w) * priv->align.h; | |||
w = c->total.min.w; | w = c->total.min.w; | |||
cols = c->sizes.h; | cols = c->sizes.h; | |||
} | } | |||
else | else | |||
{ | { | |||
int size = priv->size.cols * sizeof(Evas_Coord); | int size = priv->size.cols * sizeof(Evas_Coord); | |||
cols = malloc(size); | cols = malloc(size); | |||
if (!cols) | if (!cols) | |||
{ | { | |||
ERR("Could not allocate temp columns (%d bytes): %s", | ERR("Could not allocate temp columns (%d bytes): %s", | |||
size, strerror(errno)); | size, strerror(errno)); | |||
goto end; | goto end; | |||
} | } | |||
memcpy(cols, c->sizes.h, size); | memcpy(cols, c->sizes.h, size); | |||
_evas_object_table_sizes_calc_expand | _evas_object_table_sizes_calc_expand | |||
(cols, 0, priv->size.cols, w - c->total.min.w, | (cols, 0, priv->size.cols, w - c->total.min.w, | |||
c->expands.h, c->total.expands.h, c->weights.h, c->total.weights. | c->expands.h, c->total.expands.h, c->weights.h, c->total.weight | |||
h); | s.h); | |||
} | } | |||
/* handle vertical */ | /* handle vertical */ | |||
if ((c->total.expands.v <= 0) || (c->total.min.h >= h)) | if ((c->total.expands.v <= 0) || (c->total.min.h >= h)) | |||
{ | { | |||
y += (h - c->total.min.h) * priv->align.v; | y += (h - c->total.min.h) * priv->align.v; | |||
h = c->total.min.h; | h = c->total.min.h; | |||
rows = c->sizes.v; | rows = c->sizes.v; | |||
} | } | |||
else | else | |||
{ | { | |||
int size = priv->size.rows * sizeof(Evas_Coord); | int size = priv->size.rows * sizeof(Evas_Coord); | |||
rows = malloc(size); | rows = malloc(size); | |||
if (!rows) | if (!rows) | |||
{ | { | |||
ERR("could not allocate temp rows (%d bytes): %s", | ERR("could not allocate temp rows (%d bytes): %s", | |||
size, strerror(errno)); | size, strerror(errno)); | |||
goto end; | goto end; | |||
} | } | |||
memcpy(rows, c->sizes.v, size); | memcpy(rows, c->sizes.v, size); | |||
_evas_object_table_sizes_calc_expand | _evas_object_table_sizes_calc_expand | |||
(rows, 0, priv->size.rows, h - c->total.min.h, | (rows, 0, priv->size.rows, h - c->total.min.h, | |||
c->expands.v, c->total.expands.v, c->weights.v, c->total.weights. | c->expands.v, c->total.expands.v, c->weights.v, c->total.weight | |||
v); | s.v); | |||
} | } | |||
EINA_LIST_FOREACH(priv->children, l, opt) | EINA_LIST_FOREACH(priv->children, l, opt) | |||
{ | { | |||
Evas_Object *child = opt->obj; | Evas_Object *child = opt->obj; | |||
Evas_Coord cx, cy, cw, ch; | Evas_Coord cx, cy, cw, ch; | |||
cx = x + opt->col * (priv->pad.h); | cx = x + opt->col * (priv->pad.h); | |||
cx += _evas_object_table_sum_sizes(cols, 0, opt->col); | cx += _evas_object_table_sum_sizes(cols, 0, opt->col); | |||
cw = _evas_object_table_sum_sizes(cols, opt->col, opt->end_col); | cw = _evas_object_table_sum_sizes(cols, opt->col, opt->end_col); | |||
cy = y + opt->row * (priv->pad.v); | cy = y + opt->row * (priv->pad.v); | |||
cy += _evas_object_table_sum_sizes(rows, 0, opt->row); | cy += _evas_object_table_sum_sizes(rows, 0, opt->row); | |||
ch = _evas_object_table_sum_sizes(rows, opt->row, opt->end_row); | ch = _evas_object_table_sum_sizes(rows, opt->row, opt->end_row); | |||
_evas_object_table_calculate_cell(opt, &cx, &cy, &cw, &ch); | _evas_object_table_calculate_cell(opt, &cx, &cy, &cw, &ch); | |||
if (priv->is_mirrored) | if (priv->is_mirrored) | |||
{ | { | |||
evas_object_move(opt->obj, x + w - (cx - x + cw), cy); | evas_object_move(opt->obj, x + w - (cx - x + cw), cy); | |||
} | } | |||
else | else | |||
{ | { | |||
evas_object_move(child, cx, cy); | evas_object_move(child, cx, cy); | |||
} | } | |||
evas_object_resize(child, cw, ch); | evas_object_resize(child, cw, ch); | |||
} | } | |||
end: | end: | |||
if (cols != c->sizes.h) | if (cols != c->sizes.h) | |||
{ | { | |||
if (cols) free(cols); | if (cols) free(cols); | |||
} | } | |||
if (rows != c->sizes.v) | if (rows != c->sizes.v) | |||
{ | { | |||
if (rows) free(rows); | if (rows) free(rows); | |||
skipping to change at line 873 | skipping to change at line 871 | |||
static void | static void | |||
_evas_object_table_smart_calculate_regular(Evas_Object *o, Evas_Object_Tabl e_Data *priv) | _evas_object_table_smart_calculate_regular(Evas_Object *o, Evas_Object_Tabl e_Data *priv) | |||
{ | { | |||
if (priv->hints_changed) | if (priv->hints_changed) | |||
_evas_object_table_calculate_hints_regular(o, priv); | _evas_object_table_calculate_hints_regular(o, priv); | |||
_evas_object_table_calculate_layout_regular(o, priv); | _evas_object_table_calculate_layout_regular(o, priv); | |||
} | } | |||
EVAS_SMART_SUBCLASS_NEW("Evas_Object_Table", _evas_object_table, | EVAS_SMART_SUBCLASS_NEW("Evas_Object_Table", _evas_object_table, | |||
Evas_Smart_Class, Evas_Smart_Class, | Evas_Smart_Class, Evas_Smart_Class, | |||
evas_object_smart_clipped_class_get, NULL) | evas_object_smart_clipped_class_get, NULL) | |||
static void | static void | |||
_evas_object_table_smart_add(Evas_Object *o) | _evas_object_table_smart_add(Evas_Object *o) | |||
{ | { | |||
EVAS_SMART_DATA_ALLOC(o, Evas_Object_Table_Data) | EVAS_SMART_DATA_ALLOC(o, Evas_Object_Table_Data) | |||
priv->pad.h = 0; | priv->pad.h = 0; | |||
priv->pad.v = 0; | priv->pad.v = 0; | |||
priv->align.h = 0.5; | priv->align.h = 0.5; | |||
priv->align.v = 0.5; | priv->align.v = 0.5; | |||
skipping to change at line 905 | skipping to change at line 903 | |||
static void | static void | |||
_evas_object_table_smart_del(Evas_Object *o) | _evas_object_table_smart_del(Evas_Object *o) | |||
{ | { | |||
EVAS_OBJECT_TABLE_DATA_GET(o, priv); | EVAS_OBJECT_TABLE_DATA_GET(o, priv); | |||
Eina_List *l; | Eina_List *l; | |||
l = priv->children; | l = priv->children; | |||
while (l) | while (l) | |||
{ | { | |||
Evas_Object_Table_Option *opt = l->data; | Evas_Object_Table_Option *opt = l->data; | |||
_evas_object_table_child_disconnect(o, opt->obj); | _evas_object_table_child_disconnect(o, opt->obj); | |||
_evas_object_table_option_del(opt->obj); | _evas_object_table_option_del(opt->obj); | |||
free(opt); | free(opt); | |||
l = eina_list_remove_list(l, l); | l = eina_list_remove_list(l, l); | |||
} | } | |||
if (priv->cache) | if (priv->cache) | |||
{ | { | |||
_evas_object_table_cache_free(priv->cache); | _evas_object_table_cache_free(priv->cache); | |||
priv->cache = NULL; | priv->cache = NULL; | |||
} | } | |||
_evas_object_table_parent_sc->del(o); | _evas_object_table_parent_sc->del(o); | |||
} | } | |||
skipping to change at line 937 | skipping to change at line 935 | |||
evas_object_smart_changed(o); | evas_object_smart_changed(o); | |||
} | } | |||
static void | static void | |||
_evas_object_table_smart_calculate(Evas_Object *o) | _evas_object_table_smart_calculate(Evas_Object *o) | |||
{ | { | |||
EVAS_OBJECT_TABLE_DATA_GET_OR_RETURN(o, priv); | EVAS_OBJECT_TABLE_DATA_GET_OR_RETURN(o, priv); | |||
if ((priv->size.cols < 1) || (priv->size.rows < 1)) | if ((priv->size.cols < 1) || (priv->size.rows < 1)) | |||
{ | { | |||
DBG("Nothing to do: cols=%d, rows=%d", | DBG("Nothing to do: cols=%d, rows=%d", | |||
priv->size.cols, priv->size.rows); | priv->size.cols, priv->size.rows); | |||
return; | return; | |||
} | } | |||
if (priv->homogeneous) | if (priv->homogeneous) | |||
_evas_object_table_smart_calculate_homogeneous(o, priv); | _evas_object_table_smart_calculate_homogeneous(o, priv); | |||
else | else | |||
_evas_object_table_smart_calculate_regular(o, priv); | _evas_object_table_smart_calculate_regular(o, priv); | |||
} | } | |||
static void | static void | |||
_evas_object_table_smart_set_user(Evas_Smart_Class *sc) | _evas_object_table_smart_set_user(Evas_Smart_Class *sc) | |||
skipping to change at line 1010 | skipping to change at line 1008 | |||
priv->align.v = vertical; | priv->align.v = vertical; | |||
evas_object_smart_changed(o); | evas_object_smart_changed(o); | |||
} | } | |||
EAPI void | EAPI void | |||
evas_object_table_align_get(const Evas_Object *o, double *horizontal, doubl e *vertical) | evas_object_table_align_get(const Evas_Object *o, double *horizontal, doubl e *vertical) | |||
{ | { | |||
EVAS_OBJECT_TABLE_DATA_GET(o, priv); | EVAS_OBJECT_TABLE_DATA_GET(o, priv); | |||
if (priv) | if (priv) | |||
{ | { | |||
if (horizontal) *horizontal = priv->align.h; | if (horizontal) *horizontal = priv->align.h; | |||
if (vertical) *vertical = priv->align.v; | if (vertical) *vertical = priv->align.v; | |||
} | } | |||
else | else | |||
{ | { | |||
if (horizontal) *horizontal = 0.5; | if (horizontal) *horizontal = 0.5; | |||
if (vertical) *vertical = 0.5; | if (vertical) *vertical = 0.5; | |||
} | } | |||
} | } | |||
EAPI void | EAPI void | |||
evas_object_table_padding_set(Evas_Object *o, Evas_Coord horizontal, Evas_C oord vertical) | evas_object_table_padding_set(Evas_Object *o, Evas_Coord horizontal, Evas_C oord vertical) | |||
{ | { | |||
EVAS_OBJECT_TABLE_DATA_GET_OR_RETURN(o, priv); | EVAS_OBJECT_TABLE_DATA_GET_OR_RETURN(o, priv); | |||
if (priv->pad.h == horizontal && priv->pad.v == vertical) | if (priv->pad.h == horizontal && priv->pad.v == vertical) | |||
return; | return; | |||
priv->pad.h = horizontal; | priv->pad.h = horizontal; | |||
skipping to change at line 1038 | skipping to change at line 1036 | |||
_evas_object_table_cache_invalidate(priv); | _evas_object_table_cache_invalidate(priv); | |||
evas_object_smart_changed(o); | evas_object_smart_changed(o); | |||
} | } | |||
EAPI void | EAPI void | |||
evas_object_table_padding_get(const Evas_Object *o, Evas_Coord *horizontal, Evas_Coord *vertical) | evas_object_table_padding_get(const Evas_Object *o, Evas_Coord *horizontal, Evas_Coord *vertical) | |||
{ | { | |||
EVAS_OBJECT_TABLE_DATA_GET(o, priv); | EVAS_OBJECT_TABLE_DATA_GET(o, priv); | |||
if (priv) | if (priv) | |||
{ | { | |||
if (horizontal) *horizontal = priv->pad.h; | if (horizontal) *horizontal = priv->pad.h; | |||
if (vertical) *vertical = priv->pad.v; | if (vertical) *vertical = priv->pad.v; | |||
} | } | |||
else | else | |||
{ | { | |||
if (horizontal) *horizontal = 0; | if (horizontal) *horizontal = 0; | |||
if (vertical) *vertical = 0; | if (vertical) *vertical = 0; | |||
} | } | |||
} | } | |||
EAPI Eina_Bool | EAPI Eina_Bool | |||
evas_object_table_pack_get(Evas_Object *o, Evas_Object *child, unsigned sho rt *col, unsigned short *row, unsigned short *colspan, unsigned short *rows pan) | evas_object_table_pack_get(const Evas_Object *o, Evas_Object *child, unsign ed short *col, unsigned short *row, unsigned short *colspan, unsigned short *rowspan) | |||
{ | { | |||
Evas_Object_Table_Option *opt; | Evas_Object_Table_Option *opt; | |||
EVAS_OBJECT_TABLE_DATA_GET_OR_RETURN_VAL(o, priv, 0); | EVAS_OBJECT_TABLE_DATA_GET_OR_RETURN_VAL(o, priv, 0); | |||
opt = _evas_object_table_option_get(child); | opt = _evas_object_table_option_get(child); | |||
if (!opt) | if (!opt) | |||
{ | { | |||
if (col) *col = 0; | if (col) *col = 0; | |||
if (row) *row = 0; | if (row) *row = 0; | |||
if (colspan) *colspan = 0; | if (colspan) *colspan = 0; | |||
skipping to change at line 1079 | skipping to change at line 1077 | |||
EAPI Eina_Bool | EAPI Eina_Bool | |||
evas_object_table_pack(Evas_Object *o, Evas_Object *child, unsigned short c ol, unsigned short row, unsigned short colspan, unsigned short rowspan) | evas_object_table_pack(Evas_Object *o, Evas_Object *child, unsigned short c ol, unsigned short row, unsigned short colspan, unsigned short rowspan) | |||
{ | { | |||
Evas_Object_Table_Option *opt; | Evas_Object_Table_Option *opt; | |||
EVAS_OBJECT_TABLE_DATA_GET_OR_RETURN_VAL(o, priv, 0); | EVAS_OBJECT_TABLE_DATA_GET_OR_RETURN_VAL(o, priv, 0); | |||
if (rowspan < 1) | if (rowspan < 1) | |||
{ | { | |||
ERR("rowspan < 1"); | ERR("rowspan < 1"); | |||
return EINA_FALSE; | return EINA_FALSE; | |||
} | } | |||
if (colspan < 1) | if (colspan < 1) | |||
{ | { | |||
ERR("colspan < 1"); | ERR("colspan < 1"); | |||
return EINA_FALSE; | return EINA_FALSE; | |||
} | } | |||
opt = _evas_object_table_option_get(child); | opt = _evas_object_table_option_get(child); | |||
if (!opt) | if (!opt) | |||
{ | { | |||
opt = malloc(sizeof(*opt)); | opt = malloc(sizeof(*opt)); | |||
if (!opt) | if (!opt) | |||
{ | { | |||
ERR("could not allocate table option data."); | ERR("could not allocate table option data."); | |||
return EINA_FALSE; | return EINA_FALSE; | |||
skipping to change at line 1112 | skipping to change at line 1110 | |||
opt->colspan = colspan; | opt->colspan = colspan; | |||
opt->rowspan = rowspan; | opt->rowspan = rowspan; | |||
opt->end_col = col + colspan; | opt->end_col = col + colspan; | |||
opt->end_row = row + rowspan; | opt->end_row = row + rowspan; | |||
if (evas_object_smart_parent_get(child) == o) | if (evas_object_smart_parent_get(child) == o) | |||
{ | { | |||
Eina_Bool need_shrink = EINA_FALSE; | Eina_Bool need_shrink = EINA_FALSE; | |||
if (priv->size.cols < opt->end_col) | if (priv->size.cols < opt->end_col) | |||
priv->size.cols = opt->end_col; | priv->size.cols = opt->end_col; | |||
else | else | |||
need_shrink = EINA_TRUE; | need_shrink = EINA_TRUE; | |||
if (priv->size.rows < opt->end_row) | if (priv->size.rows < opt->end_row) | |||
priv->size.rows = opt->end_row; | priv->size.rows = opt->end_row; | |||
else | else | |||
need_shrink = EINA_TRUE; | need_shrink = EINA_TRUE; | |||
if (need_shrink) | if (need_shrink) | |||
{ | { | |||
Eina_List *l; | Eina_List *l; | |||
Evas_Object_Table_Option *opt2; | Evas_Object_Table_Option *opt2; | |||
int max_row = 0, max_col = 0; | int max_row = 0, max_col = 0; | |||
EINA_LIST_FOREACH(priv->children, l, opt2) | EINA_LIST_FOREACH(priv->children, l, opt2) | |||
skipping to change at line 1153 | skipping to change at line 1151 | |||
opt->pad.l = 0; | opt->pad.l = 0; | |||
opt->pad.r = 0; | opt->pad.r = 0; | |||
opt->pad.t = 0; | opt->pad.t = 0; | |||
opt->pad.b = 0; | opt->pad.b = 0; | |||
opt->expand_h = 0; | opt->expand_h = 0; | |||
opt->expand_v = 0; | opt->expand_v = 0; | |||
priv->children = eina_list_append(priv->children, opt); | priv->children = eina_list_append(priv->children, opt); | |||
if (priv->size.cols < opt->end_col) | if (priv->size.cols < opt->end_col) | |||
priv->size.cols = opt->end_col; | priv->size.cols = opt->end_col; | |||
if (priv->size.rows < opt->end_row) | if (priv->size.rows < opt->end_row) | |||
priv->size.rows = opt->end_row; | priv->size.rows = opt->end_row; | |||
_evas_object_table_option_set(child, opt); | _evas_object_table_option_set(child, opt); | |||
evas_object_smart_member_add(child, o); | evas_object_smart_member_add(child, o); | |||
_evas_object_table_child_connect(o, child); | _evas_object_table_child_connect(o, child); | |||
} | } | |||
_evas_object_table_cache_invalidate(priv); | _evas_object_table_cache_invalidate(priv); | |||
evas_object_smart_changed(o); | evas_object_smart_changed(o); | |||
return EINA_TRUE; | return EINA_TRUE; | |||
} | } | |||
skipping to change at line 1178 | skipping to change at line 1176 | |||
{ | { | |||
Eina_List *l; | Eina_List *l; | |||
int max_row, max_col, was_greatest; | int max_row, max_col, was_greatest; | |||
max_row = 0; | max_row = 0; | |||
max_col = 0; | max_col = 0; | |||
was_greatest = 0; | was_greatest = 0; | |||
l = priv->children; | l = priv->children; | |||
while (l) | while (l) | |||
{ | { | |||
Evas_Object_Table_Option *cur_opt = l->data; | Evas_Object_Table_Option *cur_opt = l->data; | |||
if (cur_opt != opt) | if (cur_opt != opt) | |||
{ | { | |||
if (max_col < cur_opt->end_col) | if (max_col < cur_opt->end_col) | |||
max_col = cur_opt->end_col; | max_col = cur_opt->end_col; | |||
if (max_row < cur_opt->end_row) | if (max_row < cur_opt->end_row) | |||
max_row = cur_opt->end_row; | max_row = cur_opt->end_row; | |||
l = l->next; | l = l->next; | |||
} | } | |||
else | else | |||
{ | { | |||
Eina_List *tmp = l->next; | Eina_List *tmp = l->next; | |||
priv->children = eina_list_remove_list(priv->children, l); | priv->children = eina_list_remove_list(priv->children, l); | |||
if ((priv->size.cols > opt->end_col) && | if ((priv->size.cols > opt->end_col) && | |||
(priv->size.rows > opt->end_row)) | (priv->size.rows > opt->end_row)) | |||
break; | break; | |||
else | else | |||
{ | { | |||
was_greatest = 1; | was_greatest = 1; | |||
l = tmp; | l = tmp; | |||
} | } | |||
} | } | |||
} | } | |||
if (was_greatest) | if (was_greatest) | |||
{ | { | |||
priv->size.cols = max_col; | priv->size.cols = max_col; | |||
priv->size.rows = max_row; | priv->size.rows = max_row; | |||
} | } | |||
} | } | |||
EAPI Eina_Bool | EAPI Eina_Bool | |||
evas_object_table_unpack(Evas_Object *o, Evas_Object *child) | evas_object_table_unpack(Evas_Object *o, Evas_Object *child) | |||
{ | { | |||
Evas_Object_Table_Option *opt; | Evas_Object_Table_Option *opt; | |||
EVAS_OBJECT_TABLE_DATA_GET_OR_RETURN_VAL(o, priv, 0); | EVAS_OBJECT_TABLE_DATA_GET_OR_RETURN_VAL(o, priv, 0); | |||
if (o != evas_object_smart_parent_get(child)) | if (o != evas_object_smart_parent_get(child)) | |||
{ | { | |||
ERR("cannot unpack child from incorrect table!"); | ERR("cannot unpack child from incorrect table!"); | |||
return EINA_FALSE; | return EINA_FALSE; | |||
} | } | |||
opt = _evas_object_table_option_del(child); | opt = _evas_object_table_option_del(child); | |||
if (!opt) | if (!opt) | |||
{ | { | |||
ERR("cannot unpack child with no packing option!"); | ERR("cannot unpack child with no packing option!"); | |||
return EINA_FALSE; | return EINA_FALSE; | |||
} | } | |||
_evas_object_table_child_disconnect(o, child); | _evas_object_table_child_disconnect(o, child); | |||
_evas_object_table_remove_opt(priv, opt); | _evas_object_table_remove_opt(priv, opt); | |||
evas_object_smart_member_del(child); | evas_object_smart_member_del(child); | |||
free(opt); | free(opt); | |||
_evas_object_table_cache_invalidate(priv); | _evas_object_table_cache_invalidate(priv); | |||
evas_object_smart_changed(o); | evas_object_smart_changed(o); | |||
return EINA_TRUE; | return EINA_TRUE; | |||
skipping to change at line 1251 | skipping to change at line 1249 | |||
EAPI void | EAPI void | |||
evas_object_table_clear(Evas_Object *o, Eina_Bool clear) | evas_object_table_clear(Evas_Object *o, Eina_Bool clear) | |||
{ | { | |||
Evas_Object_Table_Option *opt; | Evas_Object_Table_Option *opt; | |||
EVAS_OBJECT_TABLE_DATA_GET_OR_RETURN(o, priv); | EVAS_OBJECT_TABLE_DATA_GET_OR_RETURN(o, priv); | |||
EINA_LIST_FREE(priv->children, opt) | EINA_LIST_FREE(priv->children, opt) | |||
{ | { | |||
_evas_object_table_child_disconnect(o, opt->obj); | _evas_object_table_child_disconnect(o, opt->obj); | |||
_evas_object_table_option_del(opt->obj); | _evas_object_table_option_del(opt->obj); | |||
evas_object_smart_member_del(opt->obj); | evas_object_smart_member_del(opt->obj); | |||
if (clear) | if (clear) | |||
evas_object_del(opt->obj); | evas_object_del(opt->obj); | |||
free(opt); | free(opt); | |||
} | } | |||
priv->size.cols = 0; | priv->size.cols = 0; | |||
priv->size.rows = 0; | priv->size.rows = 0; | |||
_evas_object_table_cache_invalidate(priv); | _evas_object_table_cache_invalidate(priv); | |||
evas_object_smart_changed(o); | evas_object_smart_changed(o); | |||
} | } | |||
EAPI void | EAPI void | |||
evas_object_table_col_row_size_get(const Evas_Object *o, int *cols, int *ro ws) | evas_object_table_col_row_size_get(const Evas_Object *o, int *cols, int *ro ws) | |||
{ | { | |||
EVAS_OBJECT_TABLE_DATA_GET(o, priv); | EVAS_OBJECT_TABLE_DATA_GET(o, priv); | |||
if (priv) | if (priv) | |||
{ | { | |||
if (cols) *cols = priv->size.cols; | if (cols) *cols = priv->size.cols; | |||
if (rows) *rows = priv->size.rows; | if (rows) *rows = priv->size.rows; | |||
} | } | |||
else | else | |||
{ | { | |||
if (cols) *cols = -1; | if (cols) *cols = -1; | |||
if (rows) *rows = -1; | if (rows) *rows = -1; | |||
} | } | |||
} | } | |||
EAPI Eina_Iterator * | EAPI Eina_Iterator * | |||
evas_object_table_iterator_new(const Evas_Object *o) | evas_object_table_iterator_new(const Evas_Object *o) | |||
{ | { | |||
Evas_Object_Table_Iterator *it; | Evas_Object_Table_Iterator *it; | |||
EVAS_OBJECT_TABLE_DATA_GET_OR_RETURN_VAL(o, priv, NULL); | EVAS_OBJECT_TABLE_DATA_GET_OR_RETURN_VAL(o, priv, NULL); | |||
End of changes. 61 change blocks. | ||||
311 lines changed or deleted | 307 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |