use new fill mode, fix bug in object tracking and deletion - nasty one. more

genlist work too.



SVN revision: 39021
This commit is contained in:
Carsten Haitzler 2009-02-15 02:53:56 +00:00
parent bb9742a604
commit 1d36bea662
6 changed files with 140 additions and 29 deletions

View File

@ -201,6 +201,7 @@ collections {
normal: "bt_sm_base2.png"; normal: "bt_sm_base2.png";
border: 6 6 6 6; border: 6 6 6 6;
} }
image.middle: SOLID;
} }
} }
part { name: "sb_vbar_over1"; part { name: "sb_vbar_over1";
@ -298,6 +299,7 @@ collections {
normal: "bt_sm_base2.png"; normal: "bt_sm_base2.png";
border: 6 6 6 6; border: 6 6 6 6;
} }
image.middle: SOLID;
} }
} }
part { name: "sb_hbar_over1"; part { name: "sb_hbar_over1";
@ -454,10 +456,12 @@ collections {
normal: "bt_base2.png"; normal: "bt_base2.png";
border: 7 7 7 7; border: 7 7 7 7;
} }
image.middle: SOLID;
} }
description { state: "clicked" 0.0; description { state: "clicked" 0.0;
inherit: "default" 0.0; inherit: "default" 0.0;
image.normal: "bt_base1.png"; image.normal: "bt_base1.png";
image.middle: SOLID;
} }
} }
part { name: "elm.swallow.content"; part { name: "elm.swallow.content";
@ -654,10 +658,12 @@ collections {
normal: "bt_base2.png"; normal: "bt_base2.png";
border: 7 7 7 7; border: 7 7 7 7;
} }
image.middle: SOLID;
} }
description { state: "clicked" 0.0; description { state: "clicked" 0.0;
inherit: "default" 0.0; inherit: "default" 0.0;
image.normal: "bt_base1.png"; image.normal: "bt_base1.png";
image.middle: SOLID;
} }
} }
part { name: "arrow"; part { name: "arrow";
@ -1199,6 +1205,7 @@ collections {
normal: "bt_bases.png"; normal: "bt_bases.png";
border: 11 11 11 11; border: 11 11 11 11;
} }
image.middle: SOLID;
color: 255 255 255 128; color: 255 255 255 128;
} }
} }
@ -1214,6 +1221,7 @@ collections {
normal: "bt_basew.png"; normal: "bt_basew.png";
border: 7 7 7 7; border: 7 7 7 7;
} }
image.middle: SOLID;
} }
} }
part { name: "button3"; part { name: "button3";
@ -3000,6 +3008,7 @@ collections {
normal: "bt_dis_base.png"; normal: "bt_dis_base.png";
border: 4 4 4 4; border: 4 4 4 4;
} }
image.middle: SOLID;
} }
description { state: "visible" 0.0; description { state: "visible" 0.0;
inherit: "default" 0.0; inherit: "default" 0.0;
@ -3058,6 +3067,7 @@ collections {
normal: "bt_dis_base.png"; normal: "bt_dis_base.png";
border: 4 4 4 4; border: 4 4 4 4;
} }
image.middle: SOLID;
} }
description { state: "visible" 0.0; description { state: "visible" 0.0;
inherit: "default" 0.0; inherit: "default" 0.0;
@ -3116,6 +3126,7 @@ collections {
normal: "bt_dis_base.png"; normal: "bt_dis_base.png";
border: 4 4 4 4; border: 4 4 4 4;
} }
image.middle: SOLID;
} }
description { state: "visible" 0.0; description { state: "visible" 0.0;
inherit: "default" 0.0; inherit: "default" 0.0;
@ -3175,6 +3186,7 @@ collections {
normal: "bt_dis_base.png"; normal: "bt_dis_base.png";
border: 4 4 4 4; border: 4 4 4 4;
} }
image.middle: SOLID;
} }
description { state: "visible" 0.0; description { state: "visible" 0.0;
inherit: "default" 0.0; inherit: "default" 0.0;
@ -3235,6 +3247,7 @@ collections {
normal: "bt_dis_base.png"; normal: "bt_dis_base.png";
border: 4 4 4 4; border: 4 4 4 4;
} }
image.middle: SOLID;
} }
} }
part { name: "elm.swallow.slot.middle"; part { name: "elm.swallow.slot.middle";
@ -3398,6 +3411,7 @@ collections {
normal: "bt_base2.png"; normal: "bt_base2.png";
border: 7 7 7 7; border: 7 7 7 7;
} }
image.middle: SOLID;
} }
} }
@ -4106,6 +4120,7 @@ collections {
normal: "bubble_3.png"; normal: "bubble_3.png";
border: 36 11 18 9; border: 36 11 18 9;
} }
image.middle: SOLID;
fill.smooth: 0; fill.smooth: 0;
} }
} }
@ -4232,6 +4247,7 @@ collections {
normal: "bubble_4.png"; normal: "bubble_4.png";
border: 11 36 18 9; border: 11 36 18 9;
} }
image.middle: SOLID;
fill.smooth: 0; fill.smooth: 0;
} }
} }
@ -4358,6 +4374,7 @@ collections {
normal: "bubble_1.png"; normal: "bubble_1.png";
border: 36 11 10 19; border: 36 11 10 19;
} }
image.middle: SOLID;
fill.smooth: 0; fill.smooth: 0;
} }
} }
@ -4484,6 +4501,7 @@ collections {
normal: "bubble_2.png"; normal: "bubble_2.png";
border: 11 36 10 19; border: 11 36 10 19;
} }
image.middle: SOLID;
fill.smooth: 0; fill.smooth: 0;
} }
} }
@ -4658,6 +4676,7 @@ collections {
normal: "bt_dis_base.png"; normal: "bt_dis_base.png";
border: 4 4 4 4; border: 4 4 4 4;
} }
image.middle: SOLID;
} }
} }
part { name: "clipper"; part { name: "clipper";
@ -4806,6 +4825,7 @@ collections {
normal: "toolbar_sel.png"; normal: "toolbar_sel.png";
border: 3 3 0 0; border: 3 3 0 0;
} }
image.middle: SOLID;
fill.smooth: 0; fill.smooth: 0;
} }
description { state: "selected" 0.0; description { state: "selected" 0.0;
@ -4940,6 +4960,7 @@ collections {
normal: "bt_dis_base.png"; normal: "bt_dis_base.png";
border: 4 4 4 4; border: 4 4 4 4;
} }
image.middle: SOLID;
} }
} }
part { name: "popover"; part { name: "popover";
@ -5020,6 +5041,7 @@ collections {
normal: "bt_dis_base.png"; normal: "bt_dis_base.png";
border: 4 4 4 4; border: 4 4 4 4;
} }
image.middle: SOLID;
} }
} }
part { name: "popover"; part { name: "popover";
@ -5101,6 +5123,7 @@ collections {
normal: "bt_dis_base.png"; normal: "bt_dis_base.png";
border: 4 4 4 4; border: 4 4 4 4;
} }
image.middle: SOLID;
} }
} }
part { name: "popover"; part { name: "popover";
@ -5207,6 +5230,7 @@ collections {
normal: "bt_sm_base1.png"; normal: "bt_sm_base1.png";
border: 6 6 6 6; border: 6 6 6 6;
} }
image.middle: SOLID;
} }
description { state: "selected" 0.0; description { state: "selected" 0.0;
inherit: "default" 0.0; inherit: "default" 0.0;
@ -5398,6 +5422,7 @@ collections {
normal: "bt_sm_base1.png"; normal: "bt_sm_base1.png";
border: 6 6 6 6; border: 6 6 6 6;
} }
image.middle: SOLID;
} }
description { state: "selected" 0.0; description { state: "selected" 0.0;
inherit: "default" 0.0; inherit: "default" 0.0;
@ -5614,6 +5639,7 @@ collections {
normal: "bt_sm_base1.png"; normal: "bt_sm_base1.png";
border: 6 6 6 6; border: 6 6 6 6;
} }
image.middle: SOLID;
} }
description { state: "selected" 0.0; description { state: "selected" 0.0;
inherit: "default" 0.0; inherit: "default" 0.0;
@ -5803,6 +5829,7 @@ collections {
normal: "bt_sm_base1.png"; normal: "bt_sm_base1.png";
border: 6 6 6 6; border: 6 6 6 6;
} }
image.middle: SOLID;
} }
description { state: "selected" 0.0; description { state: "selected" 0.0;
inherit: "default" 0.0; inherit: "default" 0.0;
@ -7089,6 +7116,7 @@ collections {
normal: "bt_sm_base1.png"; normal: "bt_sm_base1.png";
border: 6 6 6 6; border: 6 6 6 6;
} }
image.middle: SOLID;
} }
description { state: "selected" 0.0; description { state: "selected" 0.0;
inherit: "default" 0.0; inherit: "default" 0.0;
@ -7283,6 +7311,7 @@ collections {
normal: "bt_sm_base1.png"; normal: "bt_sm_base1.png";
border: 6 6 6 6; border: 6 6 6 6;
} }
image.middle: SOLID;
} }
description { state: "selected" 0.0; description { state: "selected" 0.0;
inherit: "default" 0.0; inherit: "default" 0.0;

View File

@ -2046,25 +2046,36 @@ my_bt_28(void *data, Evas_Object *obj, void *event_info)
} }
static Elm_Genlist_Item_Class itc1; static Elm_Genlist_Item_Class itc1;
char *gl_label_get(const void *data, const char *part) char *gl_label_get(const void *data, Evas_Object *obj, const char *part)
{ {
char buf[256]; char buf[256];
snprintf(buf, sizeof(buf), "Item # %i", (int)data); snprintf(buf, sizeof(buf), "Item # %i", (int)data);
return strdup(buf); return strdup(buf);
} }
Evas_Object *gl_icon_get(const void *data, const char *part) Evas_Object *gl_icon_get(const void *data, Evas_Object *obj, const char *part)
{ {
return NULL; char buf[PATH_MAX];
#if 1
Evas_Object *ic = elm_icon_add(obj);
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
elm_icon_file_set(ic, buf, NULL);
#else
Evas_Object *ic = evas_object_image_filled_add(evas_object_evas_get(obj));
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
evas_object_image_file_set(ic, buf, NULL);
#endif
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
return ic;
} }
Evas_Bool gl_state_get(const void *data, const char *part) Evas_Bool gl_state_get(const void *data, Evas_Object *obj, const char *part)
{ {
return 0; return 0;
} }
void gl_del(const void *data) void gl_del(const void *data, Evas_Object *obj)
{ {
} }
static void static void
my_bt_29(void *data, Evas_Object *obj, void *event_info) my_bt_29(void *data, Evas_Object *obj, void *event_info)
{ {
@ -2210,7 +2221,7 @@ my_win_main(void)
elm_list_go(li); elm_list_go(li);
/* set an initial window size */ /* set an initial window size */
evas_object_resize(win, 312, 480); evas_object_resize(win, 240, 480);
/* show the window */ /* show the window */
evas_object_show(win); evas_object_show(win);
} }

