fix some min size calc issues.

fix some theme size calc issues
make all widgets able to... do finger size! this way a ui can be tweaked with
1 value (finger size) if it is to be finger or mouse/stylus driven. and it
was so simple to add in.
work on genlist - beginning to display items and scroll.



SVN revision: 38995
This commit is contained in:
Carsten Haitzler 2009-02-11 11:49:43 +00:00
parent fc5d7b65e9
commit 1099280784
13 changed files with 536 additions and 152 deletions

View File

@ -463,6 +463,7 @@ collections {
part { name: "elm.swallow.content";
type: SWALLOW;
description { state: "default" 0.0;
fixed: 1 0;
visible: 0;
align: 0.0 0.5;
rel1.offset: 4 4;
@ -471,6 +472,7 @@ collections {
}
description { state: "visible" 0.0;
inherit: "default" 0.0;
fixed: 1 0;
visible: 1;
aspect: 1.0 1.0;
aspect_preference: VERTICAL;
@ -478,6 +480,7 @@ collections {
}
description { state: "icononly" 0.0;
inherit: "default" 0.0;
fixed: 0 0;
visible: 1;
align: 0.5 0.5;
aspect: 1.0 1.0;
@ -672,6 +675,7 @@ collections {
part { name: "elm.swallow.content";
type: SWALLOW;
description { state: "default" 0.0;
fixed: 1 0;
visible: 0;
align: 0.0 0.5;
rel1 {
@ -687,6 +691,7 @@ collections {
}
description { state: "visible" 0.0;
inherit: "default" 0.0;
fixed: 0 0;
visible: 1;
aspect: 1.0 1.0;
aspect_preference: VERTICAL;
@ -694,6 +699,7 @@ collections {
}
description { state: "icononly" 0.0;
inherit: "default" 0.0;
fixed: 0 0;
visible: 1;
align: 0.5 0.5;
aspect: 1.0 1.0;
@ -1037,8 +1043,8 @@ collections {
rel1.offset: -4 3;
rel2.offset: -4 -4;
align: 1.0 0.5;
min: 96 24;
max: 96 24;
min: 96 16;
max: 96 16;
aspect: 4.0 4.0;
aspect_preference: VERTICAL;
color: 255 255 255 255;
@ -1067,8 +1073,8 @@ collections {
fixed: 1 1;
rel1.to: "bg";
rel2.to: "bg";
min: 24 24;
max: 24 24;
min: 16 16;
max: 16 16;
aspect: 1.0 1.0;
aspect_preference: VERTICAL;
color: 0 0 0 0;
@ -1080,12 +1086,12 @@ collections {
events: "button";
}
description { state: "default" 0.0;
rel1.to: "bg";
rel1.offset: -8 -8;
rel1.relative: -0.1 -0.1;
rel2.to: "bg";
rel2.offset: 7 7;
rel2.relative: 1.1 1.1;
rel1.to_x: "bg";
rel1.offset: 0 0;
rel1.relative: 0.0 0.0;
rel2.to_x: "bg";
rel2.offset: -1 -1;
rel2.relative: 1.0 1.0;
color: 0 0 0 0;
}
}
@ -1096,7 +1102,7 @@ collections {
mouse_events: 0;
description { state: "default" 0.0;
rel1.to: "button";
rel1.relative: -3.0 0.0;
rel1.relative: -5.0 0.0;
rel2.to: "button";
rel2.relative: 0.0 1.0;
color: 0 0 0 0;
@ -1111,7 +1117,7 @@ collections {
rel1.to: "button";
rel1.relative: 1.0 0.0;
rel2.to: "button";
rel2.relative: 4.0 1.0;
rel2.relative: 6.0 1.0;
color: 0 0 0 0;
}
}
@ -1130,8 +1136,9 @@ collections {
scale: 1;
clip_to: "clipper";
description { state: "default" 0.0;
rel1.to: "offrect";
rel2.to: "offrect";
fixed: 1 1;
rel1.to_x: "offrect";
rel2.to_x: "offrect";
color: 0 0 0 255;
text {
font: "Sans,Edje-Vera";
@ -1149,9 +1156,10 @@ collections {
scale: 1;
clip_to: "clipper";
description { state: "default" 0.0;
rel1.to: "onrect";
fixed: 1 1;
rel1.to_x: "onrect";
rel1.offset: 1 1;
rel2.to: "onrect";
rel2.to_x: "onrect";
rel2.offset: 0 0;
color: 224 224 224 255;
color3: 0 0 0 64;
@ -1224,24 +1232,25 @@ collections {
part { name: "elm.swallow.content";
type: SWALLOW;
description { state: "default" 0.0;
// fixed: 1 1;
visible: 0;
align: 0.0 0.5;
rel1.offset: 4 4;
rel2.offset: 3 -5;
rel2.relative: 0.0 1.0;
rel2.offset: 3 -5;
}
description { state: "visible" 0.0;
inherit: "default" 0.0;
// fixed: 0 0;
visible: 1;
aspect: 1.0 1.0;
aspect_preference: VERTICAL;
rel2.offset: 4 -5;
}
}
part {
name: "elm.text";
type: TEXT;
mouse_events: 0;
part { name: "elm.text";
type: TEXT;
mouse_events: 0;
scale: 1;
description { state: "default" 0.0;
visible: 0;
@ -1253,10 +1262,10 @@ collections {
rel2.offset: -5 -5;
color: 0 0 0 255;
text {
font: "Sans,Edje-Vera";
size: 10;
min: 0 0;
align: 0.0 0.5;
font: "Sans,Edje-Vera";
size: 10;
min: 0 0;
align: 0.0 0.5;
}
}
description { state: "visible" 0.0;
@ -1434,7 +1443,8 @@ collections {
// FIXME 48x96 should be the native pixel design, right now
// its 80x160. fix int he artwork later
min: 24 48;
max: 24 48;
aspect: 0.5 0.5;
// max: 24 48;
image.normal: "flip_base.png";
}
}
@ -2004,8 +2014,9 @@ collections {
rel2.offset: -5 -5;
// FIXME 48x96 should be the native pixel design, right now
// its 80x160. fix int he artwork later
aspect: 0.5 0.5;
min: 24 48;
max: 24 48;
// max: 24 48;
image.normal: "flip_base.png";
}
}
@ -3337,7 +3348,7 @@ collections {
group { name: "elm/hover/base/hoversel_vertical";
images {
image: "shad_circ.png" COMP;
// image: "shad_circ.png" COMP;
image: "bt_base2.png" COMP;
image: "bt_hilight.png" COMP;
image: "bt_shine.png" COMP;
@ -3363,7 +3374,7 @@ collections {
rel2.relative: 1.0 1.0;
}
}
/*
part { name: "shad";
mouse_events: 0;
description { state: "default" 0.0;
@ -3375,6 +3386,7 @@ collections {
fill.smooth: 0;
}
}
*/
part { name: "button_image";
mouse_events: 1;
description { state: "default" 0.0;
@ -5210,12 +5222,11 @@ collections {
}
}
}
part {
name: "elm.swallow.icon";
type: SWALLOW;
description {
state: "default" 0.0;
align: 0.0 0.5;
part { name: "elm.swallow.icon";
type: SWALLOW;
description { state: "default" 0.0;
fixed: 1 0;
align: 0.0 0.5;
rel1 {
relative: 0.0 0.0;
offset: 4 4;
@ -5226,12 +5237,13 @@ collections {
}
}
}
part {
name: "elm.swallow.end";
type: SWALLOW;
description {
state: "default" 0.0;
align: 1.0 0.5;
part { name: "elm.swallow.end";
type: SWALLOW;
description { state: "default" 0.0;
fixed: 1 0;
align: 1.0 0.5;
aspect: 1.0 1.0;
aspect_preference: VERTICAL;
rel1 {
relative: 1.0 0.0;
offset: -5 4;
@ -5242,15 +5254,14 @@ collections {
}
}
}
part {
name: "elm.text";
part { name: "elm.text";
type: TEXT;
effect: SOFT_SHADOW;
mouse_events: 0;
scale: 1;
description {
state: "default" 0.0;
min: 16 16;
// min: 16 16;
rel1 {
to_x: "elm.swallow.icon";
relative: 1.0 0.0;
@ -5405,8 +5416,8 @@ collections {
part {
name: "elm.swallow.icon";
type: SWALLOW;
description {
state: "default" 0.0;
description { state: "default" 0.0;
fixed: 1 0;
align: 0.0 0.5;
rel1 {
relative: 0.0 0.0;
@ -5421,8 +5432,8 @@ collections {
part {
name: "elm.swallow.end";
type: SWALLOW;
description {
state: "default" 0.0;
description { state: "default" 0.0;
fixed: 1 0;
align: 1.0 0.5;
rel1 {
relative: 1.0 0.0;
@ -5442,7 +5453,7 @@ collections {
scale: 1;
description {
state: "default" 0.0;
min: 16 16;
// min: 16 16;
rel1 {
to_x: "elm.swallow.icon";
relative: 1.0 0.0;
@ -5554,8 +5565,8 @@ collections {
part {
name: "base_sh";
mouse_events: 0;
description {
state: "default" 0.0;
description { state: "default" 0.0;
fixed: 1 1;
align: 0.0 0.0;
min: 0 10;
rel1 {
@ -5618,11 +5629,10 @@ collections {
}
}
}
part {
name: "elm.swallow.icon";
part { name: "elm.swallow.icon";
type: SWALLOW;
description {
state: "default" 0.0;
description { state: "default" 0.0;
fixed: 1 0;
align: 0.0 0.5;
rel1 {
relative: 0.0 0.0;
@ -5634,11 +5644,10 @@ collections {
}
}
}
part {
name: "elm.swallow.end";
part { name: "elm.swallow.end";
type: SWALLOW;
description {
state: "default" 0.0;
description { state: "default" 0.0;
fixed: 1 0;
align: 1.0 0.5;
rel1 {
relative: 1.0 0.0;
@ -5656,9 +5665,8 @@ collections {
effect: SOFT_SHADOW;
mouse_events: 0;
scale: 1;
description {
state: "default" 0.0;
min: 16 16;
description { state: "default" 0.0;
// min: 16 16;
rel1 {
to_x: "elm.swallow.icon";
relative: 1.0 0.0;
@ -5810,11 +5818,10 @@ collections {
}
}
}
part {
name: "elm.swallow.icon";
part { name: "elm.swallow.icon";
type: SWALLOW;
description {
state: "default" 0.0;
description { state: "default" 0.0;
fixed: 1 0;
align: 0.0 0.5;
rel1 {
relative: 0.0 0.0;
@ -5826,11 +5833,10 @@ collections {
}
}
}
part {
name: "elm.swallow.end";
part { name: "elm.swallow.end";
type: SWALLOW;
description {
state: "default" 0.0;
description { state: "default" 0.0;
fixed: 1 0;
align: 1.0 0.5;
rel1 {
relative: 1.0 0.0;
@ -5850,7 +5856,7 @@ collections {
scale: 1;
description {
state: "default" 0.0;
min: 16 16;
// min: 16 16;
rel1 {
to_x: "elm.swallow.icon";
relative: 1.0 0.0;
@ -6177,14 +6183,14 @@ collections {
max: 0 24;
fixed: 1 1;
rel1 {
relative: 0.5 0.5;
to: "bg";
relative: 0.5 0.0;
to_x: "bg";
}
rel2 {
relative: 0.5 0.5;
to: "bg";
relative: 0.5 1.0;
to_x: "bg";
}
color: 0 0 0 0;
color: 255 0 0 100;
}
}
part { name: "button_events";
@ -6193,13 +6199,13 @@ collections {
events: "elm.dragable.slider";
}
mouse_events: 1;
scale: 1;
description { state: "default" 0.0;
fixed: 1 1;
min: 32 32;
max: 32 32;
rel1.to: "elm.dragable.slider";
rel2.to: "elm.dragable.slider";
min: 16 16;
aspect: 1.0 1.0;
aspect_preference: VERTICAL;
rel1.to_x: "elm.dragable.slider";
rel2.to_x: "elm.dragable.slider";
color: 0 0 0 0;
}
}
@ -6581,7 +6587,7 @@ collections {
description { state: "default" 0.0;
min: 24 48;
max: 24 9999;
align: 1.0 0.5;
align: 0.5 1.0;
rel1 {
to_y: "elm.text";
relative: 0.0 1.0;
@ -6713,12 +6719,12 @@ collections {
max: 24 0;
fixed: 1 1;
rel1 {
relative: 0.5 0.5;
to: "bg";
relative: 0.5 0.0;
to_y: "bg";
}
rel2 {
relative: 0.5 0.5;
to: "bg";
relative: 0.5 1.0;
to_y: "bg";
}
color: 0 0 0 0;
}
@ -6729,13 +6735,13 @@ collections {
events: "elm.dragable.slider";
}
mouse_events: 1;
scale: 1;
description { state: "default" 0.0;
fixed: 1 1;
min: 32 32;
max: 32 32;
rel1.to: "elm.dragable.slider";
rel2.to: "elm.dragable.slider";
min: 16 16;
aspect: 1.0 1.0;
aspect_preference: HORIZONTAL;
rel1.to_y: "elm.dragable.slider";
rel2.to_y: "elm.dragable.slider";
color: 0 0 0 0;
}
}
@ -6745,8 +6751,8 @@ collections {
fixed: 1 1;
max: 17 999;
min: 17 24;
rel1.to: "button_events";
rel2.to: "button_events";
rel1.to: "elm.dragable.slider";
rel2.to: "elm.dragable.slider";
image {
normal: "sl_bt_0.png";
border: 5 5 5 10;
@ -6872,12 +6878,12 @@ collections {
align: 0.5 1.0;
rel1 {
to: "button0";
relative: 0.0 -0.25;
relative: 0.0 -1.0;
offset: 0 0;
}
rel2 {
to: "button0";
relative: 1.0 -0.25;
relative: 1.0 -1.0;
offset: -1 0;
}
color: 224 224 224 255;

View File

@ -265,6 +265,8 @@ my_bt_7(void *data, Evas_Object *obj, void *event_info)
elm_icon_file_set(ic, buf, NULL);
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
tg = elm_toggle_add(win);
evas_object_size_hint_weight_set(tg, 1.0, 1.0);
evas_object_size_hint_align_set(tg, -1.0, 0.5);
elm_toggle_label_set(tg, "Icon sized to toggle");
elm_toggle_icon_set(tg, ic);
elm_toggle_state_set(tg, 1);
@ -283,13 +285,13 @@ my_bt_7(void *data, Evas_Object *obj, void *event_info)
elm_box_pack_end(bx, tg);
evas_object_show(tg);
evas_object_show(ic);
tg = elm_toggle_add(win);
elm_toggle_label_set(tg, "Label Only");
elm_toggle_states_labels_set(tg, "Big", "Small");
elm_toggle_states_labels_set(tg, "Big long fun times label", "Small long happy fun label");
elm_box_pack_end(bx, tg);
evas_object_show(tg);
ic = elm_icon_add(win);
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
elm_icon_file_set(ic, buf, NULL);
@ -1500,6 +1502,7 @@ my_bt_20(void *data, Evas_Object *obj, void *event_info)
ic = elm_icon_add(win);
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
elm_icon_file_set(ic, buf, NULL);
elm_icon_scale_set(ic, 1, 1);
elm_list_item_append(li, "Hello", ic, NULL, NULL, NULL);
ic = elm_icon_add(win);
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
@ -1984,7 +1987,7 @@ my_bt_28(void *data, Evas_Object *obj, void *event_info)
elm_slider_icon_set(sl, ic);
elm_slider_unit_format_set(sl, "%1.1f units");
elm_slider_span_size_set(sl, 120);
evas_object_size_hint_align_set(sl, -1.0, -1.0);
evas_object_size_hint_align_set(sl, -1.0, 0.5);
evas_object_size_hint_weight_set(sl, 1.0, 1.0);
elm_box_pack_end(bx, sl);
evas_object_show(ic);
@ -1993,7 +1996,7 @@ my_bt_28(void *data, Evas_Object *obj, void *event_info)
sl = elm_slider_add(win);
elm_slider_label_set(sl, "Label 2");
elm_slider_span_size_set(sl, 80);
evas_object_size_hint_align_set(sl, -1.0, -1.0);
evas_object_size_hint_align_set(sl, -1.0, 0.5);
evas_object_size_hint_weight_set(sl, 1.0, 1.0);
elm_slider_indicator_format_set(sl, "%3.0f");
elm_slider_min_max_set(sl, 50, 150);
@ -2009,7 +2012,7 @@ my_bt_28(void *data, Evas_Object *obj, void *event_info)
elm_slider_label_set(sl, "Label 3");
elm_slider_unit_format_set(sl, "units");
elm_slider_span_size_set(sl, 40);
evas_object_size_hint_align_set(sl, -1.0, -1.0);
evas_object_size_hint_align_set(sl, -1.0, 0.5);
evas_object_size_hint_weight_set(sl, 1.0, 1.0);
elm_slider_indicator_format_set(sl, "%3.0f");
elm_slider_min_max_set(sl, 50, 150);
@ -2042,6 +2045,63 @@ my_bt_28(void *data, Evas_Object *obj, void *event_info)
evas_object_show(win);
}
static Elm_Genlist_Item_Class itc1;
char *gl_label_get(const void *data, const char *part)
{
char buf[256];
snprintf(buf, sizeof(buf), "Item # %i", (int)data);
return strdup(buf);
}
Evas_Object *gl_icon_get(const void *data, const char *part)
{
return NULL;
}
Evas_Bool gl_state_get(const void *data, const char *part)
{
return 0;
}
void gl_del(const void *data)
{
}
static void
my_bt_29(void *data, Evas_Object *obj, void *event_info)
{
Evas_Object *win, *bg, *gl;
Elm_Genlist_Item *gli;
int i;
win = elm_win_add(NULL, "genlist", ELM_WIN_BASIC);
elm_win_title_set(win, "Genlist");
elm_win_autodel_set(win, 1);
bg = elm_bg_add(win);
elm_win_resize_object_add(win, bg);
evas_object_size_hint_weight_set(bg, 1.0, 1.0);
evas_object_show(bg);
gl = elm_genlist_add(win);
elm_win_resize_object_add(win, gl);
evas_object_size_hint_weight_set(gl, 1.0, 1.0);
evas_object_show(gl);
itc1.style = "default";
itc1.func.label_get = gl_label_get;
itc1.func.icon_get = gl_icon_get;
itc1.func.state_get = gl_state_get;
itc1.func.del = gl_del;
for (i = 0; i < 2000; i++)
{
gli = elm_genlist_item_append(gl, &itc1, (void *)i/* item data */,
NULL/* parent */, ELM_GENLIST_ITEM_NONE,
NULL/* func */, NULL/* func data */);
}
evas_object_resize(win, 320, 320);
evas_object_show(win);
}
static void
my_win_main(void)
{
@ -2145,6 +2205,7 @@ my_win_main(void)
elm_list_item_append(li, "Scaling", NULL, NULL, my_bt_26, NULL);
elm_list_item_append(li, "Scaling 2", NULL, NULL, my_bt_27, NULL);
elm_list_item_append(li, "Slider", NULL, NULL, my_bt_28, NULL);
elm_list_item_append(li, "Genlist", NULL, NULL, my_bt_29, NULL);
elm_list_go(li);

View File

@ -112,6 +112,8 @@
extern "C" {
#endif
#define ELM_RECTS_INTERSECT(x, y, w, h, xx, yy, ww, hh) (((x) < ((xx) + (ww))) && ((y) < ((yy) + (hh))) && (((x) + (w)) > (xx)) && (((y) + (h)) > (yy)))
/**************************************************************************/
/* Objects */
typedef enum _Elm_Win_Type
@ -146,6 +148,8 @@ extern "C" {
EAPI void elm_object_scale_set(Evas_Object *obj, double scale);
EAPI double elm_object_scale_get(Evas_Object *obj);
EAPI void elm_object_focus(Evas_Object *obj);
EAPI void elm_coords_finger_size_adjust(int times_w, Evas_Coord *w, int times_h, Evas_Coord *h);
EAPI Evas_Object *elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type);
EAPI void elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj);
@ -494,7 +498,8 @@ extern "C" {
typedef enum _Elm_Genlist_Item_Flags
{
ELM_GENLIST_ITEM_SUBITEMS
ELM_GENLIST_ITEM_NONE = 0,
ELM_GENLIST_ITEM_SUBITEMS = (1 << 0)
} Elm_Genlist_Item_Flags;
typedef struct _Elm_Genlist_Item_Class Elm_Genlist_Item_Class;
typedef struct _Elm_Genlist_Item Elm_Genlist_Item;

View File

@ -58,7 +58,9 @@ _sizing_eval(Evas_Object *obj)
if (!wd) return;
Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
edje_object_size_min_calc(wd->btn, &minw, &minh);
elm_coords_finger_size_adjust(1, &minw, 1, &minh);
edje_object_size_min_restricted_calc(wd->btn, &minw, &minh, minw, minh);
elm_coords_finger_size_adjust(1, &minw, 1, &minh);
evas_object_size_hint_min_set(obj, minw, minh);
evas_object_size_hint_max_set(obj, maxw, maxh);
}

View File

@ -221,7 +221,10 @@ _time_update(Evas_Object *obj)
_signal_clock_val_up, obj);
edje_object_signal_callback_add(wd->digit[i], "elm,action,down", "",
_signal_clock_val_down, obj);
edje_object_size_min_calc(wd->digit[i], &mw, &mh);
mw = mh = -1;
elm_coords_finger_size_adjust(1, &mw, 2, &mh);
edje_object_size_min_restricted_calc(wd->digit[i], &mw, &mh, mw, mh);
elm_coords_finger_size_adjust(1, &mw, 2, &mh);
edje_extern_object_min_size_set(wd->digit[i], mw, mh);
snprintf(buf, sizeof(buf), "d%i", i);
edje_object_part_swallow(wd->clk , buf, wd->digit[i]);
@ -238,7 +241,10 @@ _time_update(Evas_Object *obj)
_signal_clock_val_up, obj);
edje_object_signal_callback_add(wd->ampm, "elm,action,down", "",
_signal_clock_val_down, obj);
edje_object_size_min_calc(wd->ampm, &mw, &mh);
mw = mh = -1;
elm_coords_finger_size_adjust(1, &mw, 2, &mh);
edje_object_size_min_restricted_calc(wd->ampm, &mw, &mh, mw, mh);
elm_coords_finger_size_adjust(1, &mw, 2, &mh);
edje_extern_object_min_size_set(wd->ampm, mw, mh);
edje_object_part_swallow(wd->clk , "ampm", wd->ampm);
evas_object_show(wd->ampm);

View File

@ -4,6 +4,7 @@
typedef struct _Widget_Data Widget_Data;
typedef struct _Item Item;
typedef struct _Item_Block Item_Block;
typedef struct _Pan Pan;
struct _Widget_Data
{
@ -12,6 +13,8 @@ struct _Widget_Data
Evas_Object *content;
Eina_Inlist *items;
Eina_Inlist *blocks;
Pan *pan;
Evas_Coord pan_x, pan_y, minw, minh;
Evas_Bool min_w : 1;
Evas_Bool min_h : 1;
};
@ -20,10 +23,12 @@ struct _Item_Block
{
Eina_Inlist __header;
int count;
Widget_Data *wd;
Evas_Object *obj;
Eina_List *items;
Evas_Coord x, y, w, h;
Evas_Coord x, y, w, h, minw, minh;
Evas_Bool realized : 1;
Evas_Bool changed : 1;
};
struct _Item
@ -31,13 +36,14 @@ struct _Item
Eina_Inlist __header;
Item_Block *block;
Eina_Inlist *subblocks; // not done yet
Eina_List *subitems; // not done yet
Eina_Inlist *subitems; // not done yet
Evas_Coord x, y, w, h;
Evas_Coord x, y, w, h, minw, minh;
Evas_Bool realized : 1;
Evas_Bool selected : 1;
Evas_Bool expanded : 1; // not done yet
Evas_Bool disabled : 1;
Evas_Bool mincalcd : 1;
const Elm_Genlist_Item_Class *itc;
const void *data;
@ -47,6 +53,13 @@ struct _Item
void (*func) (void *data, Evas_Object *obj, void *event_info);
const void *data;
} func;
Evas_Object *base;
};
struct _Pan {
Evas_Object_Smart_Clipped_Data __clipped_data;
Widget_Data *wd;
};
static void _del_hook(Evas_Object *obj);
@ -55,6 +68,8 @@ static void _show_region_hook(void *data, Evas_Object *obj);
static void _sizing_eval(Evas_Object *obj);
static void _sub_del(void *data, Evas_Object *obj, void *event_info);
static Evas_Smart_Class _pan_sc = {NULL};
static void
_del_hook(Evas_Object *obj)
{
@ -139,55 +154,77 @@ _resize(void *data, Evas *e, Evas_Object *obj, void *event_info)
_sizing_eval(data);
}
typedef struct _Pan Pan;
struct _Pan {
int x;
};
static Evas_Smart_Class _pan_sc = {NULL};
static void
_pan_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
{
Pan *sd = evas_object_smart_data_get(obj);
Evas_Coord ow, oh;
if ((x == sd->wd->pan_x) && (y == sd->wd->pan_y)) return;
evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
ow = sd->wd->minw - ow;
if (ow < 0) ow = 0;
oh = sd->wd->minh - oh;
if (oh < 0) oh = 0;
if (x < 0) x = 0;
if (y < 0) y = 0;
if (x > ow) x = ow;
if (y > oh) y = oh;
sd->wd->pan_x = x;
sd->wd->pan_y = y;
evas_object_smart_changed(obj);
}
static void
_pan_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y)
{
Pan *sd = evas_object_smart_data_get(obj);
if (x) *x = sd->wd->pan_x;
if (y) *y = sd->wd->pan_y;
}
static void
_pan_max_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y)
{
Pan *sd = evas_object_smart_data_get(obj);
Evas_Coord ow, oh;
evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
ow = sd->wd->minw - ow;
if (ow < 0) ow = 0;
oh = sd->wd->minh - oh;
if (oh < 0) oh = 0;
if (x) *x = ow;
if (y) *y = oh;
}
static void
_pan_child_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
{
{
Pan *sd = evas_object_smart_data_get(obj);
if (w) *w = sd->wd->minw;
if (h) *h = sd->wd->minh;
}
static void
_pan_add(Evas_Object *obj)
{
Pan *sd;
Evas_Object_Smart_Clipped_Data *cd;
_pan_sc.add(obj);
cd = evas_object_smart_data_get(obj);
sd = calloc(1, sizeof(Pan));
if (!sd) return;
// FIXME: setup sd
sd->__clipped_data = *cd;
free(cd);
evas_object_smart_data_set(obj, sd);
_pan_sc.add(obj);
}
static void
_pan_del(Evas_Object *obj)
{
Pan *sd;
sd = evas_object_smart_data_get(obj);
Pan *sd = evas_object_smart_data_get(obj);
if (!sd) return;
// FIXME: del smart stuff
free(sd);
_pan_sc.del(obj);
}
static void
@ -198,11 +235,204 @@ _pan_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
if ((ow == w) && (oh == h)) return;
evas_object_smart_changed(obj);
}
static void
_item_realize(Item *it, int in)
{
const char *stacking;
if (it->realized) return;
it->base = edje_object_add(evas_object_evas_get(it->block->obj));
// FIXME: hook callbacks
// evas_object_event_callback_add(it->base, EVAS_CALLBACK_MOUSE_DOWN,
// _mouse_down, it);
// evas_object_event_callback_add(it->base, EVAS_CALLBACK_MOUSE_UP,
// _mouse_up, it);
evas_object_smart_member_add(it->base, it->block->wd->pan_smart);
elm_widget_sub_object_add(it->block->obj, it->base);
if (in & 0x1)
_elm_theme_set(it->base, "list", "item_odd", "default");
else
_elm_theme_set(it->base, "list", "item", "default");
stacking = edje_object_data_get(it->base, "stacking");
if (stacking)
{
if (!strcmp(stacking, "below"))
evas_object_lower(it->base);
else if (!strcmp(stacking, "above"))
evas_object_raise(it->base);
}
if (it->itc->func.label_get)
{
char *s = it->itc->func.label_get(it->data, "xxx");
if (s)
{
edje_object_part_text_set(it->base, "elm.text", s);
free(s);
}
}
// FIXME: need to get all labels, all icons and all states and all labels
evas_object_show(it->base);
if (!it->mincalcd)
{
Evas_Coord mw, mh;
mw = mh = -1;
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
edje_object_size_min_restricted_calc(it->base, &mw, &mh, mw, mh);
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
it->minw = mw;
it->minh = mh;
it->mincalcd = 1;
}
it->realized = 1;
}
static void
_item_unrealize(Item *it)
{
if (!it->realized) return;
evas_object_del(it->base);
it->base = NULL;
it->realized = 0;
}
static void
_item_block_recalc(Item_Block *itb, int in)
{
Eina_List *l;
Evas_Coord minw = 0, minh = 0;
for (l = itb->items; l; l = l->next)
{
Item *it = l->data;
_item_realize(it, in);
if (!itb->realized) _item_unrealize(it);
minh += it->minh;
if (minw < it->minw) minw = it->minw;
in++;
}
itb->minw = minw;
itb->minh = minh;
itb->changed = 0;
}
static void
_item_block_realize(Item_Block *itb, int in)
{
Eina_List *l;
if (itb->realized) return;
for (l = itb->items; l; l = l->next)
{
Item *it = l->data;
_item_realize(it, in);
in++;
}
itb->realized = 1;
}
static void
_item_block_unrealize(Item_Block *itb)
{
Eina_List *l;
if (!itb->realized) return;
for (l = itb->items; l; l = l->next)
{
Item *it = l->data;
_item_unrealize(it);
}
itb->realized = 0;
}
static void
_item_block_position(Item_Block *itb)
{
Eina_List *l;
Evas_Coord y = 0, ox, oy;
evas_object_geometry_get(itb->wd->pan_smart, &ox, &oy, NULL, NULL);
for (l = itb->items; l; l = l->next)
{
Item *it = l->data;
it->x = 0;
it->y = y;
it->w = itb->w;
it->h = it->minh;
evas_object_resize(it->base, it->w, it->h);
evas_object_move(it->base,
ox + itb->x + it->x - itb->wd->pan_x,
oy + itb->y + it->y - itb->wd->pan_y);
y += it->h;
}
itb->realized = 1;
}
static void
_pan_calculate(Evas_Object *obj)
{
Pan *sd = evas_object_smart_data_get(obj);
Eina_Inlist *il;
Evas_Coord minw = 0, minh = 0, x = 0, y = 0, ow, oh;
int bn, in;
for (bn = 0, in = 0, il = sd->wd->blocks; il; il = il->next, bn++)
{
Item_Block *itb = (Item_Block *)il;
if (itb->changed)
_item_block_recalc(itb, in);
itb->y = y;
itb->x = 0;
itb->w = itb->minw;
itb->h = itb->minh;
minh += itb->minh;
if (minw < itb->minw) minw = itb->minw;
itb->h = itb->minh;
y += itb->minh;
in += itb->count;
}
evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
if (minw < ow) minw = ow;
if ((minw != sd->wd->minw) || (minh != sd->wd->minh))
{
sd->wd->minw = minw;
sd->wd->minh = minh;
evas_object_smart_callback_call(obj, "changed", NULL);
}
// FIXME: calcualte new geom
for (bn = 0, in = 0, il = sd->wd->blocks; il; il = il->next, bn++)
{
Item_Block *itb = (Item_Block *)il;
itb->w = minw;
if (ELM_RECTS_INTERSECT(itb->x - sd->wd->pan_x,
itb->y - sd->wd->pan_y,
itb->w, itb->h,
0, 0, ow, oh))
{
if (!itb->realized)
{
printf("REALIZE BN # %i [%i %i, %ix%i]\n", bn, itb->x, itb->y, itb->w, itb->h);
_item_block_realize(itb, in);
}
_item_block_position(itb);
}
else
{
if (itb->realized)
{
printf("UNREALIZE BN # %i [%i %i, %ix%i]\n", bn, itb->x, itb->y, itb->w, itb->h);
_item_block_unrealize(itb);
}
}
in += itb->count;
}
}
EAPI Evas_Object *
@ -226,26 +456,23 @@ elm_genlist_add(Evas_Object *parent)
if (!smart)
{
static Evas_Smart_Class sc = { "Elm_Genlist_Pan", EVAS_SMART_CLASS_VERSION, };
static Evas_Smart_Class sc;
evas_object_smart_clipped_smart_set(&_pan_sc);
sc = _pan_sc;
sc.name = "Elm_Genlist_Pan";
sc.version = EVAS_SMART_CLASS_VERSION;
sc.add = _pan_add;
sc.del = _pan_del;
sc.move = _pan_sc.move;
sc.resize = _pan_resize;
sc.show = _pan_sc.show;
sc.hide = _pan_sc.hide;
sc.color_set = _pan_sc.color_set;
sc.clip_set = _pan_sc.clip_set;
sc.clip_unset = _pan_sc.clip_unset;
sc.calculate = _pan_calculate;
sc.member_add = _pan_sc.member_add;
sc.member_del = _pan_sc.member_del;
smart = evas_smart_class_new(&sc);
}
wd->pan_smart = evas_object_smart_add(e, smart);
// FIXME: init the pan
if (smart)
{
wd->pan_smart = evas_object_smart_add(e, smart);
wd->pan = evas_object_smart_data_get(wd->pan_smart);
wd->pan->wd = wd;
}
elm_smart_scroller_extern_pan_set(wd->scr, wd->pan_smart,
_pan_set, _pan_get,
@ -280,6 +507,32 @@ _item_new(Evas_Object *obj, const Elm_Genlist_Item_Class *itc,
return it;
}
static void
_item_block_add(Widget_Data *wd, Evas_Object *obj, Item *it, Item *itpar, Item *itrel)
{
Item_Block *itb;
if (!itrel) /* new block */
{
newblock:
itb = calloc(1, sizeof(Item_Block));
if (!itb) return;
wd->blocks = eina_inlist_append(wd->blocks, (Eina_Inlist *)itb);
itb->obj = obj;
itb->wd = wd;
}
else
{
itb = itrel->block;
if (itb->count > 32) goto newblock;
}
itb->items = eina_list_append(itb->items, it);
itb->count++;
itb->changed = 1;
it->block = itb;
evas_object_smart_changed(wd->pan_smart);
}
EAPI Elm_Genlist_Item *
elm_genlist_item_append(Evas_Object *obj, const Elm_Genlist_Item_Class *itc,
const void *data, Elm_Genlist_Item *parent,
@ -287,9 +540,21 @@ elm_genlist_item_append(Evas_Object *obj, const Elm_Genlist_Item_Class *itc,
void (*func) (void *data, Evas_Object *obj, void *event_info), const void *func_data)
{
Widget_Data *wd = elm_widget_data_get(obj);
Item *itpar, *itrel;
Item *it = _item_new(obj, itc, data, parent, flags, func, func_data);
if (!it) return NULL;
wd->items = eina_inlist_append(wd->items, (Eina_Inlist *)it);
if (!parent)
{
wd->items = eina_inlist_append(wd->items, (Eina_Inlist *)it);
itrel = (Item *)(((Eina_Inlist *)it)->prev);
_item_block_add(wd, obj, it, NULL, itrel);
}
else
{
// FIXME: tree. not done yet
itpar = (Item *)parent;
itpar->subitems = eina_inlist_append(itpar->subitems, (Eina_Inlist *)it);
}
return (Elm_Genlist_Item *)it;
}

View File

@ -84,8 +84,8 @@ static void
_changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Widget_Data *wd = elm_widget_data_get(data);
_fix_items(data);
_sizing_eval(data);
// _fix_items(data);
// _sizing_eval(data);
}
static void
@ -304,20 +304,23 @@ _fix_items(Evas_Object *obj)
}
if (it->icon)
{
edje_extern_object_aspect_set(it->icon, EDJE_ASPECT_CONTROL_VERTICAL, minw[0], minh[0]);
edje_extern_object_min_size_set(it->icon, minw[0], minh[0]);
evas_object_size_hint_min_set(it->icon, minw[0], minh[0]);
evas_object_size_hint_max_set(it->icon, 99999, 99999);
edje_object_part_swallow(it->base, "elm.swallow.icon", it->icon);
}
if (it->end)
{
edje_extern_object_aspect_set(it->end, EDJE_ASPECT_CONTROL_VERTICAL, minw[1], minh[1]);
edje_extern_object_min_size_set(it->end, minw[1], minh[1]);
evas_object_size_hint_min_set(it->end, minw[1], minh[1]);
evas_object_size_hint_max_set(it->end, 99999, 99999);
edje_object_part_swallow(it->base, "elm.swallow.end", it->end);
}
if (!it->fixed)
{
edje_object_message_signal_process(it->base);
edje_object_size_min_calc(it->base, &mw, &mh);
mw = mh = -1;
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
edje_object_size_min_restricted_calc(it->base, &mw, &mh, mw, mh);
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
evas_object_size_hint_min_set(it->base, mw, mh);
evas_object_show(it->base);
}

View File

@ -78,7 +78,8 @@ elm_init(int argc, char **argv)
{
int i;
const char *elm_engine, *elm_scale, *elm_theme, *elm_prefix, *elm_data_dir;
const char *elm_font_hinting, *elm_font_path, *elm_image_cache, *elm_font_cache;
const char *elm_font_hinting, *elm_font_path, *elm_image_cache;
const char *elm_font_cache, *elm_finger_size;
char buf[PATH_MAX];
eet_init();
@ -102,6 +103,7 @@ elm_init(int argc, char **argv)
elm_font_path = getenv("ELM_FONT_PATH");
elm_image_cache = getenv("ELM_IMAGE_CACHE");
elm_font_cache = getenv("ELM_FONT_CACHE");
elm_finger_size = getenv("ELM_FINGER_SIZE");
if (!_elm_data_dir)
{
@ -197,6 +199,7 @@ elm_init(int argc, char **argv)
_elm_config->font_dirs = NULL;
_elm_config->image_cache = 4096;
_elm_config->font_cache = 512;
_elm_config->finger_size = 40;
_elm_config->bgpixmap = 0;
_elm_config->compositing = 1;
@ -283,6 +286,12 @@ elm_init(int argc, char **argv)
if (elm_font_cache)
_elm_config->font_cache = atoi(elm_font_cache);
_elm_config->finger_size =
(double)_elm_config->finger_size * _elm_config->scale;
if (elm_finger_size)
_elm_config->finger_size =
(double)(atoi(elm_finger_size)) * _elm_config->scale;
/* FIXME: implement quickstart below */
/* if !quickstart return
@ -374,3 +383,12 @@ elm_object_focus(Evas_Object *obj)
{
elm_widget_focus_set(obj, 1);
}
EAPI void
elm_coords_finger_size_adjust(int times_w, Evas_Coord *w, int times_h, Evas_Coord *h)
{
if ((w) && (*w < (_elm_config->finger_size * times_w)))
*w = _elm_config->finger_size * times_w;
if ((h) && (*h < (_elm_config->finger_size * times_h)))
*h = _elm_config->finger_size * times_h;
}

View File

@ -40,7 +40,9 @@ _sizing_eval(Evas_Object *obj)
wd->size * elm_widget_scale_get(obj) * _elm_config->scale,
wd->size * elm_widget_scale_get(obj) * _elm_config->scale);
edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->img);
edje_object_size_min_calc(wd->frm, &minw, &minh);
elm_coords_finger_size_adjust(1, &minw, 1, &minh);
edje_object_size_min_restricted_calc(wd->frm, &minw, &minh, minw, minh);
elm_coords_finger_size_adjust(1, &minw, 1, &minh);
maxw = minw;
maxh = minh;
evas_object_size_hint_min_set(obj, minw, minh);

View File

@ -48,6 +48,7 @@ struct _Elm_Config
int font_hinting;
int image_cache;
int font_cache;
Evas_Coord finger_size;
};
#define ELM_NEW(t) calloc(1, sizeof(t))

View File

@ -78,7 +78,9 @@ _sizing_eval(Evas_Object *obj)
Widget_Data *wd = elm_widget_data_get(obj);
Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
edje_object_size_min_calc(wd->slider, &minw, &minh);
elm_coords_finger_size_adjust(1, &minw, 1, &minh);
edje_object_size_min_restricted_calc(wd->slider, &minw, &minh, minw, minh);
elm_coords_finger_size_adjust(1, &minw, 1, &minh);
evas_object_size_hint_min_set(obj, minw, minh);
evas_object_size_hint_max_set(obj, maxw, maxh);
}

View File

@ -62,7 +62,9 @@ _sizing_eval(Evas_Object *obj)
Widget_Data *wd = elm_widget_data_get(obj);
Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
edje_object_size_min_calc(wd->tgl, &minw, &minh);
elm_coords_finger_size_adjust(1, &minw, 1, &minh);
edje_object_size_min_restricted_calc(wd->tgl, &minw, &minh, minw, minh);
elm_coords_finger_size_adjust(1, &minw, 1, &minh);
evas_object_size_hint_min_set(obj, minw, minh);
evas_object_size_hint_max_set(obj, maxw, maxh);
}
@ -73,6 +75,8 @@ _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info)
Widget_Data *wd = elm_widget_data_get(data);
if (obj != wd->icon) return;
edje_object_part_swallow(wd->tgl, "elm.swallow.content", obj);
Evas_Coord mw, mh;
evas_object_size_hint_min_get(obj, &mw, &mh);
_sizing_eval(data);
}
@ -173,6 +177,9 @@ elm_toggle_icon_set(Evas_Object *obj, Evas_Object *icon)
{
elm_widget_sub_object_add(obj, icon);
edje_object_part_swallow(wd->tgl, "elm.swallow.content", icon);
Evas_Coord mw, mh;
evas_object_size_hint_min_get(wd->icon, &mw, &mh);
printf("%ix%i\n", mw, mh);
edje_object_signal_emit(wd->tgl, "elm,state,icon,visible", "elm");
evas_object_event_callback_add(icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
_changed_size_hints, obj);

View File

@ -101,7 +101,10 @@ _theme_hook(Evas_Object *obj)
edje_object_part_swallow(it->base, "elm.swallow.icon", it->icon);
}
edje_object_part_text_set(it->base, "elm.text", it->label);
edje_object_size_min_calc(it->base, &mw, &mh);
mw = mh = -1;
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
edje_object_size_min_restricted_calc(it->base, &mw, &mh, mw, mh);
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
evas_object_size_hint_min_set(it->base, mw, mh);
evas_object_size_hint_max_set(it->base, 9999, mh);
}
@ -234,7 +237,10 @@ elm_toolbar_item_add(Evas_Object *obj, Evas_Object *icon, const char *label, voi
elm_widget_sub_object_add(obj, it->icon);
}
edje_object_part_text_set(it->base, "elm.text", it->label);
edje_object_size_min_calc(it->base, &mw, &mh);
mw = mh = -1;
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
edje_object_size_min_restricted_calc(it->base, &mw, &mh, mw, mh);
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
evas_object_size_hint_weight_set(it->base, 0.0, 0.0);
evas_object_size_hint_align_set(it->base, -1.0, -1.0);
evas_object_size_hint_min_set(it->base, mw, mh);