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