seoz pushed a commit to branch master. http://git.enlightenment.org/tools/elm-theme-viewer.git/commit/?id=892a0a6e4a08de907f1ad177c1f4876d17a6048e
commit 892a0a6e4a08de907f1ad177c1f4876d17a6048e Author: Daniel Juyung Seo <[email protected]> Date: Fri Aug 22 03:13:21 2014 +0900 widget_option: added select_mode option and selected callback to gengrid. --- src/bin/widget.c | 17 +++++++++++++++-- src/bin/widget_option.c | 8 ++++++++ src/bin/widget_option.h | 1 + 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/bin/widget.c b/src/bin/widget.c index c3fff26..8126ff8 100644 --- a/src/bin/widget.c +++ b/src/bin/widget.c @@ -592,6 +592,13 @@ _widget_gengrid_content_get(void *data, Evas_Object *obj, const char *part) return o; } +static void +_gengrid_item_sel_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, + void *event_info) +{ + printf("Item %p is selected\n", event_info); +} + static Evas_Object * _widget_gengrid_icon_aspect_content_get(void *data, Evas_Object *obj, const char *part) @@ -698,6 +705,10 @@ _widget_gengrid_create(Evas_Object *parent, const char *orig_style, const char * else if (gst == GENGRID_GROUP_INDEX_STYLE) elm_gengrid_group_item_size_set(o, 31, 31); + /* apply options */ + if (wod) + elm_gengrid_select_mode_set(o, wod->gengrid_select_mode); + if ((gst == GENGRID_H9_GROUP_INDEX_STYLE) || (gst == GENGRID_GROUP_INDEX_STYLE)) { @@ -714,8 +725,10 @@ _widget_gengrid_create(Evas_Object *parent, const char *orig_style, const char * if (((i % 10) == 0) && ((gst == GENGRID_H9_GROUP_INDEX_STYLE) || (gst == GENGRID_GROUP_INDEX_STYLE))) - elm_gengrid_item_append(o, group_ic, (void *)(long)i, NULL, NULL); - elm_gengrid_item_append(o, ic, (void *)(long)i, NULL, NULL); + elm_gengrid_item_append(o, group_ic, (void *)(long)i, + _gengrid_item_sel_cb, NULL); + elm_gengrid_item_append(o, ic, (void *)(long)i, + _gengrid_item_sel_cb, NULL); } if ((gst == GENGRID_H9_GROUP_INDEX_STYLE) || diff --git a/src/bin/widget_option.c b/src/bin/widget_option.c index 23e8956..71eaab9 100644 --- a/src/bin/widget_option.c +++ b/src/bin/widget_option.c @@ -239,6 +239,8 @@ _gengrid_item_size_changed_cb(void *data EINA_UNUSED, WIDGET_OPTION_HOVERSEL_CHANGED_CB(_gengrid_text_len_changed_cb, _text_len, wod->gengrid_text_len); +WIDGET_OPTION_HOVERSEL_CHANGED_CB(_gengrid_select_mode_changed_cb, + _select_mode, wod->gengrid_select_mode); static void _gengrid_entry_focused_cb(void *data EINA_UNUSED, Evas_Object *obj, @@ -372,6 +374,12 @@ _widget_option_gengrid_create(Evas_Object *box) elm_box_pack_end(bx, o); evas_object_show(o); + WIDGET_OPTION_SEPARATOR_ADD(); + + // select mode + WIDGET_OPTION_LABEL_ADD(" < Select Mode > "); + WIDGET_OPTION_HOVERSEL_FULL_ADD(_select_mode, wod->gengrid_select_mode, + _gengrid_select_mode_changed_cb); WIDGET_OPTION_PADDING_ADD(bx); } diff --git a/src/bin/widget_option.h b/src/bin/widget_option.h index b62daee..9871045 100644 --- a/src/bin/widget_option.h +++ b/src/bin/widget_option.h @@ -31,6 +31,7 @@ struct _Widget_Option_Data int gengrid_text_len; // short (0), middle (1), long (2) double gengrid_vert_align; double gengrid_horz_align; + int gengrid_select_mode; // default (0), always (1), none (2), display_only (3) // genlist int genlist_text_len; // short (0), middle (1), long (2) --