View File

@ -507,10 +507,10 @@ extern "C" {
{ {
const char *style; const char *style;
struct { struct {
char *(*label_get) (const void *data, const char *part); char *(*label_get) (const void *data, Evas_Object *obj, const char *part);
Evas_Object *(*icon_get) (const void *data, const char *part); Evas_Object *(*icon_get) (const void *data, Evas_Object *obj, const char *part);
Evas_Bool (*state_get) (const void *data, const char *part); Evas_Bool (*state_get) (const void *data, Evas_Object *obj, const char *part);
void (*del) (const void *data); void (*del) (const void *data, Evas_Object *obj);
} func; } func;
}; };

View File

@ -11,7 +11,6 @@ struct _Widget_Data
Evas_Object *obj; Evas_Object *obj;
Evas_Object *scr; Evas_Object *scr;
Evas_Object *pan_smart; Evas_Object *pan_smart;
Evas_Object *content;
Eina_Inlist *items; Eina_Inlist *items;
Eina_Inlist *blocks; Eina_Inlist *blocks;
Pan *pan; Pan *pan;
@ -53,6 +52,7 @@ struct _Item
Evas_Object *base; Evas_Object *base;
Eina_List *labels, *icons, *states; Eina_List *labels, *icons, *states;
Eina_List *icon_objs;
Evas_Bool realized : 1; Evas_Bool realized : 1;
Evas_Bool selected : 1; Evas_Bool selected : 1;
@ -80,6 +80,20 @@ static void
_del_hook(Evas_Object *obj) _del_hook(Evas_Object *obj)
{ {
Widget_Data *wd = elm_widget_data_get(obj); Widget_Data *wd = elm_widget_data_get(obj);
/*
while (wd->blocks)
{
Item_Block *itb = wd->blocks;
while (itb->items)
{
Item *it = itb->items->data;
}
free(itb);
}
*/
evas_object_del(wd->pan_smart);
wd->pan_smart = NULL;
free(wd); free(wd);
} }
@ -108,6 +122,7 @@ _sizing_eval(Evas_Object *obj)
Evas_Coord vw, vh, minw, minh, maxw, maxh, w, h, vmw, vmh; Evas_Coord vw, vh, minw, minh, maxw, maxh, w, h, vmw, vmh;
double xw, xy; double xw, xy;
/*
evas_object_size_hint_min_get(wd->content, &minw, &minh); evas_object_size_hint_min_get(wd->content, &minw, &minh);
evas_object_size_hint_max_get(wd->content, &maxw, &maxh); evas_object_size_hint_max_get(wd->content, &maxw, &maxh);
evas_object_size_hint_weight_get(wd->content, &xw, &xy); evas_object_size_hint_weight_get(wd->content, &xw, &xy);
@ -131,6 +146,7 @@ _sizing_eval(Evas_Object *obj)
if (wd->min_w) w = vmw + minw; if (wd->min_w) w = vmw + minw;
if (wd->min_h) h = vmh + minh; if (wd->min_h) h = vmh + minh;
evas_object_size_hint_min_set(obj, w, h); evas_object_size_hint_min_set(obj, w, h);
*/
} }
static void static void
@ -138,7 +154,7 @@ _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info)
{ {
_sizing_eval(data); _sizing_eval(data);
} }
/*
static void static void
_sub_del(void *data, Evas_Object *obj, void *event_info) _sub_del(void *data, Evas_Object *obj, void *event_info)
{ {
@ -153,7 +169,7 @@ _sub_del(void *data, Evas_Object *obj, void *event_info)
_sizing_eval(obj); _sizing_eval(obj);
} }
} }
*/
static void static void
_resize(void *data, Evas *e, Evas_Object *obj, void *event_info) _resize(void *data, Evas *e, Evas_Object *obj, void *event_info)
{ {
@ -233,7 +249,7 @@ _item_realize(Item *it, int in, int calc)
for (l = it->labels; l; l = l->next) for (l = it->labels; l; l = l->next)
{ {
const char *key = l->data; const char *key = l->data;
char *s = it->itc->func.label_get(it->data, l->data); char *s = it->itc->func.label_get(it->data, it->wd->obj, l->data);
if (s) if (s)
{ {
edje_object_part_text_set(it->base, l->data, s); edje_object_part_text_set(it->base, l->data, s);
@ -241,6 +257,39 @@ _item_realize(Item *it, int in, int calc)
} }
} }
} }
if (it->itc->func.icon_get)
{
Eina_List *l;
it->icons = _stringlist_get(edje_object_data_get(it->base, "icons"));
for (l = it->icons; l; l = l->next)
{
const char *key = l->data;
Evas_Object *ic = it->itc->func.icon_get(it->data, it->wd->obj, l->data);
if (ic)
{
it->icon_objs = eina_list_append(it->icon_objs, ic);
edje_object_part_swallow(it->base, key, ic);
evas_object_show(ic);
elm_widget_sub_object_add(it->wd->obj, ic);
}
}
}
if (it->itc->func.state_get)
{
Eina_List *l;
it->states = _stringlist_get(edje_object_data_get(it->base, "states"));
for (l = it->states; l; l = l->next)
{
const char *key = l->data;
Evas_Bool on = it->itc->func.state_get(it->data, it->wd->obj, l->data);
if (on)
{
// FIXME: emit to base
}
}
}
if (!it->mincalcd) if (!it->mincalcd)
{ {
Evas_Coord mw = -1, mh = -1; Evas_Coord mw = -1, mh = -1;
@ -266,6 +315,11 @@ _item_unrealize(Item *it)
_stringlist_free(it->icons); _stringlist_free(it->icons);
it->icons = NULL; it->icons = NULL;
_stringlist_free(it->states); _stringlist_free(it->states);
while (it->icon_objs)
{
evas_object_del(it->icon_objs->data);
it->icon_objs = eina_list_remove_list(it->icon_objs, it->icon_objs);
}
it->states = NULL; it->states = NULL;
it->realized = 0; it->realized = 0;
} }
@ -530,7 +584,7 @@ elm_genlist_add(Evas_Object *parent)
static Evas_Smart_Class sc; static Evas_Smart_Class sc;
evas_object_smart_clipped_smart_set(&_pan_sc); evas_object_smart_clipped_smart_set(&_pan_sc);
sc = _pan_sc; sc = _pan_sc;
sc.name = "Elm_Genlist_Pan"; sc.name = "elm_genlist_pan";
sc.version = EVAS_SMART_CLASS_VERSION; sc.version = EVAS_SMART_CLASS_VERSION;
sc.add = _pan_add; sc.add = _pan_add;
sc.del = _pan_del; sc.del = _pan_del;
@ -552,9 +606,9 @@ elm_genlist_add(Evas_Object *parent)
edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr), &minw, &minh); edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr), &minw, &minh);
evas_object_size_hint_min_set(obj, minw, minh); evas_object_size_hint_min_set(obj, minw, minh);
evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _resize, obj); evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _resize, obj);
/*
// evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj); evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
*/
_sizing_eval(obj); _sizing_eval(obj);
return obj; return obj;
} }
@ -756,7 +810,7 @@ elm_genlist_item_selected_set(Elm_Genlist_Item *item, Evas_Bool selected)
EAPI void EAPI void
elm_genlist_item_expanded_set(Elm_Genlist_Item *item, Evas_Bool expanded) elm_genlist_item_expanded_set(Elm_Genlist_Item *item, Evas_Bool expanded)
{ {
// not done yet // FIXME: not done yet
} }
EAPI void EAPI void
@ -778,3 +832,14 @@ EAPI const void *
elm_genlist_item_data_get(Elm_Genlist_Item *item) elm_genlist_item_data_get(Elm_Genlist_Item *item)
{ {
} }
EAPI const Evas_Object *
elm_genlist_item_icon_get(Elm_Genlist_Item *item)
{
}
EAPI void
elm_genlist_item_update(Elm_Genlist_Item *item)
{
// call all the class get funcs again - re realize if realized.
}

View File

@ -1,7 +1,7 @@
#include <Elementary.h> #include <Elementary.h>
#include "elm_priv.h" #include "elm_priv.h"
#define SMART_NAME "e_widget" #define SMART_NAME "elm_widget"
#define API_ENTRY \ #define API_ENTRY \
Smart_Data *sd = evas_object_smart_data_get(obj); \ Smart_Data *sd = evas_object_smart_data_get(obj); \
if ((!obj) || (!sd) || \ if ((!obj) || (!sd) || \
@ -766,17 +766,19 @@ _smart_del(Evas_Object *obj)
if (sd->del_pre_func) sd->del_pre_func(obj); if (sd->del_pre_func) sd->del_pre_func(obj);
if (sd->resize_obj) if (sd->resize_obj)
{ {
evas_object_event_callback_del(sd->resize_obj, EVAS_CALLBACK_DEL, _sub_obj_del); sobj = sd->resize_obj;
sd->resize_obj = NULL; sd->resize_obj = NULL;
evas_object_event_callback_del(sobj, EVAS_CALLBACK_DEL, _sub_obj_del);
evas_object_smart_callback_call(sd->obj, "sub-object-del", sd->resize_obj); evas_object_smart_callback_call(sd->obj, "sub-object-del", sd->resize_obj);
evas_object_del(sd->resize_obj); evas_object_del(sobj);
} }
if (sd->hover_obj) if (sd->hover_obj)
{ {
evas_object_event_callback_del(sd->hover_obj, EVAS_CALLBACK_DEL, _sub_obj_del); sobj = sd->resize_obj;
sd->hover_obj = NULL; sd->hover_obj = NULL;
evas_object_smart_callback_call(sd->obj, "sub-object-del", sd->hover_obj); evas_object_event_callback_del(sobj, EVAS_CALLBACK_DEL, _sub_obj_del);
evas_object_del(sd->hover_obj); evas_object_smart_callback_call(sd->obj, "sub-object-del", sobj);
evas_object_del(sobj);
} }
while (sd->subobjs) while (sd->subobjs)
{ {

View File

@ -62,10 +62,14 @@ _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_inf
if (win->deferred_child_eval_job) ecore_job_del(win->deferred_child_eval_job); if (win->deferred_child_eval_job) ecore_job_del(win->deferred_child_eval_job);
while (evas_object_bottom_get(win->evas) && while (evas_object_bottom_get(win->evas) &&
(evas_object_bottom_get(win->evas) != obj)) (evas_object_bottom_get(win->evas) != obj))
{
evas_object_del(evas_object_bottom_get(win->evas)); evas_object_del(evas_object_bottom_get(win->evas));
}
while (evas_object_top_get(win->evas) && while (evas_object_top_get(win->evas) &&
(evas_object_top_get(win->evas) != obj)) (evas_object_top_get(win->evas) != obj))
{
evas_object_del(evas_object_top_get(win->evas)); evas_object_del(evas_object_top_get(win->evas));
}
// FIXME: we are in the del handler for the object and delete the canvas // FIXME: we are in the del handler for the object and delete the canvas
// that lives under it from the handler... nasty. deferring doesnt help either // that lives under it from the handler... nasty. deferring doesnt help either
ecore_job_add(_deferred_ecore_evas_free, win->ee); ecore_job_add(_deferred_ecore_evas_free, win->ee);