summaryrefslogtreecommitdiff
path: root/efl/elementary/genlist_item.pxi
blob: 34ef23d46c1ca8abe03ad1bd2b35fbb8cff49ff9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
cdef class GenlistItem(ObjectItem):

    """An item for the :py:class:`Genlist` widget."""

    cdef:
        readonly GenlistItemClass item_class
        Elm_Object_Item *parent_item
        int flags
        object comparison_func, item_data, func_data

    def __init__(self,
        GenlistItemClass item_class not None, item_data=None,
        GenlistItem parent_item=None,
        Elm_Genlist_Item_Type flags=enums.ELM_GENLIST_ITEM_NONE,
        func=None, func_data=None, *args, **kwargs):
        """Create a new GenlistItem.

        :param item_data: Data that defines the model of this row.
            This value will be given to methods of ``item_class`` such as
            :py:func:`GenlistItemClass.text_get()`.

        :param item_class: a valid instance that defines the behavior of this
            row.
        :type item_class: :py:class:`GenlistItemClass`

        :param parent_item: If this is a tree child, then the
            parent item must be given here, otherwise it may be
            None. The parent must have the flag
            ``ELM_GENLIST_ITEM_SUBITEMS`` set.
        :type parent_item: :py:class:`GenlistItem`

        :param flags: defines special behavior of this item:
        :type flags: :ref:`Elm_Genlist_Item_Type`

        :param func: if not None, this must be a callable to be
            called back when the item is selected. The function
            signature is::

                func(item, obj, item_data)

            Where ``item`` is the handle, ``obj`` is the Evas object
            that represents this item, and ``item_data`` is the
            value given as parameter to this function.

        :param func_data: This value will be passed to the callback.

        """

        self.item_class = item_class

        self.parent_item = _object_item_from_python(parent_item) if parent_item is not None else NULL

        self.flags = flags

        if func is not None:
            if not callable(func):
                raise TypeError("func is not None or callable")

        self.item_data = item_data
        self.cb_func = func
        self.func_data = func_data
        self.args = args
        self.kwargs = kwargs

    def __dealloc__(self):
        self.parent_item = NULL

    cdef int _set_obj(self, Elm_Object_Item *item) except 0:
        assert self.item == NULL, "Object must be clean"
        self.item = item
        Py_INCREF(self)
        return 1

    cdef int _unset_obj(self) except 0:
        assert self.item != NULL, "Object must wrap something"
        self.item = NULL
        Py_DECREF(self)
        return 1

    def __repr__(self):
        return ("<%s(%#x, refcount=%d, Elm_Object_Item=%#x, "
                "item_class=%s, func=%s, item_data=%r)>") % (
            type(self).__name__,
            <uintptr_t><void*>self,
            PY_REFCOUNT(self),
            <uintptr_t>self.item,
            type(self.item_class).__name__,
            self.cb_func,
            self.item_data
            )

    def append_to(self, Genlist genlist not None):
        """Append a new item (add as last row) to this genlist.

        :param genlist: The Genlist upon which this item is to be appended.
        :type genlist: :py:class:`Genlist`
        :rtype: :py:class:`GenlistItem`

        """
        cdef:
            Elm_Object_Item *item
            Evas_Smart_Cb cb = NULL

        if self.cb_func is not None:
            cb = _py_elm_genlist_item_func

        item = elm_genlist_item_append(genlist.obj,
            self.item_class.cls, <void*>self,
            self.parent_item,
            <Elm_Genlist_Item_Type>self.flags,
            cb, <void*>self)

        if item == NULL:
            raise RuntimeError("The item could not be added to the widget.")

        self._set_obj(item)
        self._set_properties_from_keyword_args(self.kwargs)
        return self

    def prepend_to(self, Genlist genlist not None):
        """Prepend a new item (add as first row) to this Genlist.

        :param genlist: The Genlist upon which this item is to be prepended.
        :type genlist: :py:class:`Genlist`
        :rtype: :py:class:`GenlistItem`

        """
        cdef:
            Elm_Object_Item *item
            Evas_Smart_Cb cb = NULL

        if self.cb_func is not None:
            cb = _py_elm_genlist_item_func

        item = elm_genlist_item_prepend(genlist.obj,
            self.item_class.cls, <void*>self,
            self.parent_item,
            <Elm_Genlist_Item_Type>self.flags,
            cb,  <void*>self)

        if item == NULL:
            raise RuntimeError("The item could not be added to the widget.")

        self._set_obj(item)
        self._set_properties_from_keyword_args(self.kwargs)
        return self

    def insert_before(self, GenlistItem before_item=None):
        """Insert a new item (row) before another item in this genlist.

        :param before_item: a reference item to use, the new item
            will be inserted before it.
        :type before_item: :py:class:`GenlistItem`
        :rtype: :py:class:`GenlistItem`

        """
        cdef:
            Elm_Object_Item *item
            Elm_Object_Item *before
            Genlist genlist = before_item.widget
            Evas_Smart_Cb cb = NULL

        if self.cb_func is not None:
            cb = _py_elm_genlist_item_func

        before = _object_item_from_python(before_item)

        item = elm_genlist_item_insert_before(genlist.obj,
            self.item_class.cls, <void*>self,
            self.parent_item, before,
            <Elm_Genlist_Item_Type>self.flags,
            cb, <void*>self)

        if item == NULL:
            raise RuntimeError("The item could not be added to the widget.")

        self._set_obj(item)
        self._set_properties_from_keyword_args(self.kwargs)
        return self

    def insert_after(self, GenlistItem after_item=None):
        """Insert a new item (row) after another item in this genlist.

        :param after_item: a reference item to use, the new item
            will be inserted after it.
        :type after_item: :py:class:`GenlistItem`
        :rtype: :py:class:`GenlistItem`

        """
        cdef:
            Elm_Object_Item *item
            Elm_Object_Item *after
            Genlist genlist = after_item.widget
            Evas_Smart_Cb cb = NULL

        if self.cb_func is not None:
            cb = _py_elm_genlist_item_func

        after = _object_item_from_python(after_item)

        item = elm_genlist_item_insert_after(genlist.obj,
            self.item_class.cls, <void*>self,
            self.parent_item, after,
            <Elm_Genlist_Item_Type>self.flags,
            cb, <void*>self)

        if item == NULL:
            raise RuntimeError("The item could not be added to the widget.")

        self._set_obj(item)
        self._set_properties_from_keyword_args(self.kwargs)
        return self

    def sorted_insert(self, Genlist genlist not None, comparison_func):
        """Insert a new item into the sorted genlist object

        :param genlist: The Genlist object
        :type genlist: :py:class:`Genlist`
        :param comparison_func: The function called for the sort.
            This must be a callable and will be called
            to insert the item in the right position. The two arguments passed
            are two :py:class:`GenlistItem` to compare. The function must return
            1 if ``item1`` comes before ``item2``, 0 if the two items
            are equal or -1 otherwise.
            Signature is::

                func(item1, item2)->int

        :rtype: :py:class:`GenlistItem`

        This inserts an item in the genlist based on user defined comparison
        function. The two arguments passed to the function are genlist items
        to compare.

        """
        cdef:
            Elm_Object_Item *item
            Evas_Smart_Cb cb = NULL

        if self.cb_func is not None:
            cb = _py_elm_genlist_item_func

        if comparison_func is not None:
            if not callable(comparison_func):
                raise TypeError("func is not None or callable")
            self.comparison_func = comparison_func

        item = elm_genlist_item_sorted_insert(genlist.obj,
            self.item_class.cls, <void*>self,
            self.parent_item,
            <Elm_Genlist_Item_Type>self.flags,
            _py_elm_genlist_compare_func,
            cb, <void*>self)

        if item == NULL:
            raise RuntimeError("The item could not be added to the widget.")

        self._set_obj(item)
        self._set_properties_from_keyword_args(self.kwargs)
        return self

    property data:
        """User data for the item."""
        def __get__(self):
            return self.item_data

    def data_get(self):
        return self.item_data

    property next:
        """This returns the item placed after the ``item``, on the container
        genlist.

        .. seealso:: :py:attr:`prev`

        :type: :py:class:`GenlistItem`

        """
        def __get__(self):
            return _object_item_to_python(elm_genlist_item_next_get(self.item))

    def next_get(self):
        return _object_item_to_python(elm_genlist_item_next_get(self.item))

    property prev:
        """This returns the item placed before the ``item``, on the container
        genlist.

        .. seealso:: :py:attr:`next`

        :type: :py:class:`GenlistItem`

        """
        def __get__(self):
            return _object_item_to_python(elm_genlist_item_prev_get(self.item))

    def prev_get(self):
        return _object_item_to_python(elm_genlist_item_prev_get(self.item))

    property selected:
        """This sets the selected state of an item. If multi selection is
        not enabled on the containing genlist and ``selected`` is ``True``,
        any other previously selected items will get unselected in favor of
        this new one.

        :type: bool

        """
        def __get__(self):
            cdef bint ret = elm_genlist_item_selected_get(self.item)
            return ret

        def __set__(self, bint selected):
            elm_genlist_item_selected_set(self.item, selected)

    def selected_set(self, bint selected):
        elm_genlist_item_selected_set(self.item, selected)
    def selected_get(self):
        cdef bint ret = elm_genlist_item_selected_get(self.item)
        return ret

    def show(self, scrollto_type = enums.ELM_GENLIST_ITEM_SCROLLTO_IN):
        """This causes genlist to jump to the item and show it (by
        jumping to that position), if it is not fully visible.

        :type: :ref:`Elm_Genlist_Item_Scrollto_Type`

        .. seealso:: :py:func:`bring_in()`

        """
        elm_genlist_item_show(self.item, scrollto_type)

    def bring_in(self, scrollto_type = enums.ELM_GENLIST_ITEM_SCROLLTO_IN):
        """This causes genlist to jump to the item and show it (by
        animatedly scrolling), if it is not fully visible.
        This may use animation and take a some time to do so.

        :type: :ref:`Elm_Genlist_Item_Scrollto_Type`

        .. seealso:: :py:func:`show()`

        """
        elm_genlist_item_bring_in(self.item, scrollto_type)

    def update(self):
        """This updates an item by calling all the item class functions again
        to get the contents, texts and states. Use this when the original
        item data has changed and the changes are desired to be reflected.

        Use elm_genlist_realized_items_update() to update all already realized
        items.

        .. seealso:: :py:func:`Genlist.realized_items_update()`

        """
        elm_genlist_item_update(self.item)

    def item_class_update(self, GenlistItemClass itc not None):
        """This sets another class of the item, changing the way that it is
        displayed. After changing the item class, elm_genlist_item_update() is
        called on the item.

        :type itc: :py:class:`GenlistItemClass`

        """
        elm_genlist_item_item_class_update(self.item, itc.cls)

    # TODO: def item_class_get(self):
    #     """This returns the Genlist_Item_Class for the given item. It can be
    #     used to examine the function pointers and item_style.
    #
    #     """
    #     return elm_genlist_item_item_class_get(self.item)

    property index:
        """Get the index of the item. It is only valid once displayed.

        :type: int

        """
        def __get__(self):
            return elm_genlist_item_index_get(self.item)

    def index_get(self):
        return elm_genlist_item_index_get(self.item)

    def tooltip_text_set(self, text):
        """Set the text to be shown in the tooltip object

        Setup the text as tooltip object. The object can have only one
        tooltip, so any previous tooltip data is removed.
        Internally, this method calls :py:func:`tooltip_content_cb_set`

        """
        if isinstance(text, unicode): text = PyUnicode_AsUTF8String(text)
        elm_genlist_item_tooltip_text_set(self.item,
            <const char *>text if text is not None else NULL)

    def tooltip_content_cb_set(self, func, *args, **kargs):
        """Set the content to be shown in the tooltip object

        Setup the tooltip to object. The object can have only one tooltip,
        so any previews tooltip data is removed. ``func(args,kargs)`` will
        be called every time that need show the tooltip and it should return
        a valid Evas_Object. This object is then managed fully by tooltip
        system and is deleted when the tooltip is gone.

        :param func: Function to be create tooltip content, called when
            need show tooltip.

        """
        if not callable(func):
            raise TypeError("func must be callable")

        cdef void *cbdata

        data = (func, self, args, kargs)
        Py_INCREF(data)
        cbdata = <void *>data
        elm_genlist_item_tooltip_content_cb_set(self.item,
                                                _tooltip_item_content_create,
                                                cbdata,
                                                _tooltip_item_data_del_cb)

    def tooltip_unset(self):
        """Unset tooltip from object

        Remove tooltip from object. If used the :py:func:`tooltip_text_set`
        the internal copy of label will be removed correctly. If used
        :py:func:`tooltip_content_cb_set`, the data will be unreferred but
        no freed.

        """
        elm_genlist_item_tooltip_unset(self.item)

    property tooltip_style:
        """Tooltips can have **alternate styles** to be displayed on,
        which are defined by the theme set on Elementary. This function
        works analogously as elm_object_tooltip_style_set(), but here
        applied only to genlist item objects. The default style for
        tooltips is ``"default"``.

        .. note:: before you set a style you should define a tooltip with
            elm_genlist_item_tooltip_content_cb_set() or
            elm_genlist_item_tooltip_text_set()

        :type: string

        """
        def __set__(self, style):
            if isinstance(style, unicode): style = PyUnicode_AsUTF8String(style)
            elm_genlist_item_tooltip_style_set(self.item,
                <const char *>style if style is not None else NULL)

        def __get__(self):
            return _ctouni(elm_genlist_item_tooltip_style_get(self.item))

    def tooltip_style_set(self, style=None):
        if isinstance(style, unicode): style = PyUnicode_AsUTF8String(style)
        elm_genlist_item_tooltip_style_set(self.item,
            <const char *>style if style is not None else NULL)
    def tooltip_style_get(self):
        return _ctouni(elm_genlist_item_tooltip_style_get(self.item))

    property tooltip_window_mode:
        """This property allows a tooltip to expand beyond its parent window's canvas.
        It will instead be limited only by the size of the display.

        :type: bool
        :raise RuntimeWarning: when setting the mode fails

        """
        def __set__(self, disable):
            if not elm_genlist_item_tooltip_window_mode_set(self.item, disable):
                raise RuntimeWarning("Setting tooltip_window_mode failed")

        def __get__(self):
            return bool(elm_genlist_item_tooltip_window_mode_get(self.item))

    def tooltip_window_mode_set(self, disable):
        if not elm_genlist_item_tooltip_window_mode_set(self.item, disable):
            raise RuntimeWarning("Setting tooltip_window_mode failed")
    def tooltip_window_mode_get(self):
        return bool(elm_genlist_item_tooltip_window_mode_get(self.item))

    property cursor:
        """Set the cursor that will be displayed when mouse is over the
        item. The item can have only one cursor set to it, so if
        this function is called twice for an item, the previous set
        will be unset.

        :type: unicode

        """
        def __set__(self, cursor):
            if isinstance(cursor, unicode): cursor = PyUnicode_AsUTF8String(cursor)
            elm_genlist_item_cursor_set(self.item,
                <const char *>cursor if cursor is not None else NULL)

        def __get__(self):
            return _ctouni(elm_genlist_item_cursor_get(self.item))

        def __del__(self):
            elm_genlist_item_cursor_unset(self.item)

    def cursor_set(self, cursor):
        if isinstance(cursor, unicode): cursor = PyUnicode_AsUTF8String(cursor)
        elm_genlist_item_cursor_set(self.item,
            <const char *>cursor if cursor is not None else NULL)
    def cursor_get(self):
        return _ctouni(elm_genlist_item_cursor_get(self.item))
    def cursor_unset(self):
        elm_genlist_item_cursor_unset(self.item)

    property cursor_style:
        """Sets a different style for this object cursor.

        .. note:: before you set a style you should define a cursor with
            elm_genlist_item_cursor_set()

        :type: unicode

        """
        def __set__(self, style):
            if isinstance(style, unicode): style = PyUnicode_AsUTF8String(style)
            elm_genlist_item_cursor_style_set(self.item,
                <const char *>style if style is not None else NULL)

        def __get__(self):
            return _ctouni(elm_genlist_item_cursor_style_get(self.item))

    def cursor_style_set(self, style=None):
        if isinstance(style, unicode): style = PyUnicode_AsUTF8String(style)
        elm_genlist_item_cursor_style_set(self.item,
            <const char *>style if style is not None else NULL)
    def cursor_style_get(self):
        return _ctouni(elm_genlist_item_cursor_style_get(self.item))

    property cursor_engine_only:
        """ Sets cursor engine only usage for this object.

        .. note:: before you set engine only usage you should define a
            cursor with elm_genlist_item_cursor_set()

        :type: bool

        """
        def __set__(self, bint engine_only):
            elm_genlist_item_cursor_engine_only_set(self.item, engine_only)

        def __get__(self):
            cdef bint ret = elm_genlist_item_cursor_engine_only_get(self.item)
            return ret

    def cursor_engine_only_set(self, bint engine_only):
        elm_genlist_item_cursor_engine_only_set(self.item, engine_only)
    def cursor_engine_only_get(self):
        cdef bint ret = elm_genlist_item_cursor_engine_only_get(self.item)
        return ret

    property parent:
        """This returns the item that was specified as parent of the item
        on elm_genlist_item_append() and insertion related functions.

        :type: :py:class:`GenlistItem`

        """
        def __get__(self):
            return _object_item_to_python(elm_genlist_item_parent_get(self.item))

    def parent_get(self):
        return _object_item_to_python(elm_genlist_item_parent_get(self.item))

    def subitems_clear(self):
        """This removes all items that are children (and their descendants)
        of the item.

        """
        elm_genlist_item_subitems_clear(self.item)

    def subitems_count(self):
        """Get the number of subitems.

        :return: The number of subitems, 0 on error.
        :rtype: int

        .. versionadded:: 1.9

        """
        elm_genlist_item_subitems_count(self.item)

    def subitems_get(self):
        """Get the list of subitems.

        :return: The list of subitems.
        :rype: list of :py:class:`GenlistItem`

        .. versionadded:: 1.9

        """
        cdef:
            Eina_List *l = elm_genlist_item_subitems_get(self.item)
            list ret = list()

        while l:
            ret.append(object_from_instance(<Evas_Object*>l.data))
            l = l.next

        return ret

    property expanded:
        """This function flags the item of type #ELM_GENLIST_ITEM_TREE as
        expanded or not.

        The theme will respond to this change visually, and a signal
        "expanded" or "contracted" will be sent from the genlist with a
        the item that has been expanded/contracted.

        Calling this function won't show or hide any child of this item (if
        it is a parent). You must manually delete and create them on the
        callbacks of the "expanded" or "contracted" signals.

        :type: bool

        """
        def __get__(self):
            cdef bint ret = elm_genlist_item_expanded_get(self.item)
            return ret

        def __set__(self, bint expanded):
            elm_genlist_item_expanded_set(self.item, expanded)

    def expanded_set(self, bint expanded):
        elm_genlist_item_expanded_set(self.item, expanded)
    def expanded_get(self):
        cdef bint ret = elm_genlist_item_expanded_get(self.item)
        return ret

    property expanded_depth:
        """Get the depth of expanded item.

        :type: int

        """
        def __get__(self):
            return elm_genlist_item_expanded_depth_get(self.item)

    def expanded_depth_get(self):
        return elm_genlist_item_expanded_depth_get(self.item)

    def all_contents_unset(self):
        """This instructs genlist to release references to contents in the
        item, meaning that they will no longer be managed by genlist and are
        floating "orphans" that can be re-used elsewhere if the user wants to.

        """
        cdef Eina_List *lst
        elm_genlist_item_all_contents_unset(self.item, &lst)
        return _object_item_list_to_python(lst)

    def promote(self):
        """Promote an item to the top of the list"""
        elm_genlist_item_promote(self.item)

    def demote(self):
        """Demote an item to the end of the list"""
        elm_genlist_item_demote(self.item)

    def fields_update(self, parts, Elm_Genlist_Item_Field_Type itf):
        """This updates an item's part by calling item's fetching functions again
        to get the contents, texts and states. Use this when the original
        item data has changed and the changes are desired to be reflected.
        Parts argument is used for globbing to match '*', '?', and '.'
        It can be used at updating multi fields.

        Use elm_genlist_realized_items_update() to update an item's all
        property.

        :param parts: The name of item's part
        :type parts: unicode
        :param itf: The type of item's part type
        :type itf: :ref:`Elm_Genlist_Item_Field_Type`

        .. seealso:: :py:func:`update()`

        """
        if isinstance(parts, unicode): parts = PyUnicode_AsUTF8String(parts)
        elm_genlist_item_fields_update(self.item,
            <const char *>parts if parts is not None else NULL,
            itf)

    property decorate_mode:
        """A genlist mode is a different way of selecting an item. Once a
        mode is activated on an item, any other selected item is immediately
        unselected. This feature provides an easy way of implementing a new
        kind of animation for selecting an item, without having to entirely
        rewrite the item style theme. However, the Genlist.selected_*
        API can't be used to get what item is activate for a mode.

        The current item style will still be used, but applying a genlist
        mode to an item will select it using a different kind of animation.

        The current active item for a mode can be found at
        :py:attr:`Genlist.decorated_item`.

        The characteristics of genlist mode are:

        - Only one mode can be active at any time, and for only one item.
        - Genlist handles deactivating other items when one item is activated.
        - A mode is defined in the genlist theme (edc), and more modes can
          easily be added.
        - A mode style and the genlist item style are different things. They
          can be combined to provide a default style to the item, with some
          kind of animation for that item when the mode is activated.

        When a mode is activated on an item, a new view for that item is
        created. The theme of this mode defines the animation that will be
        used to transit the item from the old view to the new view. This
        second (new) view will be active for that item while the mode is
        active on the item, and will be destroyed after the mode is totally
        deactivated from that item.

        :type: (unicode **decorate_it_type**, bool **decorate_it_set**)

        .. seealso:: :py:attr:`Genlist.mode`

        """
        def __set__(self, value):
            decorate_it_type, decorate_it_set = value
            self.decorate_mode_set(decorate_it_type, decorate_it_set)

        def __get__(self):
            return self.decorate_mode_get()

    def decorate_mode_set(self, decorate_it_type, decorate_it_set):
        a1 = decorate_it_type
        if isinstance(a1, unicode): a1 = PyUnicode_AsUTF8String(a1)
        elm_genlist_item_decorate_mode_set(self.item,
            <const char *>a1 if a1 is not None else NULL,
            decorate_it_set)
    def decorate_mode_get(self):
        return _ctouni(elm_genlist_item_decorate_mode_get(self.item))

    property type:
        """This function returns the item's type. Normally the item's type.
        If it failed, return value is ELM_GENLIST_ITEM_MAX

        :type: :ref:`Elm_Genlist_Item_Type`

        """
        def __get__(self):
            cdef Elm_Genlist_Item_Type ittype = elm_genlist_item_type_get(self.item)
            return <Elm_Genlist_Item_Type>ittype

    def type_get(self):
        cdef Elm_Genlist_Item_Type ittype = elm_genlist_item_type_get(self.item)
        return <Elm_Genlist_Item_Type>ittype

    property flip:
        """The flip state of a given genlist item. Flip mode overrides
        current item object. It can be used for on-the-fly item replace.
        Flip mode can be used with/without decorate mode.

        :type: bool

        """
        def __set__(self, flip):
            elm_genlist_item_flip_set(self.item, flip)

        def __get__(self):
            cdef bint ret = elm_genlist_item_flip_get(self.item)
            return ret

    def flip_set(self, flip):
        elm_genlist_item_flip_set(self.item, flip)
    def flip_get(self):
        cdef bint ret = elm_genlist_item_flip_get(self.item)
        return ret

    property select_mode:
        """Item's select mode. Possible values are:

        :type: :ref:`Elm_Genlist_Object_Select_Mode`

        """
        def __set__(self, mode):
            elm_genlist_item_select_mode_set(self.item, mode)

        def __get__(self):
            return elm_genlist_item_select_mode_get(self.item)

    def select_mode_set(self, mode):
        elm_genlist_item_select_mode_set(self.item, mode)
    def select_mode_get(self):
        return elm_genlist_item_select_mode_get(self.item)