From: Carsten Haitzler Date: Tue, 10 Feb 2009 11:57:47 +0000 (+0000) Subject: adjust slider theme a bit and test app. some skleton work on genlist. X-Git-Tag: v1.0.0~5485 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=718c188c825aae958f494f3c41b7f7201aa91047;p=platform%2Fupstream%2Felementary.git adjust slider theme a bit and test app. some skleton work on genlist. SVN revision: 38992 --- diff --git a/data/themes/default.edc b/data/themes/default.edc index 0a2161e..3c9058d 100644 --- a/data/themes/default.edc +++ b/data/themes/default.edc @@ -5984,6 +5984,7 @@ collections { type: RECT; mouse_events: 0; description { state: "default" 0.0; + fixed: 1 1; rel1.to: "base"; rel2 { to_y: "base"; @@ -6001,6 +6002,7 @@ collections { type: RECT; mouse_events: 0; description { state: "default" 0.0; + fixed: 1 1; visible: 0; rel1 { to_y: "base"; @@ -6163,7 +6165,7 @@ collections { } part { name: "elm.dragable.slider"; type: RECT; - mouse_events: 1; + mouse_events: 0; scale: 1; dragable { x: 1 1 0; @@ -6171,8 +6173,8 @@ collections { confine: "bg"; } description { state: "default" 0.0; - min: 24 24; - max: 24 24; + min: 0 24; + max: 0 24; fixed: 1 1; rel1 { relative: 0.5 0.5; @@ -6185,9 +6187,26 @@ collections { color: 0 0 0 0; } } + part { name: "button_events"; + type: RECT; + dragable { + 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"; + color: 0 0 0 0; + } + } part { name: "button0"; mouse_events: 0; description { state: "default" 0.0; + fixed: 1 1; max: 17 999; min: 17 24; rel1.to: "elm.dragable.slider"; @@ -6229,6 +6248,7 @@ collections { part { name: "button3"; mouse_events: 0; description { state: "default" 0.0; + fixed: 1 1; visible: 0; min: 8 32; align: 1.0 0.5; @@ -6241,7 +6261,7 @@ collections { rel2 { to: "button4"; relative: 0.0 1.0; - offset: 0 -1; + offset: -1 -1; } image { normal: "sl_bt2_0_0.png"; @@ -6261,11 +6281,11 @@ collections { max: 15 999; min: 15 32; rel1 { - to_x: "elm.dragable.slider"; + to_x: "button0"; to_y: "elm.indicator"; - offset: 0 -7; + offset: 0 0; } - rel2.to: "elm.dragable.slider"; + rel2.to: "button0"; image { normal: "sl_bt2_0_1.png"; border: 0 0 6 12; @@ -6280,9 +6300,10 @@ collections { part { name: "button5"; mouse_events: 0; description { state: "default" 0.0; + fixed: 1 1; visible: 0; min: 8 32; - align: 1.0 0.5; + align: 0.0 0.5; rel1 { to: "button4"; relative: 1.0 0.0; @@ -6315,13 +6336,13 @@ collections { fixed: 1 1; align: 0.5 1.0; rel1 { - to: "elm.dragable.slider"; - relative: 0.0 0.0; + to: "button0"; + relative: 0.0 -0.25; offset: 0 0; } rel2 { - to_x: "elm.dragable.slider"; - relative: 1.0 0.0; + to_x: "button0"; + relative: 1.0 -0.25; offset: -1 0; } color: 224 224 224 255; @@ -6495,6 +6516,7 @@ collections { type: RECT; mouse_events: 0; description { state: "default" 0.0; + fixed: 1 1; rel1.to: "base"; rel2 { to_x: "base"; @@ -6512,6 +6534,7 @@ collections { type: RECT; mouse_events: 0; description { state: "default" 0.0; + fixed: 1 1; visible: 0; rel1 { to_x: "base"; @@ -6678,7 +6701,7 @@ collections { } part { name: "elm.dragable.slider"; type: RECT; - mouse_events: 1; + mouse_events: 0; scale: 1; dragable { x: 0 0 0; @@ -6686,8 +6709,8 @@ collections { confine: "bg"; } description { state: "default" 0.0; - min: 24 24; - max: 24 24; + min: 24 0; + max: 24 0; fixed: 1 1; rel1 { relative: 0.5 0.5; @@ -6700,13 +6723,30 @@ collections { color: 0 0 0 0; } } + part { name: "button_events"; + type: RECT; + dragable { + 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"; + color: 0 0 0 0; + } + } part { name: "button0"; mouse_events: 0; description { state: "default" 0.0; + fixed: 1 1; max: 17 999; min: 17 24; - rel1.to: "elm.dragable.slider"; - rel2.to: "elm.dragable.slider"; + rel1.to: "button_events"; + rel2.to: "button_events"; image { normal: "sl_bt_0.png"; border: 5 5 5 10; @@ -6756,7 +6796,7 @@ collections { rel2 { to: "button4"; relative: 0.0 1.0; - offset: 0 -1; + offset: -1 -1; } image { normal: "sl_bt2_0_0.png"; @@ -6777,11 +6817,11 @@ collections { min: 15 32; fixed: 1 1; rel1 { - to_x: "elm.dragable.slider"; + to_x: "button0"; to_y: "elm.indicator"; offset: 0 -7; } - rel2.to: "elm.dragable.slider"; + rel2.to: "button0"; image { normal: "sl_bt2_0_1.png"; border: 0 0 6 12; @@ -6798,7 +6838,7 @@ collections { description { state: "default" 0.0; visible: 0; min: 8 32; - align: 1.0 0.5; + align: 0.0 0.5; rel1 { to: "button4"; relative: 1.0 0.0; @@ -6831,13 +6871,13 @@ collections { fixed: 1 1; align: 0.5 1.0; rel1 { - to: "elm.dragable.slider"; - relative: 0.0 0.0; + to: "button0"; + relative: 0.0 -0.25; offset: 0 0; } rel2 { - to: "elm.dragable.slider"; - relative: 1.0 0.0; + to: "button0"; + relative: 1.0 -0.25; offset: -1 0; } color: 224 224 224 255; diff --git a/src/bin/test.c b/src/bin/test.c index 7cc53bf..b844b7e 100644 --- a/src/bin/test.c +++ b/src/bin/test.c @@ -1983,7 +1983,7 @@ my_bt_28(void *data, Evas_Object *obj, void *event_info) elm_slider_label_set(sl, "Label"); elm_slider_icon_set(sl, ic); elm_slider_unit_format_set(sl, "%1.1f units"); - elm_slider_span_size_set(sl, 400); + elm_slider_span_size_set(sl, 120); evas_object_size_hint_align_set(sl, -1.0, -1.0); evas_object_size_hint_weight_set(sl, 1.0, 1.0); elm_box_pack_end(bx, sl); @@ -1992,7 +1992,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, 200); + elm_slider_span_size_set(sl, 80); evas_object_size_hint_align_set(sl, -1.0, -1.0); evas_object_size_hint_weight_set(sl, 1.0, 1.0); elm_slider_indicator_format_set(sl, "%3.0f"); @@ -2008,7 +2008,7 @@ my_bt_28(void *data, Evas_Object *obj, void *event_info) sl = elm_slider_add(win); elm_slider_label_set(sl, "Label 3"); elm_slider_unit_format_set(sl, "units"); - elm_slider_span_size_set(sl, 200); + elm_slider_span_size_set(sl, 40); evas_object_size_hint_align_set(sl, -1.0, -1.0); evas_object_size_hint_weight_set(sl, 1.0, 1.0); elm_slider_indicator_format_set(sl, "%3.0f"); @@ -2028,7 +2028,7 @@ my_bt_28(void *data, Evas_Object *obj, void *event_info) elm_slider_icon_set(sl, ic); elm_slider_label_set(sl, "Label 4"); elm_slider_unit_format_set(sl, "units"); - elm_slider_span_size_set(sl, 200); + elm_slider_span_size_set(sl, 60); evas_object_size_hint_align_set(sl, 0.5, -1.0); evas_object_size_hint_weight_set(sl, 0.0, 1.0); elm_slider_indicator_format_set(sl, "%1.1f"); diff --git a/src/lib/Elementary.h.in b/src/lib/Elementary.h.in index ca1ccf3..d549662 100644 --- a/src/lib/Elementary.h.in +++ b/src/lib/Elementary.h.in @@ -494,8 +494,7 @@ extern "C" { typedef enum _Elm_Genlist_Item_Flags { - ELM_GENLIST_ITEM_DISABLED, - ELM_GENLIST_ITEM_EXPANDED + ELM_GENLIST_ITEM_SUBITEMS } Elm_Genlist_Item_Flags; typedef struct _Elm_Genlist_Item_Class Elm_Genlist_Item_Class; typedef struct _Elm_Genlist_Item Elm_Genlist_Item; @@ -506,11 +505,16 @@ extern "C" { char *(*label_get) (const void *data, const char *part); Evas_Object *(*icon_get) (const void *data, const char *part); Evas_Bool (*state_get) (const void *data, const char *part); + void (*del) (const void *data); } func; }; EAPI Evas_Object *elm_genlist_add(Evas_Object *parent); - EAPI Elm_Genlist_Item *elm_genlist_item_add(Evas_Object *obj, const Elm_Genlist_Item_Class *itc, const void *data, Elm_Genlist_Item *parent, Elm_Genlist_Item_Flags flags); + EAPI Elm_Genlist_Item * + elm_genlist_item_append(Evas_Object *obj, const Elm_Genlist_Item_Class *itc, + const void *data, Elm_Genlist_Item *parent, + Elm_Genlist_Item_Flags flags, + void (*func) (void *data, Evas_Object *obj, void *event_info), const void *func_data); /* smart callbacks called: */ diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c index 2fe0858..70ad891 100644 --- a/src/lib/elm_genlist.c +++ b/src/lib/elm_genlist.c @@ -2,15 +2,53 @@ #include "elm_priv.h" typedef struct _Widget_Data Widget_Data; +typedef struct _Item Item; +typedef struct _Item_Block Item_Block; struct _Widget_Data { Evas_Object *scr; + Evas_Object *pan_smart; Evas_Object *content; + Eina_Inlist *items; + Eina_Inlist *blocks; Evas_Bool min_w : 1; Evas_Bool min_h : 1; }; +struct _Item_Block +{ + Eina_Inlist __header; + int count; + Evas_Object *obj; + Eina_List *items; + Evas_Coord x, y, w, h; + Evas_Bool realized : 1; +}; + +struct _Item +{ + Eina_Inlist __header; + Item_Block *block; + Eina_Inlist *subblocks; // not done yet + Eina_List *subitems; // not done yet + + Evas_Coord x, y, w, h; + Evas_Bool realized : 1; + Evas_Bool selected : 1; + Evas_Bool expanded : 1; // not done yet + Evas_Bool disabled : 1; + + const Elm_Genlist_Item_Class *itc; + const void *data; + Elm_Genlist_Item *parent; // not done yet + Elm_Genlist_Item_Flags flags; + struct { + void (*func) (void *data, Evas_Object *obj, void *event_info); + const void *data; + } func; +}; + static void _del_hook(Evas_Object *obj); static void _theme_hook(Evas_Object *obj); static void _show_region_hook(void *data, Evas_Object *obj); @@ -101,6 +139,72 @@ _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) +{ +} + +static void +_pan_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y) +{ +} + +static void +_pan_max_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y) +{ +} + +static void +_pan_child_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h) +{ +} + +static void +_pan_add(Evas_Object *obj) +{ + Pan *sd; + + sd = calloc(1, sizeof(Pan)); + if (!sd) return; + // FIXME: setup sd + 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); + if (!sd) return; + // FIXME: del smart stuff + free(sd); +} + +static void +_pan_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h) +{ + Evas_Coord ow, oh; + evas_object_geometry_get(obj, NULL, NULL, &ow, &oh); + if ((ow == w) && (oh == h)) return; + evas_object_smart_changed(obj); +} + +static void +_pan_calculate(Evas_Object *obj) +{ + // FIXME: calcualte new geom +} + EAPI Evas_Object * elm_genlist_add(Evas_Object *parent) { @@ -108,6 +212,7 @@ elm_genlist_add(Evas_Object *parent) Evas *e; Widget_Data *wd; Evas_Coord vw, vh, minw, minh; + static Evas_Smart *smart = NULL; wd = ELM_NEW(Widget_Data); e = evas_object_evas_get(parent); @@ -119,6 +224,33 @@ elm_genlist_add(Evas_Object *parent) wd->scr = elm_smart_scroller_add(e); elm_widget_resize_object_set(obj, wd->scr); + if (!smart) + { + static Evas_Smart_Class sc = { "Elm_Genlist_Pan", EVAS_SMART_CLASS_VERSION, }; + + evas_object_smart_clipped_smart_set(&_pan_sc); + 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 + + elm_smart_scroller_extern_pan_set(wd->scr, wd->pan_smart, + _pan_set, _pan_get, + _pan_max_get, _pan_child_size_get); + 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_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _resize, obj); @@ -129,8 +261,114 @@ elm_genlist_add(Evas_Object *parent) return obj; } +static Item * +_item_new(Evas_Object *obj, const Elm_Genlist_Item_Class *itc, + const void *data, Elm_Genlist_Item *parent, + Elm_Genlist_Item_Flags flags, + void (*func) (void *data, Evas_Object *obj, void *event_info), const void *func_data) +{ + Item *it; + + it = calloc(1, sizeof(Item)); + if (!it) return NULL; + it->itc = itc; + it->data = data; + it->parent = parent; + it->flags = flags; + it->func.func = func; + it->func.data = func_data; + return it; +} + EAPI Elm_Genlist_Item * -elm_genlist_item_add(Evas_Object *obj, const Elm_Genlist_Item_Class *itc, const void *data, Elm_Genlist_Item *parent, Elm_Genlist_Item_Flags flags) +elm_genlist_item_append(Evas_Object *obj, const Elm_Genlist_Item_Class *itc, + const void *data, Elm_Genlist_Item *parent, + Elm_Genlist_Item_Flags flags, + void (*func) (void *data, Evas_Object *obj, void *event_info), const void *func_data) { Widget_Data *wd = elm_widget_data_get(obj); + 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); + return (Elm_Genlist_Item *)it; +} + +EAPI Elm_Genlist_Item * +elm_genlist_item_prepend(Evas_Object *obj, const Elm_Genlist_Item_Class *itc, + const void *data, Elm_Genlist_Item *parent, + Elm_Genlist_Item_Flags flags, + void (*func) (void *data, Evas_Object *obj, void *event_info), const void *func_data) +{ +} + +EAPI Elm_Genlist_Item * +elm_genlist_item_insert_before(Evas_Object *obj, const Elm_Genlist_Item_Class *itc, + const void *data, Elm_Genlist_Item *before, + Elm_Genlist_Item_Flags flags, + void (*func) (void *data, Evas_Object *obj, void *event_info), const void *func_data) +{ +} + +EAPI Elm_Genlist_Item * +elm_genlist_item_insert_after(Evas_Object *obj, const Elm_Genlist_Item_Class *itc, + const void *data, Elm_Genlist_Item *after, + Elm_Genlist_Item_Flags flags, + void (*func) (void *data, Evas_Object *obj, void *event_info), const void *func_data) +{ +} + +EAPI void +elm_genlist_multi_select_set(Evas_Object *obj, Evas_Bool multi) +{ +} + +EAPI const Eina_List * +elm_genlist_items_get(Evas_Object *obj) +{ +} + +EAPI const Elm_Genlist_Item * +elm_genlist_selected_item_get(Evas_Object *obj) +{ +} + +EAPI const Eina_List * +elm_genlist_selected_items_get(Evas_Object *obj) +{ +} + +EAPI const Eina_List * +elm_genlist_item_items_get(Elm_Genlist_Item *item) +{ +} + +EAPI void +elm_genlist_item_selected_set(Elm_Genlist_Item *item, Evas_Bool selected) +{ +} + +EAPI void +elm_genlist_item_expanded_set(Elm_Genlist_Item *item, Evas_Bool expanded) +{ + // not done yet +} + +EAPI void +elm_genlist_item_disabld_set(Elm_Genlist_Item *item, Evas_Bool disabld) +{ +} + +EAPI void +elm_genlist_item_show(Elm_Genlist_Item *item) +{ +} + +EAPI void +elm_genlist_item_del(Elm_Genlist_Item *item) +{ +} + +EAPI const void * +elm_genlist_item_data_get(Elm_Genlist_Item *item) +{ }