forked from enlightenment/enlightenment
parent
54f2079b25
commit
23c3f87508
|
@ -1,64 +1,68 @@
|
|||
#include "e.h"
|
||||
|
||||
typedef struct _E_Smart_Data E_Smart_Data;
|
||||
typedef struct _E_Flowlayout_Item E_Flowlayout_Item;
|
||||
typedef struct _E_Smart_Data E_Smart_Data;
|
||||
typedef struct _E_Flowlayout_Item E_Flowlayout_Item;
|
||||
|
||||
struct _E_Smart_Data
|
||||
{
|
||||
Evas_Coord x, y, w, h;
|
||||
Evas_Object *obj;
|
||||
Evas_Object *clip;
|
||||
int frozen;
|
||||
unsigned char changed : 1;
|
||||
unsigned char horizontal : 1;
|
||||
unsigned char homogenous : 1;
|
||||
unsigned char fill : 1;
|
||||
unsigned char flowright : 1;
|
||||
unsigned char flowbottom : 1;
|
||||
Eina_List *items;
|
||||
struct {
|
||||
Evas_Coord w, h;
|
||||
Evas_Coord x, y, w, h;
|
||||
Evas_Object *obj;
|
||||
Evas_Object *clip;
|
||||
int frozen;
|
||||
unsigned char changed : 1;
|
||||
unsigned char horizontal : 1;
|
||||
unsigned char homogenous : 1;
|
||||
unsigned char fill : 1;
|
||||
unsigned char flowright : 1;
|
||||
unsigned char flowbottom : 1;
|
||||
Eina_List *items;
|
||||
struct
|
||||
{
|
||||
Evas_Coord w, h;
|
||||
} min, max;
|
||||
struct {
|
||||
double x, y;
|
||||
struct
|
||||
{
|
||||
double x, y;
|
||||
} align;
|
||||
int rows;
|
||||
int cols;
|
||||
int rows;
|
||||
int cols;
|
||||
};
|
||||
|
||||
struct _E_Flowlayout_Item
|
||||
{
|
||||
E_Smart_Data *sd;
|
||||
unsigned char fill_w : 1;
|
||||
unsigned char fill_h : 1;
|
||||
unsigned char expand_w : 1;
|
||||
unsigned char expand_h : 1;
|
||||
struct {
|
||||
Evas_Coord w, h;
|
||||
E_Smart_Data *sd;
|
||||
unsigned char fill_w : 1;
|
||||
unsigned char fill_h : 1;
|
||||
unsigned char expand_w : 1;
|
||||
unsigned char expand_h : 1;
|
||||
struct
|
||||
{
|
||||
Evas_Coord w, h;
|
||||
} min, max;
|
||||
struct {
|
||||
double x, y;
|
||||
struct
|
||||
{
|
||||
double x, y;
|
||||
} align;
|
||||
Evas_Object *obj;
|
||||
Evas_Object *obj;
|
||||
};
|
||||
|
||||
/* local subsystem functions */
|
||||
static E_Flowlayout_Item *_e_flowlayout_smart_adopt(E_Smart_Data *sd, Evas_Object *obj);
|
||||
static void _e_flowlayout_smart_disown(Evas_Object *obj);
|
||||
static void _e_flowlayout_smart_item_del_hook(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||
static void _e_flowlayout_smart_reconfigure(E_Smart_Data *sd);
|
||||
static void _e_flowlayout_smart_extents_calcuate(E_Smart_Data *sd);
|
||||
static void _e_flowlayout_smart_disown(Evas_Object *obj);
|
||||
static void _e_flowlayout_smart_item_del_hook(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||
static void _e_flowlayout_smart_reconfigure(E_Smart_Data *sd);
|
||||
static void _e_flowlayout_smart_extents_calcuate(E_Smart_Data *sd);
|
||||
|
||||
static void _e_flowlayout_smart_init(void);
|
||||
static void _e_flowlayout_smart_add(Evas_Object *obj);
|
||||
static void _e_flowlayout_smart_del(Evas_Object *obj);
|
||||
static void _e_flowlayout_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y);
|
||||
static void _e_flowlayout_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h);
|
||||
static void _e_flowlayout_smart_show(Evas_Object *obj);
|
||||
static void _e_flowlayout_smart_hide(Evas_Object *obj);
|
||||
static void _e_flowlayout_smart_color_set(Evas_Object *obj, int r, int g, int b, int a);
|
||||
static void _e_flowlayout_smart_clip_set(Evas_Object *obj, Evas_Object *clip);
|
||||
static void _e_flowlayout_smart_clip_unset(Evas_Object *obj);
|
||||
static void _e_flowlayout_smart_init(void);
|
||||
static void _e_flowlayout_smart_add(Evas_Object *obj);
|
||||
static void _e_flowlayout_smart_del(Evas_Object *obj);
|
||||
static void _e_flowlayout_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y);
|
||||
static void _e_flowlayout_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h);
|
||||
static void _e_flowlayout_smart_show(Evas_Object *obj);
|
||||
static void _e_flowlayout_smart_hide(Evas_Object *obj);
|
||||
static void _e_flowlayout_smart_color_set(Evas_Object *obj, int r, int g, int b, int a);
|
||||
static void _e_flowlayout_smart_clip_set(Evas_Object *obj, Evas_Object *clip);
|
||||
static void _e_flowlayout_smart_clip_unset(Evas_Object *obj);
|
||||
|
||||
/* local subsystem globals */
|
||||
static Evas_Smart *_e_smart = NULL;
|
||||
|
@ -131,9 +135,9 @@ e_flowlayout_flowdirection_set(Evas_Object *obj, int right, int bottom)
|
|||
sd = evas_object_smart_data_get(obj);
|
||||
if (!sd) return;
|
||||
if ((((sd->flowbottom) && (bottom)) ||
|
||||
((!sd->flowbottom) && (!bottom))) &&
|
||||
(((sd->flowright) && (right)) ||
|
||||
((!sd->flowright) && (!right)))) return;
|
||||
((!sd->flowbottom) && (!bottom))) &&
|
||||
(((sd->flowright) && (right)) ||
|
||||
((!sd->flowright) && (!right)))) return;
|
||||
sd->flowright = right;
|
||||
sd->flowbottom = bottom;
|
||||
sd->changed = 1;
|
||||
|
@ -202,7 +206,6 @@ e_flowlayout_fill_get(Evas_Object *obj)
|
|||
return sd->fill;
|
||||
}
|
||||
|
||||
|
||||
EAPI int
|
||||
e_flowlayout_pack_start(Evas_Object *obj, Evas_Object *child)
|
||||
{
|
||||
|
@ -248,8 +251,8 @@ e_flowlayout_pack_before(Evas_Object *obj, Evas_Object *child, Evas_Object *befo
|
|||
sd->items = eina_list_prepend_relative(sd->items, child, before);
|
||||
EINA_LIST_FOREACH(sd->items, l, item)
|
||||
{
|
||||
if (item == child) break;
|
||||
i++;
|
||||
if (item == child) break;
|
||||
i++;
|
||||
}
|
||||
sd->changed = 1;
|
||||
if (sd->frozen <= 0) _e_flowlayout_smart_reconfigure(sd);
|
||||
|
@ -271,8 +274,8 @@ e_flowlayout_pack_after(Evas_Object *obj, Evas_Object *child, Evas_Object *after
|
|||
sd->items = eina_list_append_relative(sd->items, child, after);
|
||||
EINA_LIST_FOREACH(sd->items, l, item)
|
||||
{
|
||||
if (item == child) break;
|
||||
i++;
|
||||
if (item == child) break;
|
||||
i++;
|
||||
}
|
||||
sd->changed = 1;
|
||||
if (sd->frozen <= 0) _e_flowlayout_smart_reconfigure(sd);
|
||||
|
@ -395,8 +398,9 @@ e_flowlayout_max_children(Evas_Object *obj)
|
|||
sd = evas_object_smart_data_get(obj);
|
||||
if (!sd) return -1;
|
||||
if (!sd->homogenous) return -1;
|
||||
return (sd->rows * sd->cols);
|
||||
return sd->rows * sd->cols;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_flowlayout_align_get(Evas_Object *obj, double *ax, double *ay)
|
||||
{
|
||||
|
@ -449,7 +453,7 @@ _e_flowlayout_smart_adopt(E_Smart_Data *sd, Evas_Object *obj)
|
|||
evas_object_smart_member_add(obj, bi->sd->obj);
|
||||
evas_object_data_set(obj, "e_flowlayout_data", bi);
|
||||
evas_object_event_callback_add(obj, EVAS_CALLBACK_FREE,
|
||||
_e_flowlayout_smart_item_del_hook, NULL);
|
||||
_e_flowlayout_smart_item_del_hook, NULL);
|
||||
if ((!evas_object_visible_get(sd->clip)) &&
|
||||
(evas_object_visible_get(sd->obj)))
|
||||
evas_object_show(sd->clip);
|
||||
|
@ -465,12 +469,12 @@ _e_flowlayout_smart_disown(Evas_Object *obj)
|
|||
if (!bi) return;
|
||||
if (!bi->sd->items)
|
||||
{
|
||||
if (evas_object_visible_get(bi->sd->clip))
|
||||
evas_object_hide(bi->sd->clip);
|
||||
if (evas_object_visible_get(bi->sd->clip))
|
||||
evas_object_hide(bi->sd->clip);
|
||||
}
|
||||
evas_object_event_callback_del(obj,
|
||||
EVAS_CALLBACK_FREE,
|
||||
_e_flowlayout_smart_item_del_hook);
|
||||
EVAS_CALLBACK_FREE,
|
||||
_e_flowlayout_smart_item_del_hook);
|
||||
evas_object_smart_member_del(obj);
|
||||
evas_object_clip_unset(obj);
|
||||
evas_object_data_del(obj, "e_flowlayout_data");
|
||||
|
@ -492,7 +496,6 @@ _e_flowlayout_smart_reconfigure(E_Smart_Data *sd)
|
|||
int minw, minh;
|
||||
int count, expand;
|
||||
|
||||
|
||||
if (!sd->changed) return;
|
||||
|
||||
/* local variables */
|
||||
|
@ -511,47 +514,47 @@ _e_flowlayout_smart_reconfigure(E_Smart_Data *sd)
|
|||
/* Too small? move a little */
|
||||
if (w < minw)
|
||||
{
|
||||
x = x + ((w - minw) * (1.0 - sd->align.x));
|
||||
w = minw;
|
||||
x = x + ((w - minw) * (1.0 - sd->align.x));
|
||||
w = minw;
|
||||
}
|
||||
if (h < minh)
|
||||
{
|
||||
y = y + ((h - minh) * (1.0 - sd->align.y));
|
||||
h = minh;
|
||||
y = y + ((h - minh) * (1.0 - sd->align.y));
|
||||
h = minh;
|
||||
}
|
||||
|
||||
/* Some odd expanding counter */
|
||||
EINA_LIST_FOREACH(sd->items, l, obj)
|
||||
{
|
||||
E_Flowlayout_Item *bi;
|
||||
E_Flowlayout_Item *bi;
|
||||
|
||||
bi = evas_object_data_get(obj, "e_flowlayout_data");
|
||||
if (bi)
|
||||
{
|
||||
if (sd->horizontal)
|
||||
{
|
||||
if (bi->expand_w) expand++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bi->expand_h) expand++;
|
||||
}
|
||||
}
|
||||
bi = evas_object_data_get(obj, "e_flowlayout_data");
|
||||
if (bi)
|
||||
{
|
||||
if (sd->horizontal)
|
||||
{
|
||||
if (bi->expand_w) expand++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bi->expand_h) expand++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* If no expansion, w is minw, h is minh */
|
||||
if (expand == 0)
|
||||
{
|
||||
if (sd->horizontal)
|
||||
{
|
||||
x += (double)(w - minw) * sd->align.x;
|
||||
w = minw;
|
||||
}
|
||||
else
|
||||
{
|
||||
y += (double)(h - minh) * sd->align.y;
|
||||
h = minh;
|
||||
}
|
||||
if (sd->horizontal)
|
||||
{
|
||||
x += (double)(w - minw) * sd->align.x;
|
||||
w = minw;
|
||||
}
|
||||
else
|
||||
{
|
||||
y += (double)(h - minh) * sd->align.y;
|
||||
h = minh;
|
||||
}
|
||||
}
|
||||
|
||||
/* Some calculations */
|
||||
|
@ -569,168 +572,165 @@ _e_flowlayout_smart_reconfigure(E_Smart_Data *sd)
|
|||
/* Now for the real deal */
|
||||
EINA_LIST_FOREACH(sd->items, l, obj)
|
||||
{
|
||||
E_Flowlayout_Item *bi;
|
||||
E_Flowlayout_Item *bi;
|
||||
|
||||
bi = evas_object_data_get(obj, "e_flowlayout_data");
|
||||
if (bi)
|
||||
{
|
||||
/* Horiziontal */
|
||||
if (sd->horizontal)
|
||||
{
|
||||
/* Homogenous */
|
||||
if (sd->homogenous)
|
||||
{
|
||||
Evas_Coord ww, hh, ow, oh;
|
||||
ww = w / sd->cols;
|
||||
hh = h / sd->rows;
|
||||
if (sd->fill)
|
||||
{
|
||||
int num = count - (cr)*(sd->cols);
|
||||
if (num < sd->cols)
|
||||
{
|
||||
ww = w / num;
|
||||
}
|
||||
}
|
||||
ow = bi->min.w;
|
||||
if (bi->fill_w) ow = ww;
|
||||
if ((bi->max.w >= 0) && (bi->max.w < ow)) ow = bi->max.w;
|
||||
oh = bi->min.h;
|
||||
if (bi->fill_h) oh = hh;
|
||||
if ((bi->max.h >= 0) && (bi->max.h < oh)) oh = bi->max.h;
|
||||
if (sd->flowright)
|
||||
{
|
||||
if (sd->flowbottom)
|
||||
{
|
||||
evas_object_move(obj,
|
||||
xx + (Evas_Coord)(((double)(ww - ow)) * bi->align.x),
|
||||
yy + (Evas_Coord)(((double)(hh - oh)) * bi->align.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
evas_object_move(obj,
|
||||
xx + (Evas_Coord)(((double)(ww - ow)) * bi->align.x),
|
||||
yy - hh + (Evas_Coord)(((double)(hh - oh)) * bi->align.y));
|
||||
}
|
||||
evas_object_resize(obj, ow, oh);
|
||||
xx += ww;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sd->flowbottom)
|
||||
{
|
||||
evas_object_move(obj,
|
||||
xx - ww + (Evas_Coord)(((double)(ww - ow)) * bi->align.x),
|
||||
yy + (Evas_Coord)(((double)(hh - oh)) * bi->align.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
evas_object_move(obj,
|
||||
xx - ww + (Evas_Coord)(((double)(ww - ow)) * bi->align.x),
|
||||
yy - hh + (Evas_Coord)(((double)(hh - oh)) * bi->align.y));
|
||||
|
||||
}
|
||||
evas_object_resize(obj, ow, oh);
|
||||
xx -= ww;
|
||||
}
|
||||
cc++;
|
||||
if (cc >= sd->cols)
|
||||
{
|
||||
cc = 0;
|
||||
cr++;
|
||||
if (sd->flowright)
|
||||
xx = x;
|
||||
else
|
||||
xx = x + w;
|
||||
if (sd->flowbottom)
|
||||
yy += hh;
|
||||
else
|
||||
yy -= hh;
|
||||
}
|
||||
}
|
||||
/* TODO Nonhomogenous Horizontal */
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
/* Vertical */
|
||||
else
|
||||
{
|
||||
if (sd->homogenous)
|
||||
{
|
||||
Evas_Coord ww, hh, ow, oh;
|
||||
ww = w / sd->cols;
|
||||
hh = h / sd->rows;
|
||||
if (sd->fill)
|
||||
{
|
||||
int num = count - (cc)*(sd->rows);
|
||||
if (num < sd->rows)
|
||||
{
|
||||
hh = h / num;
|
||||
}
|
||||
}
|
||||
oh = bi->min.h;
|
||||
if (bi->fill_h) oh = hh;
|
||||
if ((bi->max.h >= 0) && (bi->max.h < oh)) oh = bi->max.h;
|
||||
ow = bi->min.w;
|
||||
if (bi->fill_w) ow = ww;
|
||||
if ((bi->max.w >= 0) && (bi->max.w < ow)) ow = bi->max.w;
|
||||
if (sd->flowbottom)
|
||||
{
|
||||
if (sd->flowright)
|
||||
{
|
||||
evas_object_move(obj,
|
||||
xx + (Evas_Coord)(((double)(ww - ow)) * bi->align.x),
|
||||
yy + (Evas_Coord)(((double)(hh - oh)) * bi->align.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
evas_object_move(obj,
|
||||
xx - ww + (Evas_Coord)(((double)(ww - ow)) * bi->align.x),
|
||||
yy + (Evas_Coord)(((double)(hh - oh)) * bi->align.y));
|
||||
}
|
||||
evas_object_resize(obj, ow, oh);
|
||||
yy += hh;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sd->flowright)
|
||||
{
|
||||
evas_object_move(obj,
|
||||
xx + (Evas_Coord)(((double)(ww - ow)) * bi->align.x),
|
||||
yy - hh + (Evas_Coord)(((double)(hh - oh)) * bi->align.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
evas_object_move(obj,
|
||||
xx - ww + (Evas_Coord)(((double)(ww - ow)) * bi->align.x),
|
||||
yy - hh + (Evas_Coord)(((double)(hh - oh)) * bi->align.y));
|
||||
|
||||
}
|
||||
evas_object_resize(obj, ow, oh);
|
||||
yy -= hh;
|
||||
}
|
||||
cr++;
|
||||
if (cr >= sd->rows)
|
||||
{
|
||||
cr = 0;
|
||||
cc++;
|
||||
if (sd->flowbottom)
|
||||
yy = y;
|
||||
else
|
||||
yy = y + h;
|
||||
if (sd->flowright)
|
||||
xx += ww;
|
||||
else
|
||||
xx -= ww;
|
||||
}
|
||||
|
||||
}
|
||||
/* TODO Nonhomogeneous Vertical */
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
bi = evas_object_data_get(obj, "e_flowlayout_data");
|
||||
if (bi)
|
||||
{
|
||||
/* Horiziontal */
|
||||
if (sd->horizontal)
|
||||
{
|
||||
/* Homogenous */
|
||||
if (sd->homogenous)
|
||||
{
|
||||
Evas_Coord ww, hh, ow, oh;
|
||||
ww = w / sd->cols;
|
||||
hh = h / sd->rows;
|
||||
if (sd->fill)
|
||||
{
|
||||
int num = count - (cr) * (sd->cols);
|
||||
if (num < sd->cols)
|
||||
{
|
||||
ww = w / num;
|
||||
}
|
||||
}
|
||||
ow = bi->min.w;
|
||||
if (bi->fill_w) ow = ww;
|
||||
if ((bi->max.w >= 0) && (bi->max.w < ow)) ow = bi->max.w;
|
||||
oh = bi->min.h;
|
||||
if (bi->fill_h) oh = hh;
|
||||
if ((bi->max.h >= 0) && (bi->max.h < oh)) oh = bi->max.h;
|
||||
if (sd->flowright)
|
||||
{
|
||||
if (sd->flowbottom)
|
||||
{
|
||||
evas_object_move(obj,
|
||||
xx + (Evas_Coord)(((double)(ww - ow)) * bi->align.x),
|
||||
yy + (Evas_Coord)(((double)(hh - oh)) * bi->align.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
evas_object_move(obj,
|
||||
xx + (Evas_Coord)(((double)(ww - ow)) * bi->align.x),
|
||||
yy - hh + (Evas_Coord)(((double)(hh - oh)) * bi->align.y));
|
||||
}
|
||||
evas_object_resize(obj, ow, oh);
|
||||
xx += ww;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sd->flowbottom)
|
||||
{
|
||||
evas_object_move(obj,
|
||||
xx - ww + (Evas_Coord)(((double)(ww - ow)) * bi->align.x),
|
||||
yy + (Evas_Coord)(((double)(hh - oh)) * bi->align.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
evas_object_move(obj,
|
||||
xx - ww + (Evas_Coord)(((double)(ww - ow)) * bi->align.x),
|
||||
yy - hh + (Evas_Coord)(((double)(hh - oh)) * bi->align.y));
|
||||
}
|
||||
evas_object_resize(obj, ow, oh);
|
||||
xx -= ww;
|
||||
}
|
||||
cc++;
|
||||
if (cc >= sd->cols)
|
||||
{
|
||||
cc = 0;
|
||||
cr++;
|
||||
if (sd->flowright)
|
||||
xx = x;
|
||||
else
|
||||
xx = x + w;
|
||||
if (sd->flowbottom)
|
||||
yy += hh;
|
||||
else
|
||||
yy -= hh;
|
||||
}
|
||||
}
|
||||
/* TODO Nonhomogenous Horizontal */
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
/* Vertical */
|
||||
else
|
||||
{
|
||||
if (sd->homogenous)
|
||||
{
|
||||
Evas_Coord ww, hh, ow, oh;
|
||||
ww = w / sd->cols;
|
||||
hh = h / sd->rows;
|
||||
if (sd->fill)
|
||||
{
|
||||
int num = count - (cc) * (sd->rows);
|
||||
if (num < sd->rows)
|
||||
{
|
||||
hh = h / num;
|
||||
}
|
||||
}
|
||||
oh = bi->min.h;
|
||||
if (bi->fill_h) oh = hh;
|
||||
if ((bi->max.h >= 0) && (bi->max.h < oh)) oh = bi->max.h;
|
||||
ow = bi->min.w;
|
||||
if (bi->fill_w) ow = ww;
|
||||
if ((bi->max.w >= 0) && (bi->max.w < ow)) ow = bi->max.w;
|
||||
if (sd->flowbottom)
|
||||
{
|
||||
if (sd->flowright)
|
||||
{
|
||||
evas_object_move(obj,
|
||||
xx + (Evas_Coord)(((double)(ww - ow)) * bi->align.x),
|
||||
yy + (Evas_Coord)(((double)(hh - oh)) * bi->align.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
evas_object_move(obj,
|
||||
xx - ww + (Evas_Coord)(((double)(ww - ow)) * bi->align.x),
|
||||
yy + (Evas_Coord)(((double)(hh - oh)) * bi->align.y));
|
||||
}
|
||||
evas_object_resize(obj, ow, oh);
|
||||
yy += hh;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sd->flowright)
|
||||
{
|
||||
evas_object_move(obj,
|
||||
xx + (Evas_Coord)(((double)(ww - ow)) * bi->align.x),
|
||||
yy - hh + (Evas_Coord)(((double)(hh - oh)) * bi->align.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
evas_object_move(obj,
|
||||
xx - ww + (Evas_Coord)(((double)(ww - ow)) * bi->align.x),
|
||||
yy - hh + (Evas_Coord)(((double)(hh - oh)) * bi->align.y));
|
||||
}
|
||||
evas_object_resize(obj, ow, oh);
|
||||
yy -= hh;
|
||||
}
|
||||
cr++;
|
||||
if (cr >= sd->rows)
|
||||
{
|
||||
cr = 0;
|
||||
cc++;
|
||||
if (sd->flowbottom)
|
||||
yy = y;
|
||||
else
|
||||
yy = y + h;
|
||||
if (sd->flowright)
|
||||
xx += ww;
|
||||
else
|
||||
xx -= ww;
|
||||
}
|
||||
}
|
||||
/* TODO Nonhomogeneous Vertical */
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
sd->changed = 0;
|
||||
}
|
||||
|
@ -750,32 +750,32 @@ _e_flowlayout_smart_extents_calcuate(E_Smart_Data *sd)
|
|||
minh = 1;
|
||||
if (sd->homogenous)
|
||||
{
|
||||
EINA_LIST_FOREACH(sd->items, l, obj)
|
||||
{
|
||||
E_Flowlayout_Item *bi;
|
||||
EINA_LIST_FOREACH(sd->items, l, obj)
|
||||
{
|
||||
E_Flowlayout_Item *bi;
|
||||
|
||||
bi = evas_object_data_get(obj, "e_flowlayout_data");
|
||||
if (bi)
|
||||
{
|
||||
if (sd->horizontal)
|
||||
{
|
||||
if (minh < bi->min.h) minh = bi->min.h;
|
||||
if (minw < bi->min.w) minw = bi->min.w;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (minw < bi->min.w) minw = bi->min.w;
|
||||
if (minh < bi->min.h) minh = bi->min.h;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (sd->horizontal)
|
||||
{
|
||||
sd->rows = sd->h/minh;
|
||||
if (sd->rows<1)
|
||||
sd->rows = 1;
|
||||
count = eina_list_count(sd->items);
|
||||
sd->cols = sd->w/minw;
|
||||
bi = evas_object_data_get(obj, "e_flowlayout_data");
|
||||
if (bi)
|
||||
{
|
||||
if (sd->horizontal)
|
||||
{
|
||||
if (minh < bi->min.h) minh = bi->min.h;
|
||||
if (minw < bi->min.w) minw = bi->min.w;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (minw < bi->min.w) minw = bi->min.w;
|
||||
if (minh < bi->min.h) minh = bi->min.h;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (sd->horizontal)
|
||||
{
|
||||
sd->rows = sd->h / minh;
|
||||
if (sd->rows < 1)
|
||||
sd->rows = 1;
|
||||
count = eina_list_count(sd->items);
|
||||
sd->cols = sd->w / minw;
|
||||
if (count < sd->cols) sd->cols = count;
|
||||
sd->rows = 0;
|
||||
if (sd->cols > 0)
|
||||
|
@ -786,14 +786,14 @@ _e_flowlayout_smart_extents_calcuate(E_Smart_Data *sd)
|
|||
sd->rows++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sd->cols = sd->w/minw;
|
||||
if (sd->cols<1)
|
||||
sd->cols = 1;
|
||||
count = eina_list_count(sd->items);
|
||||
sd->rows = sd->h/minh;
|
||||
}
|
||||
else
|
||||
{
|
||||
sd->cols = sd->w / minw;
|
||||
if (sd->cols < 1)
|
||||
sd->cols = 1;
|
||||
count = eina_list_count(sd->items);
|
||||
sd->rows = sd->h / minh;
|
||||
if (count < sd->cols) sd->rows = count;
|
||||
sd->cols = 0;
|
||||
if (sd->rows > 0)
|
||||
|
@ -804,47 +804,47 @@ _e_flowlayout_smart_extents_calcuate(E_Smart_Data *sd)
|
|||
sd->cols++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
minw *= sd->cols;
|
||||
minh *= sd->rows;
|
||||
minw *= sd->cols;
|
||||
minh *= sd->rows;
|
||||
}
|
||||
/* TODO nonhomogenous */
|
||||
else
|
||||
{
|
||||
EINA_LIST_FOREACH(sd->items, l, obj)
|
||||
{
|
||||
E_Flowlayout_Item *bi;
|
||||
EINA_LIST_FOREACH(sd->items, l, obj)
|
||||
{
|
||||
E_Flowlayout_Item *bi;
|
||||
|
||||
bi = evas_object_data_get(obj, "e_flowlayout_data");
|
||||
if (bi)
|
||||
{
|
||||
if (sd->horizontal)
|
||||
{
|
||||
if (minh < bi->min.h) minh = bi->min.h*sd->rows;
|
||||
minw += bi->min.w;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (minw < bi->min.w) minw = bi->min.w*sd->cols;
|
||||
minh += bi->min.h;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (sd->horizontal)
|
||||
{
|
||||
sd->rows = sd->h/minh;
|
||||
minh *= sd->rows;
|
||||
sd->cols = -1;
|
||||
minw = minw/sd->cols + 0.2*minw;
|
||||
}
|
||||
else
|
||||
{
|
||||
sd->cols = sd->w/minw;
|
||||
minw *= sd->cols;
|
||||
sd->rows = -1;
|
||||
minh = minh/sd->cols + 0.2*minh;
|
||||
}
|
||||
bi = evas_object_data_get(obj, "e_flowlayout_data");
|
||||
if (bi)
|
||||
{
|
||||
if (sd->horizontal)
|
||||
{
|
||||
if (minh < bi->min.h) minh = bi->min.h * sd->rows;
|
||||
minw += bi->min.w;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (minw < bi->min.w) minw = bi->min.w * sd->cols;
|
||||
minh += bi->min.h;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (sd->horizontal)
|
||||
{
|
||||
sd->rows = sd->h / minh;
|
||||
minh *= sd->rows;
|
||||
sd->cols = -1;
|
||||
minw = minw / sd->cols + 0.2 * minw;
|
||||
}
|
||||
else
|
||||
{
|
||||
sd->cols = sd->w / minw;
|
||||
minw *= sd->cols;
|
||||
sd->rows = -1;
|
||||
minh = minh / sd->cols + 0.2 * minh;
|
||||
}
|
||||
}
|
||||
sd->min.w = minw;
|
||||
sd->min.h = minh;
|
||||
|
@ -858,30 +858,30 @@ static void
|
|||
_e_flowlayout_smart_init(void)
|
||||
{
|
||||
if (_e_smart) return;
|
||||
{
|
||||
static const Evas_Smart_Class sc =
|
||||
{
|
||||
"e_flowlayout",
|
||||
EVAS_SMART_CLASS_VERSION,
|
||||
_e_flowlayout_smart_add,
|
||||
_e_flowlayout_smart_del,
|
||||
_e_flowlayout_smart_move,
|
||||
_e_flowlayout_smart_resize,
|
||||
_e_flowlayout_smart_show,
|
||||
_e_flowlayout_smart_hide,
|
||||
_e_flowlayout_smart_color_set,
|
||||
_e_flowlayout_smart_clip_set,
|
||||
_e_flowlayout_smart_clip_unset,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
_e_smart = evas_smart_class_new(&sc);
|
||||
}
|
||||
{
|
||||
static const Evas_Smart_Class sc =
|
||||
{
|
||||
"e_flowlayout",
|
||||
EVAS_SMART_CLASS_VERSION,
|
||||
_e_flowlayout_smart_add,
|
||||
_e_flowlayout_smart_del,
|
||||
_e_flowlayout_smart_move,
|
||||
_e_flowlayout_smart_resize,
|
||||
_e_flowlayout_smart_show,
|
||||
_e_flowlayout_smart_hide,
|
||||
_e_flowlayout_smart_color_set,
|
||||
_e_flowlayout_smart_clip_set,
|
||||
_e_flowlayout_smart_clip_unset,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
_e_smart = evas_smart_class_new(&sc);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -918,10 +918,10 @@ _e_flowlayout_smart_del(Evas_Object *obj)
|
|||
*/
|
||||
while (sd->items)
|
||||
{
|
||||
Evas_Object *child;
|
||||
Evas_Object *child;
|
||||
|
||||
child = eina_list_data_get(sd->items);
|
||||
e_flowlayout_unpack(child);
|
||||
child = eina_list_data_get(sd->items);
|
||||
e_flowlayout_unpack(child);
|
||||
}
|
||||
evas_object_del(sd->clip);
|
||||
free(sd);
|
||||
|
@ -935,21 +935,21 @@ _e_flowlayout_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
|
|||
sd = evas_object_smart_data_get(obj);
|
||||
if (!sd) return;
|
||||
if ((x == sd->x) && (y == sd->y)) return;
|
||||
{
|
||||
Eina_List *l;
|
||||
Evas_Object *item;
|
||||
Evas_Coord dx, dy;
|
||||
{
|
||||
Eina_List *l;
|
||||
Evas_Object *item;
|
||||
Evas_Coord dx, dy;
|
||||
|
||||
dx = x - sd->x;
|
||||
dy = y - sd->y;
|
||||
EINA_LIST_FOREACH(sd->items, l, item)
|
||||
{
|
||||
Evas_Coord ox, oy;
|
||||
dx = x - sd->x;
|
||||
dy = y - sd->y;
|
||||
EINA_LIST_FOREACH(sd->items, l, item)
|
||||
{
|
||||
Evas_Coord ox, oy;
|
||||
|
||||
evas_object_geometry_get(item, &ox, &oy, NULL, NULL);
|
||||
evas_object_move(item, ox + dx, oy + dy);
|
||||
}
|
||||
}
|
||||
evas_object_geometry_get(item, &ox, &oy, NULL, NULL);
|
||||
evas_object_move(item, ox + dx, oy + dy);
|
||||
}
|
||||
}
|
||||
sd->x = x;
|
||||
sd->y = y;
|
||||
}
|
||||
|
@ -1017,3 +1017,4 @@ _e_flowlayout_smart_clip_unset(Evas_Object *obj)
|
|||
if (!sd) return;
|
||||
evas_object_clip_unset(sd->clip);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue