1 #include <Elementary.h>
4 typedef struct _Widget_Data Widget_Data;
8 >>>>>>> remotes/origin/upstream
9 typedef struct _Elm_Slideshow_Item Elm_Slideshow_Item;
11 struct _Elm_Slideshow_Item
15 Eina_List *l, *l_built;
17 const Elm_Slideshow_Item_Class *itc;
22 Evas_Object *slideshow;
24 // list of Elm_Slideshow_Item*
26 Eina_List *items_built;
28 Elm_Slideshow_Item *current;
29 Elm_Slideshow_Item *previous;
31 Eina_List *transitions;
32 const char *transition;
34 int count_item_pre_before;
35 int count_item_pre_after;
42 Eina_List *list; //list of const char *
46 static const char *widtype = NULL;
47 static void _del_pre_hook(Evas_Object *obj);
48 static void _del_hook(Evas_Object *obj);
49 static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl);
50 static void _theme_hook(Evas_Object *obj);
51 static void _sizing_eval(Evas_Object *obj);
52 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
53 static Eina_Bool _timer_cb(void *data);
54 static void _on_focus_hook(void *data, Evas_Object *obj);
55 static Eina_Bool _event_hook(Evas_Object *obj, Evas_Object *src,
56 Evas_Callback_Type type, void *event_info);
58 static const char SIG_CHANGED[] = "changed";
59 static const char SIG_TRANSITION_END[] = "transition,end";
61 static const Evas_Smart_Cb_Description _signals[] = {
63 {SIG_TRANSITION_END, ""},
68 _event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
70 if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE;
71 Evas_Event_Key_Down *ev = event_info;
72 Widget_Data *wd = elm_widget_data_get(obj);
73 if (!wd) return EINA_FALSE;
74 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
75 if (elm_widget_disabled_get(obj)) return EINA_FALSE;
76 if ((!strcmp(ev->keyname, "Left")) || (!strcmp(ev->keyname, "KP_Left")))
78 elm_slideshow_previous(obj);
79 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
82 if ((!strcmp(ev->keyname, "Right")) || (!strcmp(ev->keyname, "KP_Right")))
84 elm_slideshow_next(obj);
85 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
88 if ((!strcmp(ev->keyname, "Return")) ||
89 (!strcmp(ev->keyname, "KP_Enter")) ||
90 (!strcmp(ev->keyname, "space")))
96 ecore_timer_del(wd->timer);
100 elm_slideshow_timeout_set(obj, wd->timeout);
102 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
109 _del_pre_hook(Evas_Object *obj)
111 Widget_Data *wd = elm_widget_data_get(obj);
113 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
114 _changed_size_hints, obj);
118 _del_hook(Evas_Object *obj)
121 Widget_Data *wd = elm_widget_data_get(obj);
123 elm_slideshow_clear(obj);
124 elm_widget_stringlist_free(wd->transitions);
125 if (wd->timer) ecore_timer_del(wd->timer);
126 EINA_LIST_FREE(wd->layout.list, layout)
127 eina_stringshare_del(layout);
132 _on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
134 Widget_Data *wd = elm_widget_data_get(obj);
136 if (elm_widget_focus_get(obj))
138 edje_object_signal_emit(wd->slideshow, "elm,action,focus", "elm");
139 evas_object_focus_set(wd->slideshow, EINA_TRUE);
143 edje_object_signal_emit(wd->slideshow, "elm,action,unfocus", "elm");
144 evas_object_focus_set(wd->slideshow, EINA_FALSE);
149 _mirrored_set(Evas_Object *obj, Eina_Bool rtl)
151 Widget_Data *wd = elm_widget_data_get(obj);
153 edje_object_mirrored_set(wd->slideshow, rtl);
157 _theme_hook(Evas_Object *obj)
159 Widget_Data *wd = elm_widget_data_get(obj);
161 _elm_widget_mirrored_reload(obj);
162 _mirrored_set(obj, elm_widget_mirrored_get(obj));
163 _elm_theme_object_set(obj, wd->slideshow, "slideshow", "base", elm_widget_style_get(obj));
164 edje_object_scale_set(wd->slideshow, elm_widget_scale_get(obj) *
170 _sizing_eval(Evas_Object *obj)
172 Widget_Data *wd = elm_widget_data_get(obj);
173 Evas_Coord minw = -1, minh = -1;
175 edje_object_size_min_calc(wd->slideshow, &minw, &minh);
176 evas_object_size_hint_min_set(obj, minw, minh);
177 evas_object_size_hint_max_set(obj, minw, minh);
181 static Elm_Slideshow_Item* _item_prev_get(Elm_Slideshow_Item* item)
183 Widget_Data *wd = elm_widget_data_get(WIDGET(item));
184 Elm_Slideshow_Item* prev = eina_list_data_get(eina_list_prev(item->l));
185 if ((!prev) && (wd->loop))
186 prev = eina_list_data_get(eina_list_last(item->l));
190 static Elm_Slideshow_Item* _item_next_get(Elm_Slideshow_Item* item)
192 Widget_Data *wd = elm_widget_data_get(WIDGET(item));
193 Elm_Slideshow_Item* next = eina_list_data_get(eina_list_next(item->l));
194 if ((!next) && (wd->loop))
195 next = eina_list_data_get(wd->items);
200 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
206 _sub_del(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
212 _item_realize(Elm_Slideshow_Item *item)
214 Elm_Slideshow_Item *_item_prev, *_item_next;
215 Evas_Object *obj = WIDGET(item);
216 Widget_Data *wd = elm_widget_data_get(obj);
217 int ac, bc, lc, ic = 0;
220 if ((!VIEW(item)) && (item->itc->func.get))
222 VIEW(item) = item->itc->func.get(elm_widget_item_data_get(item),
224 evas_object_smart_member_add(VIEW(item), obj);
225 item->l_built = eina_list_append(NULL, item);
226 wd->items_built = eina_list_merge(wd->items_built, item->l_built);
227 evas_object_hide(VIEW(item));
229 else if (item->l_built)
230 wd->items_built = eina_list_demote_list(wd->items_built, item->l_built);
232 //pre-create previous and next item
233 ac = wd->count_item_pre_after;
235 bc = wd->count_item_pre_before;
237 lc = eina_list_count(wd->items) - 1;
238 while (lc > 0 && ((ac > 0) || (bc > 0)))
240 if (lc > 0 && ac > 0)
246 _item_next = _item_next_get(_item_next);
248 && (!VIEW(_item_next))
249 && (_item_next->itc->func.get))
253 _item_next->itc->func.get(
254 elm_widget_item_data_get(_item_next), obj);
255 evas_object_smart_member_add(VIEW(_item_next), obj);
256 _item_next->l_built = eina_list_append(NULL, _item_next);
257 wd->items_built = eina_list_merge(wd->items_built,
258 _item_next->l_built);
259 evas_object_hide(VIEW(_item_next));
261 else if (_item_next && _item_next->l_built)
265 eina_list_demote_list(wd->items_built,
266 _item_next->l_built);
271 if (lc > 0 && bc > 0)
277 _item_prev = _item_prev_get(_item_prev);
279 && (!VIEW(_item_prev))
280 && (_item_prev->itc->func.get))
284 _item_prev->itc->func.get(
285 elm_widget_item_data_get(_item_prev), obj);
286 evas_object_smart_member_add(VIEW(_item_prev), obj);
287 _item_prev->l_built = eina_list_append(NULL, _item_prev);
288 wd->items_built = eina_list_merge(wd->items_built,
289 _item_prev->l_built);
290 evas_object_hide(VIEW(_item_prev));
292 else if (_item_prev && _item_prev->l_built)
296 eina_list_demote_list(wd->items_built,
297 _item_prev->l_built);
303 //delete unused items
305 while ((int)eina_list_count(wd->items_built) > lc)
307 item = eina_list_data_get(wd->items_built);
308 wd->items_built = eina_list_remove_list(wd->items_built,
310 if (item->itc->func.del)
311 item->itc->func.del(elm_widget_item_data_get(item), VIEW(item));
312 evas_object_del(VIEW(item));
318 _end(void *data, Evas_Object *obj __UNUSED__, const char *emission, const char *source __UNUSED__)
320 Elm_Slideshow_Item *item;
321 Widget_Data *wd = elm_widget_data_get(data);
327 edje_object_part_unswallow(wd->slideshow, VIEW(item));
328 evas_object_hide(VIEW(item));
333 if ((!item) || (!VIEW(item))) return;
336 edje_object_part_unswallow(wd->slideshow, VIEW(item));
338 edje_object_part_swallow(wd->slideshow, "elm.swallow.1", VIEW(item));
339 edje_object_signal_emit(wd->slideshow, "anim,end", "slideshow");
340 if (emission != NULL)
341 evas_object_smart_callback_call(data, SIG_TRANSITION_END, wd->current);
345 _timer_cb(void *data)
347 Evas_Object *obj = data;
348 Widget_Data *wd = elm_widget_data_get(obj);
349 if (!wd) return ECORE_CALLBACK_CANCEL;
351 elm_slideshow_next(obj);
352 return ECORE_CALLBACK_CANCEL;
356 _item_del_pre_hook(Elm_Object_Item *it)
359 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
361 Elm_Slideshow_Item *item = (Elm_Slideshow_Item *) it;
363 Elm_Slideshow_Item *item = (Elm_Slideshow_Item *)it;
364 >>>>>>> remotes/origin/upstream
365 Widget_Data *wd = elm_widget_data_get(WIDGET(item));
366 if (!wd) return EINA_FALSE;
368 if (wd->previous == item) wd->previous = NULL;
369 if (wd->current == item)
371 Eina_List *l = eina_list_data_find_list(wd->items, item);
372 Eina_List *l2 = eina_list_next(l);
376 l2 = eina_list_prev(l);
379 elm_slideshow_show(eina_list_data_get(l2));
383 elm_slideshow_show(eina_list_data_get(l2));
385 elm_slideshow_item_show(eina_list_data_get(l2));
389 elm_slideshow_item_show(eina_list_data_get(l2));
390 >>>>>>> remotes/origin/upstream
393 wd->items = eina_list_remove_list(wd->items, item->l);
394 wd->items_built = eina_list_remove_list(wd->items_built, item->l_built);
396 if ((VIEW(item)) && (item->itc->func.del))
397 item->itc->func.del(elm_widget_item_data_get(item), VIEW(item));
403 elm_slideshow_add(Evas_Object *parent)
409 ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
411 ELM_SET_WIDTYPE(widtype, "slideshow");
412 elm_widget_type_set(obj, "slideshow");
413 elm_widget_sub_object_add(parent, obj);
414 elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
415 elm_widget_data_set(obj, wd);
416 elm_widget_del_pre_hook_set(obj, _del_pre_hook);
417 elm_widget_del_hook_set(obj, _del_hook);
418 elm_widget_theme_hook_set(obj, _theme_hook);
419 elm_widget_can_focus_set(obj, EINA_TRUE);
420 elm_widget_event_hook_set(obj, _event_hook);
425 wd->slideshow = edje_object_add(e);
426 _elm_theme_object_set(obj, wd->slideshow, "slideshow", "base", "default");
427 evas_object_smart_member_add(wd->slideshow, obj);
428 wd->count_item_pre_before = 2;
429 wd->count_item_pre_after = 2;
430 elm_widget_resize_object_set(obj, wd->slideshow);
431 evas_object_show(wd->slideshow);
433 wd->transitions = elm_widget_stringlist_get(edje_object_data_get(wd->slideshow, "transitions"));
434 if (eina_list_count(wd->transitions) > 0)
435 wd->transition = eina_stringshare_add(eina_list_data_get(wd->transitions));
437 wd->layout.list = elm_widget_stringlist_get(edje_object_data_get(wd->slideshow, "layouts"));
438 if (eina_list_count(wd->layout.list) > 0)
439 wd->layout.current = eina_list_data_get(wd->layout.list);
441 edje_object_signal_callback_add(wd->slideshow, "end", "slideshow", _end, obj);
443 evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
444 evas_object_event_callback_add(obj, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
446 evas_object_smart_callbacks_descriptions_set(obj, _signals);
448 _mirrored_set(obj, elm_widget_mirrored_get(obj));
453 EAPI Elm_Object_Item*
454 elm_slideshow_item_add(Evas_Object *obj, const Elm_Slideshow_Item_Class *itc, const void *data)
456 Elm_Slideshow_Item *item;
457 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
458 Widget_Data *wd = elm_widget_data_get(obj);
460 if (!wd) return NULL;
461 item = elm_widget_item_new(obj, Elm_Slideshow_Item);
462 if (!item) return NULL;
463 elm_widget_item_del_pre_hook_set(item, _item_del_pre_hook);
465 item->l = eina_list_append(item->l, item);
466 elm_widget_item_data_set(item, data);
468 wd->items = eina_list_merge(wd->items, item->l);
471 if (!wd->current) elm_slideshow_show((Elm_Object_Item *) item);
473 return (Elm_Object_Item *) item;
475 if (!wd->current) elm_slideshow_item_show((Elm_Object_Item *)item);
477 return (Elm_Object_Item *)item;
478 >>>>>>> remotes/origin/upstream
481 EAPI Elm_Object_Item*
482 elm_slideshow_item_sorted_insert(Evas_Object *obj, const Elm_Slideshow_Item_Class *itc, const void *data, Eina_Compare_Cb func)
484 Elm_Slideshow_Item *item;
485 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
486 Widget_Data *wd = elm_widget_data_get(obj);
487 if (!wd) return NULL;
489 item = elm_widget_item_new(obj, Elm_Slideshow_Item);
490 if (!item) return NULL;
491 elm_widget_item_del_pre_hook_set(item, _item_del_pre_hook);
493 item->l = eina_list_append(item->l, item);
494 elm_widget_item_data_set(item, data);
496 wd->items = eina_list_sorted_merge(wd->items, item->l, func);
499 if (!wd->current) elm_slideshow_show((Elm_Object_Item *) item);
501 return (Elm_Object_Item *) item;
505 elm_slideshow_show(Elm_Object_Item *it)
507 if (!wd->current) elm_slideshow_item_show((Elm_Object_Item *)item);
509 return (Elm_Object_Item *)item;
513 elm_slideshow_item_show(Elm_Object_Item *it)
514 >>>>>>> remotes/origin/upstream
516 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
519 Elm_Slideshow_Item *item, *next = NULL;
522 item = (Elm_Slideshow_Item *) it;
524 item = (Elm_Slideshow_Item *)it;
525 >>>>>>> remotes/origin/upstream
526 wd = elm_widget_data_get(WIDGET(item));
528 if (item == wd->current) return;
531 _end(WIDGET(item), WIDGET(item), NULL, NULL);
533 if (wd->timer) ecore_timer_del(wd->timer);
534 if (wd->timeout > 0.0)
535 wd->timer = ecore_timer_add(wd->timeout, _timer_cb, WIDGET(item));
537 edje_object_part_swallow(wd->slideshow, "elm.swallow.2", VIEW(next));
538 snprintf(buf, sizeof(buf), "%s,next", wd->transition);
539 edje_object_signal_emit(wd->slideshow, buf, "slideshow");
540 wd->previous = wd->current;
542 evas_object_smart_callback_call(WIDGET(item), SIG_CHANGED, wd->current);
547 EINA_DEPRECATED EAPI void
548 elm_slideshow_show(Elm_Object_Item *it)
550 elm_slideshow_item_show(it);
553 >>>>>>> remotes/origin/upstream
555 elm_slideshow_next(Evas_Object *obj)
558 Elm_Slideshow_Item *next = NULL;
559 ELM_CHECK_WIDTYPE(obj, widtype);
560 Widget_Data *wd = elm_widget_data_get(obj);
565 next = _item_next_get(wd->current);
567 if ((!next) || (next == wd->current)) return;
569 _end(obj, obj, NULL, NULL);
571 if (wd->timer) ecore_timer_del(wd->timer);
572 if (wd->timeout > 0.0)
573 wd->timer = ecore_timer_add(wd->timeout, _timer_cb, obj);
577 edje_object_part_swallow(wd->slideshow, "elm.swallow.2", VIEW(next));
579 snprintf(buf, sizeof(buf), "%s,next", wd->transition);
580 edje_object_signal_emit(wd->slideshow, buf, "slideshow");
582 wd->previous = wd->current;
584 evas_object_smart_callback_call(obj, SIG_CHANGED, wd->current);
588 elm_slideshow_previous(Evas_Object *obj)
591 Elm_Slideshow_Item *prev = NULL;
592 ELM_CHECK_WIDTYPE(obj, widtype);
593 Widget_Data *wd = elm_widget_data_get(obj);
598 prev = _item_prev_get(wd->current);
600 if ((!prev) || (prev == wd->current)) return;
602 _end(obj, obj, NULL, NULL);
604 if (wd->timer) ecore_timer_del(wd->timer);
605 if (wd->timeout > 0.0)
606 wd->timer = ecore_timer_add(wd->timeout, _timer_cb, obj);
610 edje_object_part_swallow(wd->slideshow, "elm.swallow.2", VIEW(prev));
612 snprintf(buf, 1024, "%s,previous", wd->transition);
613 edje_object_signal_emit(wd->slideshow, buf, "slideshow");
615 wd->previous = wd->current;
617 evas_object_smart_callback_call(obj, SIG_CHANGED, wd->current);
620 EAPI const Eina_List *
621 elm_slideshow_transitions_get(const Evas_Object *obj)
623 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
624 Widget_Data *wd = elm_widget_data_get(obj);
625 if (!wd) return NULL;
626 return wd->transitions;
629 EAPI const Eina_List *
630 elm_slideshow_layouts_get(const Evas_Object *obj)
632 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
633 Widget_Data *wd = elm_widget_data_get(obj);
634 if (!wd) return NULL;
635 return wd->layout.list;
639 elm_slideshow_transition_set(Evas_Object *obj, const char *transition)
641 ELM_CHECK_WIDTYPE(obj, widtype);
642 Widget_Data *wd = elm_widget_data_get(obj);
644 eina_stringshare_replace(&wd->transition, transition);
648 elm_slideshow_transition_get(const Evas_Object *obj)
650 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
651 Widget_Data *wd = elm_widget_data_get(obj);
652 if (!wd) return NULL;
653 return wd->transition;
657 elm_slideshow_timeout_set(Evas_Object *obj, double timeout)
659 ELM_CHECK_WIDTYPE(obj, widtype);
660 Widget_Data *wd = elm_widget_data_get(obj);
662 wd->timeout = timeout;
663 if (wd->timer) ecore_timer_del(wd->timer);
666 wd->timer = ecore_timer_add(timeout, _timer_cb, obj);
670 elm_slideshow_timeout_get(const Evas_Object *obj)
672 ELM_CHECK_WIDTYPE(obj, widtype) -1.0;
673 Widget_Data *wd = elm_widget_data_get(obj);
674 if (!wd) return -1.0;
679 elm_slideshow_loop_set(Evas_Object *obj, Eina_Bool loop)
681 ELM_CHECK_WIDTYPE(obj, widtype);
682 Widget_Data *wd = elm_widget_data_get(obj);
688 elm_slideshow_layout_get(const Evas_Object *obj)
690 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
691 Widget_Data *wd = elm_widget_data_get(obj);
692 if (!wd) return EINA_FALSE;
693 return wd->layout.current;
697 elm_slideshow_layout_set(Evas_Object *obj, const char *layout)
700 ELM_CHECK_WIDTYPE(obj, widtype);
701 Widget_Data *wd = elm_widget_data_get(obj);
704 wd->layout.current = layout;
705 snprintf(buf, sizeof(buf), "layout,%s", layout);
706 edje_object_signal_emit(wd->slideshow, buf, "slideshow");
710 elm_slideshow_loop_get(const Evas_Object *obj)
712 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
713 Widget_Data *wd = elm_widget_data_get(obj);
714 if (!wd) return EINA_FALSE;
719 elm_slideshow_clear(Evas_Object *obj)
721 Elm_Slideshow_Item *item;
722 ELM_CHECK_WIDTYPE(obj, widtype);
723 Widget_Data *wd = elm_widget_data_get(obj);
727 EINA_LIST_FREE(wd->items_built, item)
729 if (item->itc->func.del)
730 item->itc->func.del(elm_widget_item_data_get(item), VIEW(item));
733 EINA_LIST_FREE(wd->items, item)
734 elm_widget_item_free(item);
738 elm_slideshow_item_del(Elm_Object_Item *it)
740 elm_object_item_del(it);
743 EAPI const Eina_List *
744 elm_slideshow_items_get(const Evas_Object *obj)
746 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
747 Widget_Data *wd = elm_widget_data_get(obj);
748 if (!wd) return NULL;
752 EAPI Elm_Object_Item *
753 elm_slideshow_item_current_get(const Evas_Object *obj)
755 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
756 Widget_Data *wd = elm_widget_data_get(obj);
757 if (!wd) return NULL;
758 return (Elm_Object_Item *) wd->current;
762 elm_slideshow_item_object_get(const Elm_Object_Item * it)
764 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
769 elm_slideshow_item_data_get(const Elm_Object_Item * it)
771 return elm_object_item_data_get(it);
775 elm_slideshow_cache_before_get(const Evas_Object *obj)
777 ELM_CHECK_WIDTYPE(obj, widtype) -1;
778 Widget_Data *wd = elm_widget_data_get(obj);
780 return wd->count_item_pre_before;
784 elm_slideshow_cache_before_set(Evas_Object *obj, int count)
786 ELM_CHECK_WIDTYPE(obj, widtype);
787 Widget_Data *wd = elm_widget_data_get(obj);
789 if (count < 0) count = 0;
790 wd->count_item_pre_before = count;
794 elm_slideshow_cache_after_get(const Evas_Object *obj)
796 ELM_CHECK_WIDTYPE(obj, widtype) -1;
797 Widget_Data *wd = elm_widget_data_get(obj);
799 return wd->count_item_pre_after;
803 elm_slideshow_cache_after_set(Evas_Object *obj, int count)
805 ELM_CHECK_WIDTYPE(obj, widtype);
806 Widget_Data *wd = elm_widget_data_get(obj);
808 if (count < 0) count = 0;
809 wd->count_item_pre_after = count;
812 EAPI Elm_Object_Item *
813 elm_slideshow_item_nth_get(const Evas_Object *obj, unsigned int nth)
815 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
816 Widget_Data *wd = elm_widget_data_get(obj);
817 if (!wd) return NULL;
818 return eina_list_nth(wd->items, nth);
822 elm_slideshow_count_get(const Evas_Object *obj)
824 ELM_CHECK_WIDTYPE(obj, widtype) 0;
825 Widget_Data *wd = elm_widget_data_get(obj);
827 return eina_list_count(wd->items);