Dear All,
Thanks for your response.
I have attached "elm_diskselector" patch using API and getting default value
from theme.
But the default value from "elementary/themes/default.edc" is applied only.
If user wants new default value from his/her own theme file, it will not be
applied.
Why I have changed like this.. because there is one case I worry about
[steps]
1. elm_diskselector_display_item_num_set(disk, 5)
2. elm_object_style_set(disk, "new/style"); // style has data.item
"display_item_num" "7"
In this case elm_diskselector will display 7 items.
By the way.. you mean..
1. the newly defined default value should be applied?
or
2. default value of default.edc is applied only? (attached patch)
If you mean the first one, then both "Value from API" and "Value from
Theme" will be supported. But I worry about above case and I'm not sure two
ways should be coexisted.
The second one.. it is also not meaningful..
Ok, please let me now your opinion upon it. Thanks.
Sincerely,
Shinwoo Kim.
2011/3/22 Tom Hacohen <tom.haco...@partner.samsung.com>
> Dear Shinwoo,
>
> Why did you ditch getting the data from the theme? I think my suggestion
> is reasonable: use the data from the theme as the default value, and
> allow people to override it from API. So it's essentially what you did
> with just adding one line to the init of the object, to set
> display_item_num from the theme...
>
> --
> Tom.
>
> On Tue, 2011-03-22 at 19:36 +0900, cnook wrote:
> > Dear All,
> >
> > Hello :)
> >
> > Thanks for your response.
> > I have attached "elm_diskselector" patch using API and example code is
> > also included.
> > Please review this again. Thanks always.
> >
> > Sincerely,
> > Shinwoo Kim.
> >
> > 2011/3/22 Tom Hacohen <tom.haco...@partner.samsung.com>
> > You can load default from the theme and modify it with API...
> >
> >
> > On Tue, 2011-03-22 at 13:47 +0900, Daniel Juyung Seo wrote:
> > > Hello.
> > >
> > > > then several different theme file have to be existed. In
> > this case, API
> > > > would be more efficient.
> > >
> > > Hmm... you're right. It will be more flexible to use API for
> > item count.
> > > If we use previously suggested idea, we need to prepare many
> > item
> > > styles for several cases.
> > > And that doesn't look that flexible.
> > >
> > > And one more comment.
> > > You don't need to write separate sample application.
> > > Just add the sample to elementary_test.
> > >
> > > Thanks.
> > > Daniel Juyung Seo (SeoZ)
> > >
> > > On Mon, Mar 21, 2011 at 10:39 PM, cnook <kimci...@gmail.com>
> > wrote:
> > > > Dear All,
> > > >
> > > > Hi~
> > > > Thanks for your response always!
> > > >
> > > > I have changed the "elm_diskselector" based on your
> > comments.
> > > > The "displayed item count" is described by using theme
> > file.
> > > > And example source - example.tar.gz - have attached.
> > > > (If you have an example of the example :), then please
> > inform and send me.)
> > > >
> > > > By the way, I have something wondering about this way.
> > > > If several "elm_diskselector" are added with different
> > "displayed item
> > > > count" on one same parent,
> > > > then several different theme file have to be existed. In
> > this case, API
> > > > would be more efficient.
> > > >
> > > > I would like to know more about your opinion. Thanks
> > > >
> > > > Sincerely,
> > > > Shinwoo Kim.
> > > >
> > > >
> > > > 2011/3/19 Daniel Juyung Seo <seojuyu...@gmail.com>
> > > >>
> > > >> Check the _theme_hook().
> > > >> :)
> > > >>
> > > >> Thanks.
> > > >> Daniel Juyung Seo (SeoZ)
> > > >>
> > > >> On Sat, Mar 19, 2011 at 1:53 PM, cnook
> > <kimci...@gmail.com> wrote:
> > > >> > Dear All,
> > > >> >
> > > >> > Hi~
> > > >> >
> > > >> > Thanks for your response.
> > > >> >
> > > >> > I have tried to use "data.item" and
> > edje_object_data_get() API. It works
> > > >> > fine. :)
> > > >> >
> > > >> > But I met a problem. When I use a new style for
> > elm_diskselector,
> > > >> > edje_object_data_get() cannot retrieve "data.item" of
> > new style.
> > > >> >
> > > >> > Only original (default) "data.item" value is retrieved.
> > > >> >
> > > >> > Would you please let me know what I forget?
> > > >> >
> > > >> > Thanks.
> > > >> >
> > > >> >
> > > >> > Sincerely,
> > > >> > Shinwoo Kim.
> > > >> >
> > > >> >
> > > >> > 2011/3/18 Daniel Juyung Seo <seojuyu...@gmail.com>
> > > >> >>
> > > >> >> +3 !
> > > >> >> Using group data in theme looks better because it
> > reduces source-gui
> > > >> >> dependences.
> > > >> >>
> > > >> >> group { name: "xx";
> > > >> >> data.item: "count" "3";
> > > >> >>
> > > >> >> You can fetch this data from c source using
> > edje_object_data_get() API.
> > > >> >> Please check other widgets for a reference.
> > > >> >>
> > > >> >> I checked the patch very briefly and here are some
> > comments.
> > > >> >>
> > > >> >> 1. Indentation.
> > > >> >> ex) line 250 in elm_diskselector.diff
> > > >> >>
> > > >> >> 2. Blank lines.
> > > >> >> There are 2 blank lines at the end of diff file.
> > 396, 397 lines.
> > > >> >>
> > > >> >> 3. Diff file.
> > > >> >> I think there is no rule for this but you can merge
> > two diff files
> > > >> >> to one diff file
> > > >> >> because they are patches for a one feature and one
> > > >> >> library(elementary).
> > > >> >>
> > > >> >> 4. Sample code.
> > > >> >> It will be better to have a sample code for a new
> > feature in
> > > >> >> elementary_test.
> > > >> >>
> > > >> >> Other than that, looks ok :)
> > > >> >>
> > > >> >> Thanks.
> > > >> >> Daniel Juyung Seo (SeoZ)
> > > >> >>
> > > >> >> On Fri, Mar 18, 2011 at 5:57 AM, Tiago Falcao
> > > >> >> <develo...@tiagofalcao.com>
> > > >> >> wrote:
> > > >> >> > +2 !
> > > >> >> >
> > > >> >> > When had see this widget in first time, I imagined
> > it with option to
> > > >> >> > many items but ever configured in theme.
> > > >> >> > If i'm right, this widget is a lot dependent of code
> > and less of
> > > >> >> > theme
> > > >> >> > :(
> > > >> >> >
> > > >> >> > What you thing about this, Shinwoo Kim?
> > > >> >> > Gustavo suggested the easiest way, use group data.
> > > >> >> >
> > > >> >> > Thanks.
> > > >> >> >
> > > >> >> >
> > > >> >> > On Thu, Mar 17, 2011 at 4:47 PM, Gustavo Sverzut
> > Barbieri
> > > >> >> > <barbi...@profusion.mobi> wrote:
> > > >> >> >> On Thu, Mar 17, 2011 at 7:42 PM, Bruno Dilly
> > <bdi...@profusion.mobi>
> > > >> >> >> wrote:
> > > >> >> >>> On Thu, Mar 17, 2011 at 10:45 AM, cnook
> > <kimci...@gmail.com> wrote:
> > > >> >> >>>> Dear All,
> > > >> >> >>>
> > > >> >> >>> Hi Shinwoo Kim,
> > > >> >> >>>
> > > >> >> >>>>
> > > >> >> >>>> This is Shinwoo Kim, learned that I could
> > contribute to EFL! :)
> > > >> >> >>>> I'm pleased to inform you that the patch for the
> > > >> >> >>>> "elm_diskselector".
> > > >> >> >>>>
> > > >> >> >>>> Until now, the "elm_diskselector" only display 3
> > items at once,
> > > >> >> >>>> if you accept this patch, the "elm_diskselector"
> > can display more
> > > >> >> >>>> than 3
> > > >> >> >>>> items.
> > > >> >> >>>
> > > >> >> >>> Displaying more than 3 items is a nice
> > improvement.
> > > >> >> >>> What do you think about the idea of getting the
> > number of items to
> > > >> >> >>> be
> > > >> >> >>> displayed from the theme ?
> > > >> >> >>>
> > > >> >> >>> Anyway, there is a typo on documentation (param
> > num). Maybe a
> > > >> >> >>> getter
> > > >> >> >>> could be useful as well.
> > > >> >> >>
> > > >> >> >> +1 to get it from theme!
> > > >> >> >>
> > > >> >> >> I did something similar for ephoto in some older
> > version, it had
> > > >> >> >> couple of swallow parts defined, like
> > "elm.swallow.p%d", and a
> > > >> >> >> data.item: "count" "3", thus it would fill 3
> > swallows.
> > > >> >> >>
> > > >> >> >> I believe this is something up to the theme as it
> > has the knowledge
> > > >> >> >> on
> > > >> >> >> how to pack more items.
> > > >> >> >>
> > > >> >> >>
> > > >> >> >> --
> > > >> >> >> Gustavo Sverzut Barbieri
> > > >> >> >> http://profusion.mobi embedded systems
> > > >> >> >> --------------------------------------
> > > >> >> >> MSN: barbi...@gmail.com
> > > >> >> >> Skype: gsbarbieri
> > > >> >> >> Mobile: +55 (19) 9225-2202
> > > >> >> >>
> > > >> >> >>
> > > >> >> >>
> > > >> >> >>
> >
> ------------------------------------------------------------------------------
> > > >> >> >> Colocation vs. Managed Hosting
> > > >> >> >> A question and answer guide to determining the best
> > fit
> > > >> >> >> for your organization - today and in the future.
> > > >> >> >> http://p.sf.net/sfu/internap-sfd2d
> > > >> >> >> _______________________________________________
> > > >> >> >> enlightenment-devel mailing list
> > > >> >> >> enlightenment-devel@lists.sourceforge.net
> > > >> >> >>
> > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
> > > >> >> >>
> > > >> >> >
> > > >> >> >
> > > >> >> >
> > > >> >> > --
> > > >> >> > Tiago Rezende Campos Falcão
> > > >> >> > http://www.tiagofalcao.com
> > > >> >> > --
> > > >> >> > ProFUSION | embedded systems
> > > >> >> > Computer Systems Laboratory - IC - Unicamp
> > > >> >> > Grupo Pró Software Livre - Unicamp
> > > >> >> > Laboratory of Information Systems - IC - Unicamp
> > > >> >> >
> > > >> >> >
> > > >> >> >
> > > >> >> >
> >
> ------------------------------------------------------------------------------
> > > >> >> > Colocation vs. Managed Hosting
> > > >> >> > A question and answer guide to determining the best
> > fit
> > > >> >> > for your organization - today and in the future.
> > > >> >> > http://p.sf.net/sfu/internap-sfd2d
> > > >> >> > _______________________________________________
> > > >> >> > enlightenment-devel mailing list
> > > >> >> > enlightenment-devel@lists.sourceforge.net
> > > >> >> >
> > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
> > > >> >> >
> > > >> >
> > > >> >
> > > >
> > > >
> > >
> >
> > >
> >
> ------------------------------------------------------------------------------
> > > Enable your software for Intel(R) Active Management
> > Technology to meet the
> > > growing manageability and security demands of your
> > customers. Businesses
> > > are taking advantage of Intel(R) vPro (TM) technology - will
> > your software
> > > be a part of the solution? Download the Intel(R)
> > Manageability Checker
> > > today! http://p.sf.net/sfu/intel-dev2devmar
> >
> > > _______________________________________________
> > > enlightenment-devel mailing list
> > > enlightenment-devel@lists.sourceforge.net
> > >
> > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
> >
> >
> >
> >
>
>
>
Index: src/lib/elm_diskselector.c
===================================================================
--- src/lib/elm_diskselector.c (revision 57931)
+++ src/lib/elm_diskselector.c (working copy)
@@ -19,6 +19,10 @@
# define MAX(a, b) (((a) > (b)) ? (a) : (b))
#endif
+#ifndef CEIL
+#define CEIL(a) (((a) % 2 != 0) ? ((a) / 2 + 1) : ((a) / 2))
+#endif
+
typedef struct _Widget_Data Widget_Data;
struct _Widget_Data
@@ -35,7 +39,9 @@
Elm_Diskselector_Item *last;
Eina_List *items;
Eina_List *r_items;
- int item_count, len_threshold, len_side;
+ Eina_List *over_items;
+ Eina_List *under_items;
+ int item_count, len_threshold, len_side, display_item_num;
Ecore_Idler *idler;
Ecore_Idler *check_idler;
Eina_Bool init:1;
@@ -67,6 +73,8 @@
static void _sub_del(void *data, Evas_Object * obj, void *event_info);
static void _round_items_del(Widget_Data *wd);
static void _scroller_move_cb(void *data, Evas_Object *obj, void *event_info);
+static void _item_click_cb(void *data, Evas_Object *obj, void *event_info);
+static void _selected_item_indicate(Elm_Diskselector_Item *it);
static const char SIG_SELECTED[] = "selected";
static const Evas_Smart_Cb_Description _signals[] = {
@@ -91,12 +99,12 @@
evas_object_geometry_get(wd->scroller, NULL, NULL, &w, &h);
if (wd->round)
- evas_object_resize(wd->main_box, w / 3 * (wd->item_count + 4), h);
+ evas_object_resize(wd->main_box, w / wd->display_item_num * (wd->item_count + CEIL(wd->display_item_num) * 2), h);
else
- evas_object_resize(wd->main_box, w / 3 * (wd->item_count + 2), h);
+ evas_object_resize(wd->main_box, w / wd->display_item_num * (wd->item_count + CEIL(wd->display_item_num)), h);
elm_smart_scroller_paging_set(wd->scroller, 0, 0,
- (int)(w / 3), 0);
+ (int)(w / wd->display_item_num), 0);
if (!wd->idler)
wd->idler = ecore_idler_add(_move_scroller, data);
@@ -124,7 +132,10 @@
evas_object_show(it->base.view);
if (it->label)
+ {
edje_object_part_text_set(it->base.view, "elm.text", it->label);
+ edje_object_signal_callback_add(it->base.view, "elm,action,click", "", _item_click_cb, it);
+ }
if (it->icon)
{
evas_object_size_hint_min_set(it->icon, 24, 24);
@@ -156,6 +167,15 @@
}
static void
+_default_display_item_num_set(Widget_Data *wd)
+{
+ const char* str;
+ str = edje_object_data_get(wd->right_blank, "display_item_num");
+ if (str) wd->display_item_num = atoi(str);
+ else wd->display_item_num = 3;
+}
+
+ static void
_del_hook(Evas_Object * obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
@@ -167,6 +187,8 @@
_del_pre_hook(Evas_Object * obj)
{
Elm_Diskselector_Item *it;
+ Eina_List *l;
+
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
@@ -199,6 +221,26 @@
free(wd->first);
}
+ EINA_LIST_FOREACH(wd->under_items, l, it)
+ {
+ if (it)
+ {
+ eina_stringshare_del(it->label);
+ evas_object_del(wd->first->base.view);
+ free(it);
+ }
+ }
+
+ EINA_LIST_FOREACH(wd->over_items, l, it)
+ {
+ if (it)
+ {
+ eina_stringshare_del(it->label);
+ evas_object_del(wd->first->base.view);
+ free(it);
+ }
+ }
+
EINA_LIST_FREE(wd->items, it) _item_del(it);
eina_list_free(wd->r_items);
}
@@ -274,6 +316,7 @@
if (!it) return;
Widget_Data *wd = elm_widget_data_get(it->base.widget);
wd->selected_item = it;
+ _selected_item_indicate(wd->selected_item);
if (it->func) it->func((void *)it->base.data, it->base.widget, it);
evas_object_smart_callback_call(it->base.widget, SIG_SELECTED, it);
}
@@ -438,6 +481,45 @@
}
static void
+_selected_item_indicate(Elm_Diskselector_Item *it)
+{
+ Elm_Diskselector_Item *item;
+ Eina_List *l;
+ Widget_Data *wd;
+ wd = elm_widget_data_get(it->base.widget);
+
+ if (!wd) return;
+
+ EINA_LIST_FOREACH(wd->r_items, l, item)
+ {
+ if (strcmp(item->label, it->label) == 0) edje_object_signal_emit(item->base.view, "elm,state,selected", "elm");
+ else
+ edje_object_signal_emit(item->base.view, "elm,state,default", "elm");
+ }
+}
+
+static void
+_item_click_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ Elm_Diskselector_Item *it = data;
+
+ if (!it) return;
+
+ Widget_Data *wd;
+ wd = elm_widget_data_get(it->base.widget);
+
+ if (!wd) return;
+
+ if (wd->selected_item != it)
+ {
+ wd->selected_item = it;
+ _selected_item_indicate(wd->selected_item);
+ }
+
+ if (it->func) it->func((void*) it->base.data, it->base.widget, it);
+}
+
+static void
_scroller_move_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
Evas_Coord x, y, w, h, bw;
@@ -449,13 +531,13 @@
if (wd->round)
{
evas_object_geometry_get(wd->main_box, NULL, NULL, &bw, NULL);
- if (x > w / 3 * (wd->item_count + 1))
- elm_smart_scroller_child_region_show(wd->scroller,
- x - w / 3 * wd->item_count,
+ if (x > w / wd->display_item_num * (wd->item_count + (wd->display_item_num % 2)))
+ elm_smart_scroller_child_region_show(wd->scroller,
+ x - w / wd->display_item_num * wd->item_count,
y, w, h);
else if (x < 0)
- elm_smart_scroller_child_region_show(wd->scroller,
- x + w / 3 * wd->item_count,
+ elm_smart_scroller_child_region_show(wd->scroller,
+ x + w / wd->display_item_num * wd->item_count,
y, w, h);
}
}
@@ -522,7 +604,7 @@
}
evas_object_geometry_get(wd->scroller, NULL, &y, &w, &h);
- elm_smart_scroller_child_region_show(wd->scroller, w / 3 * i, y, w, h);
+ elm_smart_scroller_child_region_show(wd->scroller, w / wd->display_item_num * i, y, w, h);
_select_item(dit);
if (wd->idler)
{
@@ -549,6 +631,9 @@
static void
_round_items_del(Widget_Data *wd)
{
+ Eina_List *l;
+ Elm_Diskselector_Item * it;
+
_round_item_del(wd, wd->last);
wd->last = NULL;
_round_item_del(wd, wd->s_last);
@@ -557,6 +642,18 @@
wd->second = NULL;
_round_item_del(wd, wd->first);
wd->first = NULL;
+
+ EINA_LIST_FOREACH(wd->under_items, l, it)
+ {
+ _round_item_del(wd, it);
+ it = NULL;
+ }
+
+ EINA_LIST_FOREACH(wd->over_items, l, it)
+ {
+ _round_item_del(wd, it);
+ it = NULL;
+ }
}
static void
@@ -564,7 +661,8 @@
{
Elm_Diskselector_Item *dit;
Elm_Diskselector_Item *it;
-
+ Elm_Diskselector_Item *temp_it;
+ int i = 0;
dit = it = eina_list_nth(wd->items, 0);
if (!dit) return;
@@ -587,6 +685,16 @@
wd->r_items = eina_list_append(wd->r_items, wd->second);
}
+ // if more than 3 itmes should be displayed
+ for(i = 2; i < CEIL(wd->display_item_num); i++)
+ {
+ it = eina_list_nth(wd->items, i);
+ if (!it) it = dit;
+ temp_it = _item_new(it->base.widget, it->icon, it->label, it->func, it->base.data);
+ wd->over_items = eina_list_append(wd->over_items, temp_it);
+ wd->r_items = eina_list_append(wd->r_items, temp_it);
+ }
+
it = eina_list_nth(wd->items, wd->item_count - 1);
if (!it)
it = dit;
@@ -608,6 +716,16 @@
wd->s_last->node = it->node;
wd->r_items = eina_list_prepend(wd->r_items, wd->s_last);
}
+
+ // if more than 3 itmes should be displayed
+ for(i = 3; i <= CEIL(wd->display_item_num); i++)
+ {
+ it = eina_list_nth(wd->items, wd->item_count - i);
+ if (!it) it = dit;
+ temp_it = _item_new(it->base.widget, it->icon, it->label, it->func, it->base.data);
+ wd->under_items = eina_list_append(wd->under_items, temp_it);
+ wd->r_items = eina_list_prepend(wd->r_items, temp_it);
+ }
}
/**
@@ -643,6 +761,7 @@
wd->round = EINA_FALSE;
wd->init = EINA_FALSE;
wd->len_side = 3;
+ _default_display_item_num_set(wd);
wd->scroller = elm_smart_scroller_add(evas_object_evas_get(parent));
elm_smart_scroller_widget_set(wd->scroller, obj);
@@ -735,6 +854,9 @@
EAPI void
elm_diskselector_round_set(Evas_Object * obj, Eina_Bool round)
{
+ Eina_List *elist;
+ Elm_Diskselector_Item *it;
+
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
@@ -759,10 +881,19 @@
elm_box_pack_start(wd->main_box, wd->last->base.view);
if (wd->s_last)
elm_box_pack_start(wd->main_box, wd->s_last->base.view);
+
+ // if more than 3 items should be displayed
+ EINA_LIST_FOREACH(wd->under_items, elist, it)
+ elm_box_pack_start(wd->main_box, it->base.view);
+
if (wd->first)
elm_box_pack_end(wd->main_box, wd->first->base.view);
if (wd->second)
elm_box_pack_end(wd->main_box, wd->second->base.view);
+
+ // if more than 3 items should be displayed
+ EINA_LIST_FOREACH(wd->over_items, elist, it)
+ elm_box_pack_end(wd->main_box, it->base.view);
}
else
{
@@ -772,6 +903,8 @@
eina_list_free(wd->r_items);
wd->r_items = NULL;
}
+
+ _selected_item_indicate(wd->selected_item);
_sizing_eval(obj);
}
@@ -1014,6 +1147,9 @@
{
ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(it);
Elm_Diskselector_Item *dit;
+ Elm_Diskselector_Item *item;
+ Eina_List *l;
+ int i = 0;
Widget_Data *wd = elm_widget_data_get(it->base.widget);
if (!wd) return;
@@ -1031,6 +1167,8 @@
wd->selected_item = dit;
else
wd->selected_item = eina_list_nth(wd->items, 1);
+
+ _selected_item_indicate(wd->selected_item);
}
_item_del(it);
@@ -1044,6 +1182,12 @@
evas_object_hide(wd->second->base.view);
evas_object_hide(wd->last->base.view);
evas_object_hide(wd->s_last->base.view);
+
+ EINA_LIST_FOREACH(wd->under_items, l, item)
+ evas_object_hide(item->base.view);
+
+ EINA_LIST_FOREACH(wd->over_items, l, item)
+ evas_object_hide(item->base.view);
}
else
{
@@ -1061,6 +1205,15 @@
edje_object_part_text_set(wd->second->base.view, "elm.text",
wd->second->label);
}
+ // if more than 3 itmes should be displayed
+ for(i = 2; i < CEIL(wd->display_item_num); i++)
+ {
+ dit = eina_list_nth(wd->items, i);
+ item = eina_list_nth(wd->over_items, i - 2);
+ eina_stringshare_replace(&item->label, dit->label);
+ edje_object_part_text_set(item->base.view, "elm.text", item->label);
+ }
+
dit = eina_list_nth(wd->items, eina_list_count(wd->items) - 1);
if (dit)
{
@@ -1075,6 +1228,14 @@
edje_object_part_text_set(wd->s_last->base.view, "elm.text",
wd->s_last->label);
}
+ // if more than 3 itmes should be displayed
+ for(i = 3; i <= CEIL(wd->display_item_num); i++)
+ {
+ dit = eina_list_nth(wd->items, wd->item_count - i);
+ item = eina_list_nth(wd->under_items, i - 3);
+ eina_stringshare_replace(&item->label, dit->label);
+ edje_object_part_text_set(item->base.view, "elm.text", item->label);
+ }
}
}
wd->check_idler = ecore_idler_add(_check_string, wd);
@@ -1156,7 +1317,10 @@
if ((wd->selected_item == it) && (!selected))
wd->selected_item = eina_list_data_get(wd->items);
else
- wd->selected_item = it;
+ {
+ wd->selected_item = it;
+ _selected_item_indicate(wd->selected_item);
+ }
if (!wd->idler)
ecore_idler_add(_move_scroller, it->base.widget);
@@ -1541,3 +1705,19 @@
ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(item, EINA_FALSE);
return elm_widget_item_cursor_engine_only_get(item);
}
+/**
+ * Set the number of items to be displayed
+ *
+ * @param obj The diskselector object
+ * @param num The number of itmes that diskselector will display
+ *
+ * @ingroup Diskselector
+ */
+EAPI void
+elm_diskselector_display_item_num_set(Evas_Object *obj, int num)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ wd->display_item_num = num;
+}
Index: src/lib/Elementary.h.in
===================================================================
--- src/lib/Elementary.h.in (revision 57931)
+++ src/lib/Elementary.h.in (working copy)
@@ -2449,6 +2449,7 @@
EAPI const char *elm_diskselector_item_cursor_style_get(const Elm_Diskselector_Item *item) EINA_ARG_NONNULL(1);
EAPI void elm_diskselector_item_cursor_engine_only_set(Elm_Diskselector_Item *item, Eina_Bool engine_only) EINA_ARG_NONNULL(1);
EAPI Eina_Bool elm_diskselector_item_cursor_engine_only_get(const Elm_Diskselector_Item *item) EINA_ARG_NONNULL(1);
+ EAPI void elm_diskselector_display_item_num_set(Evas_Object *obj, int num) EINA_ARG_NONNULL(1);
/* smart callbacks called:
* "selected" - when item is selected (scroller stops)
*/
Index: src/bin/test_diskselector.c
===================================================================
--- src/bin/test_diskselector.c (revision 57931)
+++ src/bin/test_diskselector.c (working copy)
@@ -61,6 +61,7 @@
Evas_Object *win, *bg, *bx, *disk, *ic;
Elm_Diskselector_Item *it;
char buf[PATH_MAX];
+ int idx = 0;
win = elm_win_add(NULL, "diskselector", ELM_WIN_BASIC);
elm_win_title_set(win, "Disk Selector");
@@ -124,6 +125,50 @@
evas_object_show(disk);
evas_object_smart_callback_add(disk, "selected", _print_disk_info_cb, NULL);
+ // displayed item number setting example
+ disk = elm_diskselector_add(win);
+ elm_diskselector_display_item_num_set(disk, 5);
+
+ char *month_list[] = {
+ "Jan", "Feb", "Mar",
+ "Apr", "May", "Jun",
+ "Jul", "Aug", "Sep",
+ "Oct", "Nov", "Dec"
+ };
+
+ for(idx = 0; idx < sizeof(month_list) / sizeof(month_list[0]); idx++)
+ {
+ it = elm_diskselector_item_append(disk, month_list[idx], NULL, NULL, NULL);
+ }
+
+ elm_diskselector_item_selected_set(it, EINA_TRUE);
+ elm_diskselector_round_set(disk, EINA_TRUE);
+ evas_object_size_hint_weight_set(disk, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(disk, EVAS_HINT_FILL, 0.5);
+ elm_box_pack_end(bx, disk);
+ evas_object_show(disk);
+ evas_object_smart_callback_add(disk, "selected", _print_disk_info_cb, NULL);
+
+ // displayed item number setting example
+ disk = elm_diskselector_add(win);
+ elm_diskselector_display_item_num_set(disk, 7);
+
+ char date[3];
+ for(idx = 1; idx < 31; idx++)
+ {
+ snprintf(date, sizeof(date), "%d", idx);
+ it = elm_diskselector_item_append(disk, date, NULL, NULL, NULL);
+ }
+
+ elm_diskselector_item_selected_set(it, EINA_TRUE);
+ elm_diskselector_round_set(disk, EINA_TRUE);
+ evas_object_size_hint_weight_set(disk, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(disk, EVAS_HINT_FILL, 0.5);
+ elm_box_pack_end(bx, disk);
+ evas_object_show(disk);
+ evas_object_smart_callback_add(disk, "selected", _print_disk_info_cb, NULL);
+
+
evas_object_resize(win, 320, 480);
evas_object_show(win);
}
Index: data/themes/default.edc
===================================================================
--- data/themes/default.edc (revision 57931)
+++ data/themes/default.edc (working copy)
@@ -35044,6 +35044,7 @@
data {
item: "len_threshold" "14";
+ item: "display_item_num" "3";
}
parts {
------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software
be a part of the solution? Download the Intel(R) Manageability Checker
today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel