forked from enlightenment/efl
more work on slider - i think its complete now vertical mode works. might be
some buglts to clear up though. fix scroller to scroll only at animator framerate.. using an animator making scrolling much better. begin genlist (geeric but complicated) list. SVN revision: 38979
This commit is contained in:
parent
a86ca90a14
commit
86ebf4591c
|
@ -108,7 +108,10 @@ sl_bt2_0_1.png \
|
||||||
sl_bt2_0_2.png \
|
sl_bt2_0_2.png \
|
||||||
sl_bt2_1.png \
|
sl_bt2_1.png \
|
||||||
sl_bt2_2.png \
|
sl_bt2_2.png \
|
||||||
sl_units.png
|
sl_units.png \
|
||||||
|
slv_bg.png \
|
||||||
|
slv_bg_over.png \
|
||||||
|
slv_units.png
|
||||||
|
|
||||||
default.edj: Makefile $(EXTRA_DIST)
|
default.edj: Makefile $(EXTRA_DIST)
|
||||||
$(EDJE_CC) $(EDJE_FLAGS) \
|
$(EDJE_CC) $(EDJE_FLAGS) \
|
||||||
|
|
|
@ -6080,7 +6080,7 @@ collections {
|
||||||
visible: 1;
|
visible: 1;
|
||||||
aspect: 1.0 1.0;
|
aspect: 1.0 1.0;
|
||||||
aspect_preference: VERTICAL;
|
aspect_preference: VERTICAL;
|
||||||
rel2.offset: 4 -5;
|
rel2.offset: 4 -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
part { name: "elm.text";
|
part { name: "elm.text";
|
||||||
|
@ -6461,8 +6461,9 @@ collections {
|
||||||
|
|
||||||
group { name: "elm/slider/vertical/default";
|
group { name: "elm/slider/vertical/default";
|
||||||
images {
|
images {
|
||||||
image: "sl_bg.png" COMP;
|
image: "slv_bg.png" COMP;
|
||||||
image: "sl_bg_over.png" COMP;
|
image: "slv_bg_over.png" COMP;
|
||||||
|
|
||||||
image: "sl_bt_0.png" COMP;
|
image: "sl_bt_0.png" COMP;
|
||||||
image: "sl_bt_1.png" COMP;
|
image: "sl_bt_1.png" COMP;
|
||||||
image: "sl_bt_2.png" COMP;
|
image: "sl_bt_2.png" COMP;
|
||||||
|
@ -6471,21 +6472,22 @@ collections {
|
||||||
image: "sl_bt2_0_2.png" COMP;
|
image: "sl_bt2_0_2.png" COMP;
|
||||||
image: "sl_bt2_1.png" COMP;
|
image: "sl_bt2_1.png" COMP;
|
||||||
image: "sl_bt2_2.png" COMP;
|
image: "sl_bt2_2.png" COMP;
|
||||||
image: "sl_units.png" COMP;
|
|
||||||
|
image: "slv_units.png" COMP;
|
||||||
}
|
}
|
||||||
parts {
|
parts {
|
||||||
part { name: "base";
|
part { name: "base";
|
||||||
mouse_events: 0;
|
mouse_events: 0;
|
||||||
description { state: "default" 0.0;
|
description { state: "default" 0.0;
|
||||||
max: 99999 6;
|
max: 6 99999;
|
||||||
min: 0 6;
|
min: 6 0;
|
||||||
rel1 { to: "bg";
|
rel1 { to: "bg";
|
||||||
offset: 1 0;
|
offset: 1 0;
|
||||||
}
|
}
|
||||||
rel2 { to: "bg";
|
rel2 { to: "bg";
|
||||||
offset: -2 -1;
|
offset: -2 -1;
|
||||||
}
|
}
|
||||||
image.normal: "sl_bg.png";
|
image.normal: "slv_bg.png";
|
||||||
fill.smooth: 0;
|
fill.smooth: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6495,9 +6497,9 @@ collections {
|
||||||
description { state: "default" 0.0;
|
description { state: "default" 0.0;
|
||||||
rel1.to: "base";
|
rel1.to: "base";
|
||||||
rel2 {
|
rel2 {
|
||||||
to_y: "base";
|
to_x: "base";
|
||||||
to_x: "elm.dragable.slider";
|
to_y: "elm.dragable.slider";
|
||||||
relative: 0.5 1.0;
|
relative: 1.0 0.5;
|
||||||
}
|
}
|
||||||
color: 255 0 0 200;
|
color: 255 0 0 200;
|
||||||
}
|
}
|
||||||
|
@ -6512,9 +6514,9 @@ collections {
|
||||||
description { state: "default" 0.0;
|
description { state: "default" 0.0;
|
||||||
visible: 0;
|
visible: 0;
|
||||||
rel1 {
|
rel1 {
|
||||||
to_y: "base";
|
to_x: "base";
|
||||||
to_x: "elm.dragable.slider";
|
to_y: "elm.dragable.slider";
|
||||||
relative: 0.5 0.0;
|
relative: 0.0 0.5;
|
||||||
}
|
}
|
||||||
rel2.to: "base";
|
rel2.to: "base";
|
||||||
color: 255 0 0 200;
|
color: 255 0 0 200;
|
||||||
|
@ -6533,7 +6535,7 @@ collections {
|
||||||
rel2.to: "base";
|
rel2.to: "base";
|
||||||
rel2.offset: 0 0;
|
rel2.offset: 0 0;
|
||||||
image {
|
image {
|
||||||
normal: "sl_bg_over.png";
|
normal: "slv_bg_over.png";
|
||||||
border: 3 3 3 3;
|
border: 3 3 3 3;
|
||||||
}
|
}
|
||||||
fill.smooth: 0;
|
fill.smooth: 0;
|
||||||
|
@ -6554,18 +6556,18 @@ collections {
|
||||||
type: SWALLOW;
|
type: SWALLOW;
|
||||||
scale: 1;
|
scale: 1;
|
||||||
description { state: "default" 0.0;
|
description { state: "default" 0.0;
|
||||||
min: 48 24;
|
min: 24 48;
|
||||||
max: 99999 24;
|
max: 24 9999;
|
||||||
align: 1.0 0.5;
|
align: 1.0 0.5;
|
||||||
rel1 {
|
rel1 {
|
||||||
to_x: "elm.text";
|
to_y: "elm.text";
|
||||||
relative: 1.0 0.0;
|
relative: 0.0 1.0;
|
||||||
offset: 2 0;
|
offset: 0 2;
|
||||||
}
|
}
|
||||||
rel2 {
|
rel2 {
|
||||||
to_x: "elm.units";
|
to_y: "elm.units";
|
||||||
relative: 0.0 1.0;
|
relative: 1.0 0.0;
|
||||||
offset: -3 -1;
|
offset: -1 -3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6573,23 +6575,23 @@ collections {
|
||||||
type: SWALLOW;
|
type: SWALLOW;
|
||||||
description { state: "default" 0.0;
|
description { state: "default" 0.0;
|
||||||
visible: 0;
|
visible: 0;
|
||||||
align: 0.0 0.5;
|
align: 0.5 0.0;
|
||||||
rel1 {
|
rel1 {
|
||||||
offset: 4 0;
|
offset: 0 4;
|
||||||
to_y: "elm.swallow.bar";
|
to_x: "elm.swallow.bar";
|
||||||
}
|
}
|
||||||
rel2 {
|
rel2 {
|
||||||
offset: 3 -1;
|
offset: -1 3;
|
||||||
relative: 0.0 1.0;
|
relative: 1.0 0.0;
|
||||||
to_y: "elm.swallow.bar";
|
to_x: "elm.swallow.bar";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
description { state: "visible" 0.0;
|
description { state: "visible" 0.0;
|
||||||
inherit: "default" 0.0;
|
inherit: "default" 0.0;
|
||||||
visible: 1;
|
visible: 1;
|
||||||
aspect: 1.0 1.0;
|
aspect: 1.0 1.0;
|
||||||
aspect_preference: VERTICAL;
|
aspect_preference: HORIZONTAL;
|
||||||
rel2.offset: 4 -5;
|
rel2.offset: -1 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
part { name: "elm.text";
|
part { name: "elm.text";
|
||||||
|
@ -6599,27 +6601,27 @@ collections {
|
||||||
description { state: "default" 0.0;
|
description { state: "default" 0.0;
|
||||||
visible: 0;
|
visible: 0;
|
||||||
fixed: 1 1;
|
fixed: 1 1;
|
||||||
align: 0.0 0.5;
|
align: 0.5 0.0;
|
||||||
rel1.to_x: "elm.swallow.content";
|
rel1.to_y: "elm.swallow.content";
|
||||||
rel1.relative: 1.0 0.0;
|
rel1.relative: 0.5 1.0;
|
||||||
rel1.offset: -1 4;
|
rel1.offset: 0 -1;
|
||||||
rel2.to_x: "elm.swallow.content";
|
rel2.to_y: "elm.swallow.content";
|
||||||
rel2.relative: 1.0 1.0;
|
rel2.relative: 0.5 1.0;
|
||||||
rel2.offset: -1 -5;
|
rel2.offset: -1 -1;
|
||||||
color: 0 0 0 255;
|
color: 0 0 0 255;
|
||||||
text {
|
text {
|
||||||
font: "Sans,Edje-Vera";
|
font: "Sans,Edje-Vera";
|
||||||
size: 10;
|
size: 10;
|
||||||
min: 0 0;
|
min: 0 0;
|
||||||
align: 0.0 0.5;
|
align: 0.5 0.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
description { state: "visible" 0.0;
|
description { state: "visible" 0.0;
|
||||||
inherit: "default" 0.0;
|
inherit: "default" 0.0;
|
||||||
visible: 1;
|
visible: 1;
|
||||||
text.min: 1 1;
|
text.min: 1 1;
|
||||||
rel1.offset: 0 4;
|
rel1.offset: 4 0;
|
||||||
rel2.offset: 0 -5;
|
rel2.offset: -5 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
part { name: "units";
|
part { name: "units";
|
||||||
|
@ -6627,12 +6629,16 @@ collections {
|
||||||
description { state: "default" 0.0;
|
description { state: "default" 0.0;
|
||||||
visible: 0;
|
visible: 0;
|
||||||
rel1 {
|
rel1 {
|
||||||
to_x: "elm.units";
|
to: "elm.units";
|
||||||
offset: 0 5;
|
offset: -8 0;
|
||||||
|
}
|
||||||
|
rel2 {
|
||||||
|
to: "elm.units";
|
||||||
|
offset: 7 8;
|
||||||
}
|
}
|
||||||
image {
|
image {
|
||||||
normal: "sl_units.png";
|
normal: "slv_units.png";
|
||||||
border: 0 5 3 8;
|
border: 8 8 0 9;
|
||||||
}
|
}
|
||||||
fill.smooth: 0;
|
fill.smooth: 0;
|
||||||
}
|
}
|
||||||
|
@ -6648,17 +6654,17 @@ collections {
|
||||||
description { state: "default" 0.0;
|
description { state: "default" 0.0;
|
||||||
visible: 0;
|
visible: 0;
|
||||||
fixed: 1 1;
|
fixed: 1 1;
|
||||||
align: 1.0 0.5;
|
align: 0.5 1.0;
|
||||||
rel1.relative: 1.0 0.0;
|
rel1.relative: 0.0 1.0;
|
||||||
rel1.offset: 0 8;
|
rel1.offset: 8 0;
|
||||||
rel2.relative: 1.0 1.0;
|
rel2.relative: 1.0 1.0;
|
||||||
rel2.offset: 0 -9;
|
rel2.offset: -9 0;
|
||||||
color: 0 0 0 255;
|
color: 0 0 0 255;
|
||||||
text {
|
text {
|
||||||
font: "Sans,Edje-Vera";
|
font: "Sans,Edje-Vera";
|
||||||
size: 10;
|
size: 10;
|
||||||
min: 0 0;
|
min: 0 0;
|
||||||
align: 0.0 0.5;
|
align: 0.5 0.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
description { state: "visible" 0.0;
|
description { state: "visible" 0.0;
|
||||||
|
@ -6666,8 +6672,8 @@ collections {
|
||||||
fixed: 1 1;
|
fixed: 1 1;
|
||||||
visible: 1;
|
visible: 1;
|
||||||
text.min: 1 1;
|
text.min: 1 1;
|
||||||
rel1.offset: -5 0;
|
rel1.offset: 8 -9;
|
||||||
rel2.offset: -5 -1;
|
rel2.offset: -9 -9;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
part { name: "elm.dragable.slider";
|
part { name: "elm.dragable.slider";
|
||||||
|
@ -6769,6 +6775,7 @@ collections {
|
||||||
visible: 0;
|
visible: 0;
|
||||||
max: 15 999;
|
max: 15 999;
|
||||||
min: 15 32;
|
min: 15 32;
|
||||||
|
fixed: 1 1;
|
||||||
rel1 {
|
rel1 {
|
||||||
to_x: "elm.dragable.slider";
|
to_x: "elm.dragable.slider";
|
||||||
to_y: "elm.indicator";
|
to_y: "elm.indicator";
|
||||||
|
@ -6829,7 +6836,7 @@ collections {
|
||||||
offset: 0 0;
|
offset: 0 0;
|
||||||
}
|
}
|
||||||
rel2 {
|
rel2 {
|
||||||
to_x: "elm.dragable.slider";
|
to: "elm.dragable.slider";
|
||||||
relative: 1.0 0.0;
|
relative: 1.0 0.0;
|
||||||
offset: -1 0;
|
offset: -1 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2020,12 +2020,17 @@ my_bt_28(void *data, Evas_Object *obj, void *event_info)
|
||||||
evas_object_show(ic);
|
evas_object_show(ic);
|
||||||
evas_object_show(sl);
|
evas_object_show(sl);
|
||||||
|
|
||||||
|
ic = elm_icon_add(win);
|
||||||
|
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
|
||||||
|
elm_icon_file_set(ic, buf, NULL);
|
||||||
|
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1);
|
||||||
sl = elm_slider_add(win);
|
sl = elm_slider_add(win);
|
||||||
|
elm_slider_icon_set(sl, ic);
|
||||||
elm_slider_label_set(sl, "Label 4");
|
elm_slider_label_set(sl, "Label 4");
|
||||||
elm_slider_unit_format_set(sl, "units");
|
elm_slider_unit_format_set(sl, "units");
|
||||||
elm_slider_span_size_set(sl, 200);
|
elm_slider_span_size_set(sl, 200);
|
||||||
evas_object_size_hint_align_set(sl, -1.0, -1.0);
|
evas_object_size_hint_align_set(sl, 0.5, -1.0);
|
||||||
evas_object_size_hint_weight_set(sl, 1.0, 1.0);
|
evas_object_size_hint_weight_set(sl, 0.0, 1.0);
|
||||||
elm_slider_indicator_format_set(sl, "%1.1f");
|
elm_slider_indicator_format_set(sl, "%1.1f");
|
||||||
elm_slider_value_set(sl, 0.2);
|
elm_slider_value_set(sl, 0.2);
|
||||||
elm_object_scale_set(sl, 1.0);
|
elm_object_scale_set(sl, 1.0);
|
||||||
|
|
|
@ -466,6 +466,7 @@ extern "C" {
|
||||||
* "unselected" - when the user selected an item
|
* "unselected" - when the user selected an item
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// FIXME: incomplete - carousel
|
||||||
typedef struct _Elm_Carousel_Item Elm_Carousel_Item;
|
typedef struct _Elm_Carousel_Item Elm_Carousel_Item;
|
||||||
EAPI Evas_Object *elm_carousel_add(Evas_Object *parent);
|
EAPI Evas_Object *elm_carousel_add(Evas_Object *parent);
|
||||||
EAPI Elm_Carousel_Item *elm_carousel_item_add(Evas_Object *obj, Evas_Object *icon, const char *label, void (*func) (void *data, Evas_Object *obj, void *event_info), const void *data);
|
EAPI Elm_Carousel_Item *elm_carousel_item_add(Evas_Object *obj, Evas_Object *icon, const char *label, void (*func) (void *data, Evas_Object *obj, void *event_info), const void *data);
|
||||||
|
@ -476,24 +477,43 @@ extern "C" {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
EAPI Evas_Object *elm_slider_add(Evas_Object *parent);
|
EAPI Evas_Object *elm_slider_add(Evas_Object *parent);
|
||||||
EAPI void elm_slider_label_set(Evas_Object *obj, const char *label);
|
EAPI void elm_slider_label_set(Evas_Object *obj, const char *label);
|
||||||
EAPI void elm_slider_icon_set(Evas_Object *obj, Evas_Object *icon);
|
EAPI void elm_slider_icon_set(Evas_Object *obj, Evas_Object *icon);
|
||||||
EAPI void elm_slider_span_size_set(Evas_Object *obj, Evas_Coord size);
|
EAPI void elm_slider_span_size_set(Evas_Object *obj, Evas_Coord size);
|
||||||
EAPI void elm_slider_unit_format_set(Evas_Object *obj, const char *format);
|
EAPI void elm_slider_unit_format_set(Evas_Object *obj, const char *format);
|
||||||
EAPI void elm_slider_indicator_format_set(Evas_Object *obj, const char *indicator);
|
EAPI void elm_slider_indicator_format_set(Evas_Object *obj, const char *indicator);
|
||||||
EAPI void elm_slider_horizontal_set(Evas_Object *obj, Evas_Bool horizontal);
|
EAPI void elm_slider_horizontal_set(Evas_Object *obj, Evas_Bool horizontal);
|
||||||
EAPI void elm_slider_min_max_set(Evas_Object *obj, double min, double max);
|
EAPI void elm_slider_min_max_set(Evas_Object *obj, double min, double max);
|
||||||
EAPI void elm_slider_value_set(Evas_Object *obj, double val);
|
EAPI void elm_slider_value_set(Evas_Object *obj, double val);
|
||||||
EAPI double elm_slider_value_get(Evas_Object *obj);
|
EAPI double elm_slider_value_get(Evas_Object *obj);
|
||||||
EAPI void elm_slider_inverted_set(Evas_Object *obj, Evas_Bool inverted);
|
EAPI void elm_slider_inverted_set(Evas_Object *obj, Evas_Bool inverted);
|
||||||
|
|
||||||
|
|
||||||
/* smart callbacks called:
|
/* smart callbacks called:
|
||||||
* "changed" - when the slider value changes
|
* "changed" - when the slider value changes
|
||||||
* "delay,changed" - when the slider value changed, but a small time after a change (use this if you only want to respond to a change once the slider is held still for a short while).
|
* "delay,changed" - when the slider value changed, but a small time after a change (use this if you only want to respond to a change once the slider is held still for a short while).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
typedef enum _Elm_Genlist_Item_Flags
|
||||||
|
{
|
||||||
|
ELM_GENLIST_ITEM_DISABLED,
|
||||||
|
ELM_GENLIST_ITEM_EXPANDED
|
||||||
|
} Elm_Genlist_Item_Flags;
|
||||||
|
typedef struct _Elm_Genlist_Item_Class Elm_Genlist_Item_Class;
|
||||||
|
typedef struct _Elm_Genlist_Item Elm_Genlist_Item;
|
||||||
|
struct _Elm_Genlist_Item_Class
|
||||||
|
{
|
||||||
|
const char *style;
|
||||||
|
struct {
|
||||||
|
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);
|
||||||
|
} 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);
|
||||||
|
/* smart callbacks called:
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -520,18 +540,22 @@ extern "C" {
|
||||||
// * when entries are in a scroller and change size, the scroller shows scrollbars. fix. same for selecting. for 1 line entries in a scroller should only have scroll arrow indicators.
|
// * when entries are in a scroller and change size, the scroller shows scrollbars. fix. same for selecting. for 1 line entries in a scroller should only have scroll arrow indicators.
|
||||||
//
|
//
|
||||||
//// (more widgets/features - medium priority)
|
//// (more widgets/features - medium priority)
|
||||||
// * slider widget
|
// * biglist widget (restricted format label + icon intended for massive lists)
|
||||||
// * <evas scale cache>
|
// * treeview widget (like biglist - but items can expand to sub-items)
|
||||||
// * radio + group handling
|
// * radio + group handling
|
||||||
// * checkbox (like toggle)
|
// * checkbox (like toggle)
|
||||||
// * pager (for pushing/popping pages and going back and forward and flipping)
|
// * pager (for pushing/popping pages and going back and forward and flipping)
|
||||||
// * <edje copy & paste fixed>
|
// * <edje copy & paste fixed>
|
||||||
// * biglist widget (restricted format label + icon intended for massive lists)
|
// * <evas scale cache>
|
||||||
// * treeview widget (like biglist - but items can expand to sub-items)
|
|
||||||
// * <evas shared cache>
|
// * <evas shared cache>
|
||||||
//
|
//
|
||||||
// * carousel selector widget
|
// * carousel selector widget
|
||||||
// * auto-size label/text that adapts text size to its allocated region
|
// * auto-size label/text that adapts text size to its allocated region
|
||||||
|
// * [ scrollable dropdown combo box ]
|
||||||
|
// * [ notepad widget ]
|
||||||
|
// * [ toggle with 2x labelled button for 2 states ]
|
||||||
|
// * [ poker spinner with numbers + labels ]
|
||||||
|
// * [ wrapping text button bar ]
|
||||||
// * separator widget (h/v)
|
// * separator widget (h/v)
|
||||||
// * slide-open "panel" that can hold stuff and optionally scroll
|
// * slide-open "panel" that can hold stuff and optionally scroll
|
||||||
// * calendar widget (select date)
|
// * calendar widget (select date)
|
||||||
|
|
|
@ -48,6 +48,7 @@ elm_toolbar.c \
|
||||||
elm_list.c \
|
elm_list.c \
|
||||||
elm_carousel.c \
|
elm_carousel.c \
|
||||||
elm_slider.c \
|
elm_slider.c \
|
||||||
|
elm_genlist.c \
|
||||||
\
|
\
|
||||||
elc_notepad.c \
|
elc_notepad.c \
|
||||||
elc_anchorview.c \
|
elc_anchorview.c \
|
||||||
|
|
|
@ -0,0 +1,136 @@
|
||||||
|
#include <Elementary.h>
|
||||||
|
#include "elm_priv.h"
|
||||||
|
|
||||||
|
typedef struct _Widget_Data Widget_Data;
|
||||||
|
|
||||||
|
struct _Widget_Data
|
||||||
|
{
|
||||||
|
Evas_Object *scr;
|
||||||
|
Evas_Object *content;
|
||||||
|
Evas_Bool min_w : 1;
|
||||||
|
Evas_Bool min_h : 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
static void _del_hook(Evas_Object *obj);
|
||||||
|
static void _theme_hook(Evas_Object *obj);
|
||||||
|
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 void
|
||||||
|
_del_hook(Evas_Object *obj)
|
||||||
|
{
|
||||||
|
Widget_Data *wd = elm_widget_data_get(obj);
|
||||||
|
free(wd);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_theme_hook(Evas_Object *obj)
|
||||||
|
{
|
||||||
|
Widget_Data *wd = elm_widget_data_get(obj);
|
||||||
|
elm_smart_scroller_theme_set(wd->scr, "scroller", "base", "default");
|
||||||
|
edje_object_scale_set(wd->scr, elm_widget_scale_get(obj) * _elm_config->scale);
|
||||||
|
_sizing_eval(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_show_region_hook(void *data, Evas_Object *obj)
|
||||||
|
{
|
||||||
|
Widget_Data *wd = elm_widget_data_get(data);
|
||||||
|
Evas_Coord x, y, w, h;
|
||||||
|
elm_widget_show_region_get(obj, &x, &y, &w, &h);
|
||||||
|
elm_smart_scroller_child_region_show(wd->scr, x, y, w, h);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_sizing_eval(Evas_Object *obj)
|
||||||
|
{
|
||||||
|
Widget_Data *wd = elm_widget_data_get(obj);
|
||||||
|
Evas_Coord vw, vh, minw, minh, maxw, maxh, w, h, vmw, vmh;
|
||||||
|
double xw, xy;
|
||||||
|
|
||||||
|
evas_object_size_hint_min_get(wd->content, &minw, &minh);
|
||||||
|
evas_object_size_hint_max_get(wd->content, &maxw, &maxh);
|
||||||
|
evas_object_size_hint_weight_get(wd->content, &xw, &xy);
|
||||||
|
elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh);
|
||||||
|
if (xw > 0.0)
|
||||||
|
{
|
||||||
|
if ((minw > 0) && (vw < minw)) vw = minw;
|
||||||
|
else if ((maxw > 0) && (vw > maxw)) vw = maxw;
|
||||||
|
}
|
||||||
|
else if (minw > 0) vw = minw;
|
||||||
|
if (xy > 0.0)
|
||||||
|
{
|
||||||
|
if ((minh > 0) && (vh < minh)) vh = minh;
|
||||||
|
else if ((maxh > 0) && (vh > maxh)) vh = maxh;
|
||||||
|
}
|
||||||
|
else if (minh > 0) vh = minh;
|
||||||
|
evas_object_resize(wd->content, vw, vh);
|
||||||
|
w = -1;
|
||||||
|
h = -1;
|
||||||
|
edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr), &vmw, &vmh);
|
||||||
|
if (wd->min_w) w = vmw + minw;
|
||||||
|
if (wd->min_h) h = vmh + minh;
|
||||||
|
evas_object_size_hint_min_set(obj, w, h);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||||
|
{
|
||||||
|
_sizing_eval(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_sub_del(void *data, Evas_Object *obj, void *event_info)
|
||||||
|
{
|
||||||
|
Widget_Data *wd = elm_widget_data_get(obj);
|
||||||
|
Evas_Object *sub = event_info;
|
||||||
|
if (sub == wd->content)
|
||||||
|
{
|
||||||
|
elm_widget_on_show_region_hook_set(wd->content, NULL, NULL);
|
||||||
|
evas_object_event_callback_del
|
||||||
|
(sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints);
|
||||||
|
wd->content = NULL;
|
||||||
|
_sizing_eval(obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_resize(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||||
|
{
|
||||||
|
_sizing_eval(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI Evas_Object *
|
||||||
|
elm_genlist_add(Evas_Object *parent)
|
||||||
|
{
|
||||||
|
Evas_Object *obj;
|
||||||
|
Evas *e;
|
||||||
|
Widget_Data *wd;
|
||||||
|
Evas_Coord vw, vh, minw, minh;
|
||||||
|
|
||||||
|
wd = ELM_NEW(Widget_Data);
|
||||||
|
e = evas_object_evas_get(parent);
|
||||||
|
obj = elm_widget_add(e);
|
||||||
|
elm_widget_data_set(obj, wd);
|
||||||
|
elm_widget_del_hook_set(obj, _del_hook);
|
||||||
|
elm_widget_theme_hook_set(obj, _theme_hook);
|
||||||
|
|
||||||
|
wd->scr = elm_smart_scroller_add(e);
|
||||||
|
elm_widget_resize_object_set(obj, wd->scr);
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
// evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
|
||||||
|
|
||||||
|
_sizing_eval(obj);
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
Widget_Data *wd = elm_widget_data_get(obj);
|
||||||
|
}
|
|
@ -27,6 +27,8 @@ struct _Smart_Data
|
||||||
double timestamp;
|
double timestamp;
|
||||||
} history[20];
|
} history[20];
|
||||||
double anim_start;
|
double anim_start;
|
||||||
|
Evas_Coord hold_x, hold_y;
|
||||||
|
Ecore_Animator *hold_animator;
|
||||||
Ecore_Animator *momentum_animator;
|
Ecore_Animator *momentum_animator;
|
||||||
Evas_Coord locked_x, locked_y;
|
Evas_Coord locked_x, locked_y;
|
||||||
unsigned char now : 1;
|
unsigned char now : 1;
|
||||||
|
@ -63,6 +65,7 @@ static void _smart_pan_changed_hook(void *data, Evas_Object *obj, void *event_in
|
||||||
static void _smart_pan_pan_changed_hook(void *data, Evas_Object *obj, void *event_info);
|
static void _smart_pan_pan_changed_hook(void *data, Evas_Object *obj, void *event_info);
|
||||||
static void _smart_event_wheel(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
static void _smart_event_wheel(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||||
static void _smart_event_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
static void _smart_event_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||||
|
static int _smart_hold_animator(void *data);
|
||||||
static int _smart_momentum_animator(void *data);
|
static int _smart_momentum_animator(void *data);
|
||||||
static void _smart_event_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
static void _smart_event_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||||
static void _smart_event_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
static void _smart_event_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||||
|
@ -431,6 +434,11 @@ _smart_event_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||||
ev = event_info;
|
ev = event_info;
|
||||||
if (_elm_config->thumbscroll_enable)
|
if (_elm_config->thumbscroll_enable)
|
||||||
{
|
{
|
||||||
|
if (sd->down.hold_animator)
|
||||||
|
{
|
||||||
|
ecore_animator_del(sd->down.hold_animator);
|
||||||
|
sd->down.hold_animator = NULL;
|
||||||
|
}
|
||||||
if (sd->down.momentum_animator)
|
if (sd->down.momentum_animator)
|
||||||
{
|
{
|
||||||
ecore_animator_del(sd->down.momentum_animator);
|
ecore_animator_del(sd->down.momentum_animator);
|
||||||
|
@ -456,6 +464,17 @@ _smart_event_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
_smart_hold_animator(void *data)
|
||||||
|
{
|
||||||
|
Smart_Data *sd;
|
||||||
|
|
||||||
|
sd = data;
|
||||||
|
sd->down.hold_animator = NULL;
|
||||||
|
elm_smart_scroller_child_pos_set(sd->smart_obj, sd->down.hold_x, sd->down.hold_y);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_smart_momentum_animator(void *data)
|
_smart_momentum_animator(void *data)
|
||||||
{
|
{
|
||||||
|
@ -533,6 +552,11 @@ _smart_event_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||||
{
|
{
|
||||||
if (!sd->down.momentum_animator)
|
if (!sd->down.momentum_animator)
|
||||||
sd->down.momentum_animator = ecore_animator_add(_smart_momentum_animator, sd);
|
sd->down.momentum_animator = ecore_animator_add(_smart_momentum_animator, sd);
|
||||||
|
if (sd->down.hold_animator)
|
||||||
|
{
|
||||||
|
ecore_animator_del(sd->down.hold_animator);
|
||||||
|
sd->down.hold_animator = NULL;
|
||||||
|
}
|
||||||
sd->down.dx = ((double)dx / at);
|
sd->down.dx = ((double)dx / at);
|
||||||
sd->down.dy = ((double)dy / at);
|
sd->down.dy = ((double)dy / at);
|
||||||
sd->down.anim_start = t;
|
sd->down.anim_start = t;
|
||||||
|
@ -614,7 +638,11 @@ _smart_event_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||||
if (sd->down.dir_x) y = sd->down.locked_y;
|
if (sd->down.dir_x) y = sd->down.locked_y;
|
||||||
else x = sd->down.locked_x;
|
else x = sd->down.locked_x;
|
||||||
}
|
}
|
||||||
elm_smart_scroller_child_pos_set(sd->smart_obj, x, y);
|
sd->down.hold_x = x;
|
||||||
|
sd->down.hold_y = y;
|
||||||
|
if (!sd->down.hold_animator)
|
||||||
|
sd->down.hold_animator = ecore_animator_add(_smart_hold_animator, sd);
|
||||||
|
// elm_smart_scroller_child_pos_set(sd->smart_obj, x, y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -975,6 +1003,7 @@ _smart_del(Evas_Object *obj)
|
||||||
if (!sd->extern_pan) evas_object_del(sd->pan_obj);
|
if (!sd->extern_pan) evas_object_del(sd->pan_obj);
|
||||||
evas_object_del(sd->edje_obj);
|
evas_object_del(sd->edje_obj);
|
||||||
evas_object_del(sd->event_obj);
|
evas_object_del(sd->event_obj);
|
||||||
|
if (sd->down.hold_animator) ecore_animator_del(sd->down.hold_animator);
|
||||||
if (sd->down.momentum_animator) ecore_animator_del(sd->down.momentum_animator);
|
if (sd->down.momentum_animator) ecore_animator_del(sd->down.momentum_animator);
|
||||||
free(sd);
|
free(sd);
|
||||||
evas_object_smart_data_set(obj, NULL);
|
evas_object_smart_data_set(obj, NULL);
|
||||||
|
|
Loading…
Reference in New Issue