summaryrefslogtreecommitdiff
path: root/efl/elementary/gengrid_widget.pxi
blob: c93a50e79ff258c57ebdacd0220f4dd8d0f533c7 (plain) (blame)
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
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
#include "cnp_callbacks.pxi"

cdef class Gengrid(Object):

    """This is the class that actually implements the widget."""

    def __init__(self, evasObject parent, *args, **kwargs):
        self._set_obj(elm_gengrid_add(parent.obj))
        self._set_properties_from_keyword_args(kwargs)

    def clear(self):
        """Remove all items from a given gengrid widget."""
        elm_gengrid_clear(self.obj)

    property multi_select:
        """Multi-selection is the ability to have **more** than one
        item selected, on a given gengrid, simultaneously. When it is
        enabled, a sequence of clicks on different items will make them
        all selected, progressively. A click on an already selected item
        will unselect it. If interacting via the keyboard,
        multi-selection is enabled while holding the "Shift" key.

        .. note:: By default, multi-selection is **disabled** on gengrids.

        :type: bool

        """
        def __get__(self):
            return bool(elm_gengrid_multi_select_get(self.obj))

        def __set__(self, multi):
            elm_gengrid_multi_select_set(self.obj, bool(multi))

    def multi_select_set(self, multi):
        elm_gengrid_multi_select_set(self.obj, bool(multi))
    def multi_select_get(self):
        return bool(elm_gengrid_multi_select_get(self.obj))

    property horizontal:
        """When in "horizontal mode" (``True),`` items will be placed
        in **columns**, from top to bottom and, when the space for a
        column is filled, another one is started on the right, thus
        expanding the grid horizontally. When in "vertical mode"
        (``False),`` though, items will be placed in **rows**, from left
        to right and, when the space for a row is filled, another one is
        started below, thus expanding the grid vertically.

        :type: bool

        """
        def __get__(self):
            return bool(elm_gengrid_horizontal_get(self.obj))

        def __set__(self, setting):
            elm_gengrid_horizontal_set(self.obj, bool(setting))

    def horizontal_set(self, setting):
        elm_gengrid_horizontal_set(self.obj, bool(setting))
    def horizontal_get(self):
        return bool(elm_gengrid_horizontal_get(self.obj))

    def item_append(self, GengridItemClass item_class not None,
                    item_data, func=None):
        """Append a new item (add as last item) to this gengrid.

        :param item_class: a valid instance that defines the
            behavior of this item. See :py:class:`GengridItemClass`.
        :param item_data: some data that defines the model of this
            item. This value will be given to methods of
            ``item_class`` such as
            :py:func:`GengridItemClass.text_get()`. It will also be
            provided to ``func`` as its last parameter.
        :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.
        """
        return GengridItem(item_class, item_data, func, item_data)\
                          .append_to(self)

    def item_prepend(self, GengridItemClass item_class not None,
                     item_data, func=None):
        """Prepend a new item (add as first item) to this gengrid.

        :param item_class: a valid instance that defines the
            behavior of this item. See :py:class:`GengridItemClass`.
        :param item_data: some data that defines the model of this
            item. This value will be given to methods of
            ``item_class`` such as
            :py:func:`GengridItemClass.text_get()`. It will also be
            provided to ``func`` as its last parameter.
        :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.
        """
        return GengridItem(item_class, item_data, func, item_data)\
                          .prepend_to(self)

    def item_insert_before(self, GengridItemClass item_class not None,
                           item_data, GengridItem before_item=None,
                           func=None):
        """Insert a new item before another item in this gengrid.

        :param item_class: a valid instance that defines the
            behavior of this item. See :py:class:`GengridItemClass`.
        :param item_data: some data that defines the model of this
            item. This value will be given to methods of
            ``item_class`` such as
            :py:func:`GengridItemClass.text_get()`. It will also be
            provided to ``func`` as its last parameter.
        :param before_item: a reference item to use, the new item
            will be inserted before it.
        :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.
        """
        return GengridItem(item_class, item_data, func, item_data)\
                          .insert_before(before_item)

    def item_insert_after(self, GengridItemClass item_class not None,
                          item_data, GengridItem after_item=None,
                          func=None):
        """Insert a new item after another item in this gengrid.

        :param item_class: a valid instance that defines the
            behavior of this item. See :py:class:`GengridItemClass`.
        :param item_data: some data that defines the model of this
            item. This value will be given to methods of
            ``item_class`` such as
            :py:func:`GengridItemClass.text_get()`. It will also be
            provided to ``func`` as its last parameter.
        :param after_item: a reference item to use, the new item
            will be inserted after it.
        :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.
        """
        return GengridItem(item_class, item_data, func, item_data)\
                          .insert_before(after_item)

    # XXX TODO elm_gengrid_item_sorted_insert()

    property selected_item:
        """This returns the selected item. If multi selection is enabled
        (:py:attr:`multi_select`), only the first item in the list is selected,
        which might not be very useful. For that case, see
        :py:attr:`selected_items`.

        :type: :py:class:`GengridItem`

        """
        def __get__(self):
            return _object_item_to_python(elm_gengrid_selected_item_get(self.obj))

    def selected_item_get(self):
        return _object_item_to_python(elm_gengrid_selected_item_get(self.obj))

    property selected_items:
        """This returns a tuple of the selected items, in the order that they
        appear in the grid.

        .. seealso:: :py:attr:`selected_item`

        :type: tuple of :py:class:`GengridItem`

        """
        def __get__(self):
            return _object_item_list_to_python(elm_gengrid_selected_items_get(self.obj))

    def selected_items_get(self):
        return _object_item_list_to_python(elm_gengrid_selected_items_get(self.obj))

    property realized_items:
        """This returns a tuple of the realized items in the gengrid.

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

        :type: tuple of :py:class:`GengridItem`

        """
        def __get__(self):
            return _object_item_list_to_python(elm_gengrid_realized_items_get(self.obj))

    def realized_items_get(self):
        return _object_item_list_to_python(elm_gengrid_realized_items_get(self.obj))

    def realized_items_update(self):
        """This updates all realized items 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.

        To update just one item, use elm_gengrid_item_update().

        .. seealso:: :py:attr:`realized_items` :py:func:`GengridItem.update()`

        """
        elm_gengrid_realized_items_update(self.obj)

    property first_item:
        """Get the first item in the gengrid widget.

        :type: :py:class:`GengridItem`

        """
        def __get__(self):
            return _object_item_to_python(elm_gengrid_first_item_get(self.obj))

    def first_item_get(self):
        return _object_item_to_python(elm_gengrid_first_item_get(self.obj))

    property last_item:
        """Get the last item in the gengrid widget.

        :type: :py:class:`GengridItem`

        """
        def __get__(self):
            return _object_item_to_python(elm_gengrid_last_item_get(self.obj))

    def last_item_get(self):
        return _object_item_to_python(elm_gengrid_last_item_get(self.obj))

    property items_count:
        """Return how many items are currently in a list.

        :type: int

        """
        def __get__(self):
            return elm_gengrid_items_count(self.obj)

    property item_size:
        """A gengrid, after creation, has still no information on the size
        to give to each of its cells. So, you most probably will end up
        with squares one :ref:`finger <Fingers>` wide, the default
        size. Use this property to force a custom size for you items,
        making them as big as you wish.

        """
        def __get__(self):
            cdef Evas_Coord x, y
            elm_gengrid_item_size_get(self.obj, &x, &y)
            return (x, y)

        def __set__(self, value):
            w, h = value
            elm_gengrid_item_size_set(self.obj, w, h)

    def item_size_set(self, w, h):
        elm_gengrid_item_size_set(self.obj, w, h)
    def item_size_get(self):
        cdef Evas_Coord x, y
        elm_gengrid_item_size_get(self.obj, &x, &y)
        return (x, y)

    property group_item_size:
        """A gengrid, after creation, has still no information on the size
        to give to each of its cells. So, you most probably will end up
        with squares one "finger" wide, the default
        size. Use this function to force a custom size for you group items,
        making them as big as you wish.

        """
        def __get__(self):
            cdef Evas_Coord w, h
            elm_gengrid_group_item_size_get(self.obj, &w, &h)
            return (w, h)

        def __set__(self, value):
            w, h = value
            elm_gengrid_group_item_size_set(self.obj, w, h)

    def group_item_size_set(self, w, h):
        elm_gengrid_group_item_size_set(self.obj, w, h)
    def group_item_size_get(self):
        cdef Evas_Coord w, h
        elm_gengrid_group_item_size_get(self.obj, &w, &h)
        return (w, h)

    property align:
        """This sets the alignment of the whole grid of items of a gengrid
        within its given viewport. By default, those values are both
        0.5, meaning that the gengrid will have its items grid placed
        exactly in the middle of its viewport.

        .. note:: If given alignment values are out of the cited ranges,
            they'll be changed to the nearest boundary values on the valid
            ranges.

        :type: tuple of floats

        """
        def __get__(self):
            cdef double align_x, align_y
            elm_gengrid_align_get(self.obj, &align_x, &align_y)
            return (align_x, align_y)

        def __set__(self, value):
            align_x, align_y = value
            elm_gengrid_align_set(self.obj, align_x, align_y)

    def align_set(self, align_x, align_y):
        elm_gengrid_align_set(self.obj, align_x, align_y)
    def align_get(self):
        cdef double align_x, align_y
        elm_gengrid_align_get(self.obj, &align_x, &align_y)
        return (align_x, align_y)

    property reorder_mode:
        """If a gengrid is set to allow reordering, a click held for more
        than 0.5 over a given item will highlight it specially,
        signaling the gengrid has entered the reordering state. From
        that time on, the user will be able to, while still holding the
        mouse button down, move the item freely in the gengrid's
        viewport, replacing to said item to the locations it goes to.
        The replacements will be animated and, whenever the user
        releases the mouse button, the item being replaced gets a new
        definitive place in the grid.

        :type: bool

        """
        def __get__(self):
            return bool(elm_gengrid_reorder_mode_get(self.obj))

        def __set__(self, mode):
            elm_gengrid_reorder_mode_set(self.obj, bool(mode))

    def reorder_mode_set(self, mode):
        elm_gengrid_reorder_mode_set(self.obj, bool(mode))
    def reorder_mode_get(self, mode):
        return bool(elm_gengrid_reorder_mode_get(self.obj))

    def reorder_mode_start(self, tween_mode):
        """Enable the gengrid widget mode reordered with keys.

        :param tween_mode: Position mappings for animation
        :type tween_mode: `efl.ecore.Ecore_Pos_Map`

        .. versionadded:: 1.10

        """
        elm_gengrid_reorder_mode_start(self.obj, tween_mode)

    def reorder_mode_stop(self):
        """Stop the gengrid widget mode reorder.

        .. versionadded:: 1.10

        """
        elm_gengrid_reorder_mode_stop(self.obj)


    property filled:
        """The fill state of the whole grid of items of a gengrid
        within its given viewport. By default, this value is False, meaning
        that if the first line of items grid's isn't filled, the items are
        centered with the alignment.

        :type: bool

        """
        def __get__(self):
            return bool(elm_gengrid_filled_get(self.obj))

        def __set__(self, fill):
            elm_gengrid_filled_set(self.obj, bool(fill))

    def filled_set(self, fill):
        elm_gengrid_filled_set(self.obj, bool(fill))
    def filled_get(self, fill):
        return bool(elm_gengrid_filled_get(self.obj))

    property select_mode:
        """Item select mode in the gengrid widget. Possible values are:

        - ELM_OBJECT_SELECT_MODE_DEFAULT : Items will only call their
            selection func and callback when first becoming selected. Any
            further clicks will do nothing, unless you set always select mode.
        - ELM_OBJECT_SELECT_MODE_ALWAYS :  This means that, even if selected,
            every click will make the selected callbacks be called.
        - ELM_OBJECT_SELECT_MODE_NONE : This will turn off the ability to
            select items entirely and they will neither appear selected nor
            call selected callback functions.

        """
        def __get__(self):
            return elm_gengrid_select_mode_get(self.obj)

        def __set__(self, mode):
            elm_gengrid_select_mode_set(self.obj, mode)

    def select_mode_set(self, mode):
        elm_gengrid_select_mode_set(self.obj, mode)
    def select_mode_get(self):
        return elm_gengrid_select_mode_get(self.obj)

    property highlight_mode:
        """This will turn on/off the highlight effect when items are
        selected and they will or will not be highlighted. The selected and
        clicked callback functions will still be called.

        Highlight is enabled by default.

        """
        def __get__(self):
            return bool(elm_gengrid_highlight_mode_get(self.obj))

        def __set__(self, highlight):
            elm_gengrid_highlight_mode_set(self.obj, bool(highlight))

    def highlight_mode_set(self, highlight):
        elm_gengrid_highlight_mode_set(self.obj, bool(highlight))
    def highlight_mode_get(self, fill):
        return bool(elm_gengrid_highlight_mode_get(self.obj))

    def nth_item_get(self, unsigned int nth):
        """Get the nth item, in a given gengrid widget, placed at position
        ``nth``, in its internal items list

        :param nth: The number of the item to grab (0 being the first)

        :return: The item stored in the object at position ``nth`` or
            ``None``, if there's no item with that index (and on errors)

        .. versionadded:: 1.8

        """
        return _object_item_to_python(elm_gengrid_nth_item_get(self.obj, nth))

    def at_xy_item_get(self, int x, int y):
        """Get the item that is at the x, y canvas coords.

        :param x: The input x coordinate
        :param y: The input y coordinate
        :return: (:py:class:`GengridItem`, **int** xposret, **int** yposret)

        This returns the item at the given coordinates (which are canvas
        relative, not object-relative). If an item is at that coordinate,
        that item handle is returned, and if @p xposret is not NULL, the
        integer pointed to is set to a value of -1, 0 or 1, depending if
        the coordinate is on the left portion of that item (-1), on the
        middle section (0) or on the right part (1).
        if @p yposret is not NULL, the
        integer pointed to is set to a value of -1, 0 or 1, depending if
        the coordinate is on the upper portion of that item (-1), on the
        middle section (0) or on the lower part (1). If NULL is returned as
        an item (no item found there), then posret may indicate -1 or 1
        based if the coordinate is above or below all items respectively in
        the gengrid.

        .. versionadded:: 1.8

        """
        cdef:
            int xposret, yposret
            Elm_Object_Item *ret

        ret = elm_gengrid_at_xy_item_get(self.obj, x, y, &xposret, &yposret)
        return _object_item_to_python(ret), xposret, yposret

    property focus_direction_allow:
        """Set if gengrid should manage focus direction.

        :type: bool

        .. versionadded:: 1.10

        """
        def __set__(self, bint allow):
            elm_gengrid_focus_direction_allow_set(self.obj, allow)
    def focus_direction_allow_set(self, bint allow):
        elm_gengrid_focus_direction_allow_set(self.obj, allow)

    #
    # TODO: Drag and Drop
    # =============

    # def drag_item_container_add(self,
    #     double tm_to_anim, double tm_to_drag,
    #     itemgetcb = None,
    #     data_get = None):
    #     """

    #     Set a item container (list, genlist, grid) as source of drag

    #     :param tm_to_anim: Time period to wait before start animation.
    #     :param tm_to_drag: Time period to wait before start dragging.
    #     :param itemgetcb: Callback to get Evas object for item at (x,y)
    #     :param data_get:  Callback to get drag info

    #     :raise RuntimeError: if setting drag source failed.

    #     :since: 1.8

    #     """
    #     if itemgetcb is not None:
    #         if not callable(itemgetcb):
    #             raise TypeError("itemgetcb must be callable.")
    #         self.data["xy_item_get_cb"] = itemgetcb

    #     self.data["item_container_data_get_cb"] = data_get

    #     if not elm_drag_item_container_add(self.obj,
    #         tm_to_anim,
    #         tm_to_drag,
    #         <Elm_Xy_Item_Get_Cb>py_elm_xy_item_get_cb if itemgetcb is not None else NULL,
    #         <Elm_Item_Container_Data_Get_Cb>py_elm_item_container_data_get_cb if data_get is not None else NULL):
    #         raise RuntimeError

    # def drag_item_container_del(self):
    #     """

    #     Deletes a item container from drag-source list

    #     :raise RuntimeError: if deleting drag source failed.

    #     :since: 1.8

    #     """
    #     if not elm_drag_item_container_del(self.obj):
    #         raise RuntimeError

    # def drop_item_container_add(self, Elm_Sel_Format format,
    #     itemgetcb = None, entercb = None, enterdata = None,
    #     leavecb = None, leavedata = None,
    #     poscb = None, posdata = None, dropcb = None, cbdata = None):
    #     """

    #     Set a item container (list, genlist, grid) as target for drop.

    #     :param format: The formats supported for dropping
    #     :param itemgetcb: Callback to get Evas object for item at (x,y)
    #     :param entercb: The function to call when the object is entered with a drag
    #     :param enterdata: The application data to pass to enterdata
    #     :param leavecb: The function to call when the object is left with a drag
    #     :param leavedata: The application data to pass to leavedata
    #     :param poscb: The function to call when the object has a drag over it
    #     :param posdata: The application data to pass to posdata
    #     :param dropcb: The function to call when a drop has occurred
    #     :param cbdata: The application data to pass to dropcb

    #     :raise RuntimeError: if setting drop target failed.

    #     :since: 1.8

    #     """
    #     if itemgetcb is not None:
    #         if not callable(itemgetcb):
    #             raise TypeError("itemgetcb must be callable.")
    #         self.data["xy_item_get_cb"] = itemgetcb

    #     self.data["drag_item_container_pos"] = poscb
    #     self.data["drop_item_container_cb"] = dropcb

    #     if not elm_drop_item_container_add(self.obj,
    #         format,
    #         <Elm_Xy_Item_Get_Cb>py_elm_xy_item_get_cb if itemgetcb is not None else NULL,
    #         <Elm_Drag_State>py_elm_drag_state_cb if entercb is not None else NULL,
    #         <void *>enterdata if enterdata is not None else NULL,
    #         <Elm_Drag_State>py_elm_drag_state_cb if leavecb is not None else NULL,
    #         <void *>leavedata if leavedata is not None else NULL,
    #         <Elm_Drag_Item_Container_Pos>py_elm_drag_item_container_pos if poscb is not None else NULL,
    #         <void *>posdata if posdata is not None else NULL,
    #         <Elm_Drop_Item_Container_Cb>py_elm_drop_item_container_cb if dropcb is not None else NULL,
    #         <void *>cbdata if cbdata is not None else NULL):
    #         raise RuntimeError

    # def drop_item_container_del(self):
    #     """

    #     Removes a container from list of drop targets.

    #     :raise RuntimeError: if deleting drop target failed.

    #     :since: 1.8

    #     """
    #     if not elm_drop_item_container_del(self.obj):
    #         raise RuntimeError



    def callback_activated_add(self, func, *args, **kwargs):
        self._callback_add_full("activated", _cb_object_item_conv,
                                func, *args, **kwargs)

    def callback_activated_del(self, func):
        self._callback_del_full("activated", _cb_object_item_conv, func)

    def callback_clicked_double_add(self, func, *args, **kwargs):
        self._callback_add_full("clicked,double", _cb_object_item_conv,
                                func, *args, **kwargs)

    def callback_clicked_double_del(self, func):
        self._callback_del_full("clicked,double", _cb_object_item_conv, func)

    def callback_clicked_add(self, func, *args, **kwargs):
        self._callback_add_full("clicked", _cb_object_item_conv,
                                func, *args, **kwargs)

    def callback_clicked_del(self, func):
        self._callback_del_full("clicked", _cb_object_item_conv, func)

    def callback_selected_add(self, func, *args, **kwargs):
        self._callback_add_full("selected", _cb_object_item_conv,
                                func, *args, **kwargs)

    def callback_selected_del(self, func):
        self._callback_del_full("selected",  _cb_object_item_conv, func)

    def callback_unselected_add(self, func, *args, **kwargs):
        self._callback_add_full("unselected", _cb_object_item_conv,
                                func, *args, **kwargs)

    def callback_unselected_del(self, func):
        self._callback_del_full("unselected", _cb_object_item_conv, func)

    def callback_realized_add(self, func, *args, **kwargs):
        """This is called when the item in the gengrid
        has its implementing Evas object instantiated, de facto.
        ``event_info`` is the gengrid item that was created. The object
        may be deleted at any time, so it is highly advised to the
        caller **not** to use the object returned from
        :py:attr:`GengridItem.object`, because it may point to freed
        objects."""
        self._callback_add_full("realized", _cb_object_item_conv,
                                func, *args, **kwargs)

    def callback_realized_del(self, func):
        self._callback_del_full("realized", _cb_object_item_conv, func)

    def callback_unrealized_add(self, func, *args, **kwargs):
        """This is called when the implementing Evas
        object for this item is deleted. ``event_info`` is the gengrid
        item that was deleted."""
        self._callback_add_full("unrealized", _cb_object_item_conv,
                                func, *args, **kwargs)

    def callback_unrealized_del(self, func):
        self._callback_del_full("unrealized", _cb_object_item_conv, func)

    def callback_changed_add(self, func, *args, **kwargs):
        """Called when an item is added, removed, resized
        or moved and when the gengrid is resized or gets "horizontal"
        property changes."""
        self._callback_add("changed", func, *args, **kwargs)

    def callback_changed_del(self, func):
        self._callback_del("changed", func)

    def callback_scroll_anim_start_add(self, func, *args, **kwargs):
        """This is called when scrolling animation has
        started."""
        self._callback_add("scroll,anim,start", func, *args, **kwargs)

    def callback_scroll_anim_start_del(self, func):
        self._callback_del("scroll,anim,start", func)

    def callback_scroll_anim_stop_add(self, func, *args, **kwargs):
        """This is called when scrolling animation has
        stopped."""
        self._callback_add("scroll,anim,stop", func, *args, **kwargs)

    def callback_scroll_anim_stop_del(self, func):
        self._callback_del("scroll,anim,stop", func)

    def callback_drag_start_up_add(self, func, *args, **kwargs):
        """Called when the item in the gengrid has
        been dragged (not scrolled) up."""
        self._callback_add("drag,start,up", func, *args, **kwargs)

    def callback_drag_start_up_del(self, func):
        self._callback_del("drag,start,up", func)

    def callback_drag_start_down_add(self, func, *args, **kwargs):
        """Called when the item in the gengrid has
        been dragged (not scrolled) down."""
        self._callback_add("drag,start,down", func, *args, **kwargs)

    def callback_drag_start_down_del(self, func):
        self._callback_del("drag,start,down", func)

    def callback_drag_start_left_add(self, func, *args, **kwargs):
        """Called when the item in the gengrid has
        been dragged (not scrolled) left."""
        self._callback_add("drag,start,left", func, *args, **kwargs)

    def callback_drag_start_left_del(self, func):
        self._callback_del("drag,start,left", func)

    def callback_drag_start_right_add(self, func, *args, **kwargs):
        """Called when the item in the gengrid has
        been dragged (not scrolled) right."""
        self._callback_add("drag,start,right", func, *args, **kwargs)

    def callback_drag_start_right_del(self, func):
        self._callback_del("drag,start,right", func)

    def callback_drag_stop_add(self, func, *args, **kwargs):
        """Called when the item in the gengrid has
        stopped being dragged."""
        self._callback_add("drag,stop", func, *args, **kwargs)

    def callback_drag_stop_del(self, func):
        self._callback_del("drag,stop", func)

    def callback_drag_add(self, func, *args, **kwargs):
        """Called when the item in the gengrid is being
        dragged."""
        self._callback_add("drag", func, *args, **kwargs)

    def callback_drag_del(self, func):
        self._callback_del("drag", func)

    def callback_scroll_add(self, func, *args, **kwargs):
        """called when the content has been scrolled
        (moved)."""
        self._callback_add("scroll", func, *args, **kwargs)

    def callback_scroll_del(self, func):
        self._callback_del("scroll", func)

    def callback_scroll_drag_start_add(self, func, *args, **kwargs):
        """called when dragging the content has
        started."""
        self._callback_add("scroll,drag,start", func, *args, **kwargs)

    def callback_scroll_drag_start_del(self, func):
        self._callback_del("scroll,drag,start", func)

    def callback_scroll_drag_stop_add(self, func, *args, **kwargs):
        """called when dragging the content has
        stopped."""
        self._callback_add("scroll,drag,stop", func, *args, **kwargs)

    def callback_scroll_drag_stop_del(self, func):
        self._callback_del("scroll,drag,stop", func)

    def callback_edge_top_add(self, func, *args, **kwargs):
        """This is called when the gengrid is scrolled until
        the top edge."""
        self._callback_add("edge,top", func, *args, **kwargs)

    def callback_edge_top_del(self, func):
        self._callback_del("edge,top", func)

    def callback_edge_bottom_add(self, func, *args, **kwargs):
        """This is called when the gengrid is scrolled
        until the bottom edge."""
        self._callback_add("edge,bottom", func, *args, **kwargs)

    def callback_edge_bottom_del(self, func):
        self._callback_del("edge,bottom", func)

    def callback_edge_left_add(self, func, *args, **kwargs):
        """This is called when the gengrid is scrolled
        until the left edge."""
        self._callback_add("edge,left", func, *args, **kwargs)

    def callback_edge_left_del(self, func):
        self._callback_del("edge,left", func)

    def callback_edge_right_add(self, func, *args, **kwargs):
        """This is called when the gengrid is scrolled
        until the right edge."""
        self._callback_add("edge,right", func, *args, **kwargs)

    def callback_edge_right_del(self, func):
        self._callback_del("edge,right", func)

    def callback_moved_add(self, func, *args, **kwargs):
        """This is called when a gengrid item is moved by a user
        interaction in a reorder mode. The %c event_info parameter is the item that
        was moved."""
        self._callback_add_full("moved", _cb_object_item_conv,
                                func, *args, **kwargs)

    def callback_moved_del(self, func):
        self._callback_del_full("moved", _cb_object_item_conv, func)

    def callback_index_update_add(self, func, *args, **kwargs):
        """This is called when a gengrid item index is changed.
        Note that this callback is called while each item is being realized."""
        self._callback_add("index,update", func, *args, **kwargs)

    def callback_index_update_del(self, func):
        self._callback_del("index,update", func)

    def callback_highlighted_add(self, func, *args, **kwargs):
        """an item in the list is highlighted. This is called when
        the user presses an item or keyboard selection is done so the item is
        physically highlighted. The %c event_info parameter is the item that was
        highlighted."""
        self._callback_add_full("highlighted", _cb_object_item_conv,
                                func, *args, **kwargs)

    def callback_highlighted_del(self, func):
        self._callback_del_full("highlighted", _cb_object_item_conv, func)

    def callback_unhighlighted_add(self, func, *args, **kwargs):
        """an item in the list is unhighlighted. This is called
        when the user releases an item or keyboard selection is moved so the item
        is physically unhighlighted. The %c event_info parameter is the item that
        was unhighlighted."""
        self._callback_add_full("unhighlighted", _cb_object_item_conv,
                                func, *args, **kwargs)

    def callback_unhighlighted_del(self, func):
        self._callback_del_full("unhighlighted", _cb_object_item_conv, func)

    def callback_language_changed_add(self, func, *args, **kwargs):
        """This is called when the program's language is
        changed. Call the elm_gengrid_realized_items_update() if items text should
        be translated."""
        self.callback_add("language,changed", func, *args, **kwargs)

    def callback_focused_add(self, func, *args, **kwargs):
        """When the gengrid has received focus.

        .. versionadded:: 1.8
        """
        self._callback_add("focused", func, *args, **kwargs)

    def callback_focused_del(self, func):
        self._callback_del("focused", func)

    def callback_unfocused_add(self, func, *args, **kwargs):
        """When the gengrid has lost focus.

        .. versionadded:: 1.8
        """
        self._callback_add("unfocused", func, *args, **kwargs)

    def callback_unfocused_del(self, func):
        self._callback_del("unfocused", func)

    def callback_item_focused_add(self, func, *args, **kwargs):
        """When the gengrid item has received focus.

        .. versionadded:: 1.10

        """
        self._callback_add_full("item,focused", _cb_object_item_conv, func, *args, **kwargs)

    def callback_item_focused_del(self, func):
        self._callback_del_full("item,focused", _cb_object_item_conv, func)

    def callback_item_unfocused_add(self, func, *args, **kwargs):
        """When the gengrid item has lost focus.

        .. versionadded:: 1.10

        """
        self._callback_add_full("item,unfocused", _cb_object_item_conv, func, *args, **kwargs)

    def callback_item_unfocused_del(self, func):
        self._callback_del_full("item,unfocused", _cb_object_item_conv, func)

    def callback_item_reorder_anim_start_add(self, func, *args, **kwargs):
        """When a gengrid item movement has just started by keys.

        .. versionadded:: 1.10

        """
        self._callback_add_full("item,reorder,anim,start", _cb_object_item_conv, func, *args, **kwargs)

    def callback_item_reorder_anim_start_del(self, func):
        self._callback_del_full("item,reorder,anim,start", _cb_object_item_conv, func)

    def callback_item_reorder_anim_stop_add(self, func, *args, **kwargs):
        """When a gengrid item movement just stopped in reorder mode.

        .. versionadded:: 1.10

        """
        self._callback_add_full("item,reorder,anim,stop", _cb_object_item_conv, func, *args, **kwargs)

    def callback_item_reorder_anim_stop_del(self, func):
        self._callback_del_full("item,reorder,anim,stop", _cb_object_item_conv, func)

    property scroller_policy:
        """

        .. deprecated:: 1.8
            You should combine with Scrollable class instead.

        """
        def __get__(self):
            return self.scroller_policy_get()

        def __set__(self, value):
            cdef Elm_Scroller_Policy policy_h, policy_v
            policy_h, policy_v = value
            self.scroller_policy_set(policy_h, policy_v)

    @DEPRECATED("1.8", "You should combine with Scrollable class instead.")
    def scroller_policy_set(self, policy_h, policy_v):
        elm_scroller_policy_set(self.obj, policy_h, policy_v)
    @DEPRECATED("1.8", "You should combine with Scrollable class instead.")
    def scroller_policy_get(self):
        cdef Elm_Scroller_Policy policy_h, policy_v
        elm_scroller_policy_get(self.obj, &policy_h, &policy_v)
        return (policy_h, policy_v)

    property bounce:
        """

        .. deprecated:: 1.8
            You should combine with Scrollable class instead.

        """
        def __get__(self):
            return self.bounce_get()
        def __set__(self, value):
            cdef Eina_Bool h, v
            h, v = value
            self.bounce_set(h, v)

    @DEPRECATED("1.8", "You should combine with Scrollable class instead.")
    def bounce_set(self, h, v):
        elm_scroller_bounce_set(self.obj, h, v)
    @DEPRECATED("1.8", "You should combine with Scrollable class instead.")
    def bounce_get(self):
        cdef Eina_Bool h, v
        elm_scroller_bounce_get(self.obj, &h, &v)
        return (h, v)

_object_mapping_register("Elm_Gengrid", Gengrid)