aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/elementary/elm_genlist.eo
blob: 3a6969e6f3a787601ac52d02c0550908b18df7fe (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
import elm_general;
import elm_list;
import elm_genlist_item;

class Elm.Genlist (Efl.Ui.Layout, Elm.Interface_Scrollable, Efl.Ui.Clickable,
                   Elm.Interface.Atspi_Widget_Action, Efl.Access.Selection,
                   Efl.Ui.Selectable)
{
   [[Elementary genlist class]]
   legacy_prefix: elm_genlist;
   eo_prefix: elm_obj_genlist;
   event_prefix: elm_genlist;
   methods {
      @property homogeneous {
         set {
            [[Enable/disable homogeneous mode.

              This will enable the homogeneous mode where items are of the
              same height and width so that genlist may do the lazy-loading
              at its maximum (which increases the performance for scrolling
              the list). In the normal mode, genlist will pre-calculate all
              the items' sizes even though they are not in use. So items'
              callbacks are called many times than expected. But homogeneous
              mode will skip the item size pre-calculation  process so
              items' callbacks are called only when the item is needed.

              Note: This also works well with group index.
            ]]
         }
         get {
            [[Get whether the homogeneous mode is enabled.]]
         }
         values {
            homogeneous: bool; [[Assume the items within the genlist are of
                                 the same height and width. Default is $false.]]
         }
      }
      @property select_mode {
         set {
            [[Set the genlist select mode.

              #ELM_OBJECT_SELECT_MODE_DEFAULT means that items will call
              their selection func and callback once when first becoming
              selected. Any further clicks will do nothing, unless you set
              always select mode. ELM_OBJECT_SELECT_MODE_ALWAYS means that
              even if selected, every click will make the selected callbacks
              be called. #ELM_OBJECT_SELECT_MODE_NONE will turn off the
              ability to select items entirely and they will neither appear
              selected nor call selected callback functions.
            ]]
         }
         get {
            [[Get the genlist select mode.]]
         }
         values {
            mode: Elm.Object.Select_Mode(Elm.Object.Select_Mode.max); [[The select mode.]]
         }
      }
      @property focus_on_selection {
         set {
            [[Set focus upon items selection mode

              When enabled, every selection of an item inside the genlist
              will automatically set focus to its first focusable widget
              from the left. This is true of course if the selection was
              made by clicking an unfocusable area in an item or selecting
              it with a key movement. Clicking on a focusable widget inside
              an item will couse this particular item to get focus as usual.
            ]]
         }
         get {
            [[Get whether focus upon item's selection mode is enabled.]]
         }
         values {
            enabled: bool; [[The tree effect status.]]
         }
      }
      @property longpress_timeout {
         set {
            [[Set the timeout in seconds for the longpress event.

              This option will change how long it takes to send an event
              "longpressed" after the mouse down signal is sent to the list.
              If this event occurs, no "clicked" event will be sent.

              Warning: If you set the longpress timeout value with this API,
              your genlist will not be affected by the longpress value of
              elementary config value later.
            ]]
         }
         get {
            [[Get the timeout in seconds for the longpress event.]]
         }
         values {
            timeout: double; [[Timeout in seconds. Default is elm config value (1.0).]]
         }
      }
      @property multi_select {
         set {
            [[Enable or disable multi-selection in the genlist.

              This enables ($true) or disables ($false) multi-selection in
              the list. This allows more than 1 item to be selected. To
              retrieve the list of selected items, use @.selected_items.get.
            ]]
         }
         get {
            [[Get if multi-selection in genlist is enabled or disabled.]]
         }
         values {
            multi: bool; [[Multi-select enable/disable. Default is disabled.]]
         }
      }
      @property reorder_mode {
         set {
            [[Set reorder mode.

              After turning on the reorder mode, longpress on normal item
              will trigger reordering of the item. You can move the item
              up and down. However, reorder does not work with group item.
            ]]
         }
         get {
            [[Get the reorder mode.]]
         }
         values {
            reorder_mode: bool; [[The reorder mode.]]
         }
      }
      @property decorate_mode {
         set {
            [[Set Genlist decorate mode.

              This sets Genlist decorate mode to all items.
            ]]
         }
         get {
            [[Get Genlist decorate mode.]]
         }
         values {
            decorated: bool; [[The decorate mode status.]]
         }
      }
      @property multi_select_mode {
         set {
            [[Set the genlist multi select mode.

              #ELM_OBJECT_MULTI_SELECT_MODE_DEFAULT means that
              select/unselect items whenever each item is clicked.
              #ELM_OBJECT_MULTI_SELECT_MODE_WITH_CONTROL means that only
              one item will be selected although multi-selection is enabled,
              if clicked without pressing control key. This mode is only
              available with multi-selection.

              @since 1.8
            ]]
         }
         get {
            [[Get the genlist multi select mode.

              @since 1.8
            ]]
         }
         values {
            mode: Elm.Object.Multi_Select_Mode(Elm.Object.Multi_Select_Mode.max); [[The multi select mode]]
         }
      }
      @property block_count {
         set {
            [[Set the maximum number of items within an item block.

              This will configure the block count to tune to the target
              with particular performance matrix.

              A block of objects will be used to reduce the number of
              operations due to many objects in the screen. It can
              determine the visibility, or if the object has changed,
              it theme needs to be updated, etc. doing this kind of
              calculation to the entire block, instead of per object.

              The default value for the block count is enough for most
              lists, so unless you know you will have a lot of objects
              visible in the screen at the same time, don't try to
              change this.
            ]]
         }
         get {
            [[Get the maximum number of items within an item block.]]
         }
         values {
            count: int; [[Maximum number of items within an item block. Default is 32.]]
         }
      }
      @property tree_effect_enabled {
         [[Control genlist tree effect.]]
         set {}
         get {}
         values {
            enabled: bool; [[The tree effect status.]]
         }
      }
      @property highlight_mode {
         set {
            [[Set whether the genlist items should be highlighted on item
              selection.

              This will turn on/off the highlight effect on item selection.
              The selected and clicked callback functions will still be
              called.

              Highlight is enabled by default.
            ]]
         }
         get {
            [[Get whether the genlist items' should be highlighted when
              item selected.
            ]]
         }
         values {
            highlight: bool; [[$true to enable highlighting or $false to
                               disable it.]]
         }
      }
      @property mode {
         set {
            [[This sets the horizontal stretching mode.

              This sets the mode used for sizing items horizontally. Valid
              modes are @Elm.List.Mode.limit, @Elm.List.Mode.scroll, and
              @Elm.List.Mode.compress. The default is @Elm.List.Mode.scroll. This mode
              means that if items are too wide to fit, the scroller will
              scroll horizontally. Otherwise items are expanded to fill
              the width of the viewport of the scroller. If it is
              @Elm.List.Mode.limit, items will be expanded to the viewport width
              and limited to that size. If it is @Elm.List.Mode.compress, the
              item width will be fixed (restricted to a minimum of) to the
              list width when calculating its size in order to allow the
              height to be calculated based on it. This allows, for
              instance, text block to wrap lines if the Edje part is
              configured with "text.min: 0 1".

              Note: @Elm.List.Mode.compress will make list resize slower as it
              will have to recalculate every item height again whenever
              the list width changes!

              Note: Homogeneous mode is for that all items in the genlist
              same width/height. With @Elm.List.Mode.compress, it makes genlist
              items to fast initializing. However there's no sub-objects
              in genlist which can be on the flying resizable (such as
              TEXTBLOCK). If then, some dynamic esizable objects in
              genlist would not diplayed properly.
            ]]
         }
         get {
            [[Get the horizontal stretching mode.]]
         }
         values {
            mode: Elm.List.Mode(Elm.List.Mode.last); [[The mode to use (one of @Elm.List.Mode.scroll or @Elm.List.Mode.limit).]]
         }
      }
      @property decorated_item {
         get {
            [[Get active genlist mode item.

              This function returns the item that was activated with a mode,
              by the function @.decorate_mode.set.
            ]]
            return: Elm.Widget.Item; [[The active item for that current mode.
                                       Or $null if no item is activated with any mode.]]
         }
      }
      @property selected_item {
         get {
            [[Get the selected item in the genlist.

              This gets the selected item in the list (if multi-selection
              is enabled, only the item that was first selected in the list
              is returned - which is not very useful, so see
              @.selected_items.get for when multi-selection is used).

              If no item is selected, $null is returned.
            ]]
            return: Elm.Widget.Item; [[The selected item, or $null if none is selected.]]
         }
      }
      @property first_item {
         get {
            [[Get the first item in the genlist.

              This returns the first item in the list.

              If filter is set on genlist, it returns
              the first filtered item in the list.
            ]]
            return: Elm.Widget.Item; [[The first item or $null.]]
         }
      }
      @property realized_items {
         get {
            [[Get a list of realized items in genlist.

              This returns a list of the realized items in the genlist.
              The list contains genlist item pointers. The list must be
              freed by the caller when done with \@ref eina_list_free. The 
              item pointers in the list are only valid so long as those
              items are not deleted or the genlist is not deleted.
            ]]
            return: list<ptr(Elm_Gen_Item)> @owned @warn_unused; [[List of realized items]]
         }
      }
      @property selected_items {
         get {
            [[Get a list of selected items in the genlist.

              It returns a list of the selected items. This list pointer
              is only valid so long as the selection doesn't change (no
              items are selected or unselected, or unselected implicitl
              by deletion). The list contains genlist items pointers. The
              order of the items in this list is the order which they were
              selected, i.e. the first item in this list is the first item
              that was selected, and so on.

              Note: If not in multi-select mode, consider using function
              @.selected_item.get instead.
            ]]
            return: const(list<Elm.Widget.Item>); [[List of selected items]]
         }
      }
      @property last_item {
         get {
            [[Get the last item in the genlist

              This returns the last item in the list.
              
              If filter is set to genlist, it returns
              last filtered item in the list.
            ]]
            return: Elm.Widget.Item; [[Last item in list]]
         }
      }
      item_insert_before {
         [[Insert an item before another in a genlist widget

           This inserts an item before another in the list. It will be in
           the same tree level or group as the item it is inserted before.
         ]]
         return: Elm.Widget.Item; [[Handle to inserted item]]
         params {
            @in itc: ptr(const(Elm.Genlist.Item.Class)); [[The item class for the item.]]
            @in data: const(void_ptr); [[The item data.]]
            @in parent: Elm.Widget.Item @nullable; [[The parent item, or $null if none.]]
            @in before_it: Elm.Widget.Item; [[The item to place this new one before.]]
            @in type: Elm.Genlist.Item.Type; [[Item type.]]
            @in func: Evas_Smart_Cb @optional; [[Convenience function called when the item is selected.]]
            @in func_data: const(void_ptr) @optional; [[Data passed to $func above.]]
         }
      }
      realized_items_update {
         [[Update the contents of all realized items.

           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 \@ref elm_genlist_item_update.
         ]]
      }
      item_insert_after {
         [[Insert an item after another in a genlist widget

           This inserts an item after another in the list. It will be in the
           same tree level or group as the item it is inserted after.
         ]]
         return: Elm.Widget.Item; [[Handle to inserted item]]
         params {
            @in itc: ptr(const(Elm.Genlist.Item.Class)); [[The item class for the item.]]
            @in data: const(void_ptr); [[The item data.]]
            @in parent: Elm.Widget.Item @nullable; [[The parent item, or $null if none.]]
            @in after_it: Elm.Widget.Item; [[The item to place this new one after.]]
            @in type: Elm.Genlist.Item.Type; [[Item type.]]
            @in func: Evas_Smart_Cb @optional; [[Convenience function called when the item is selected.]]
            @in func_data: const(void_ptr) @optional; [[Data passed to $func above.]]
         }
      }
      at_xy_item_get @const {
         [[Get the item that is at the x, y canvas coords.

           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 $posret 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 genlist.
         ]]
         return: Elm.Widget.Item; [[Item at position]]
         params {
            @in x: int; [[The input x coordinate.]]
            @in y: int; [[The input y coordinate.]]
            @out posret: int; [[The position relative to the item returned here.]]
         }
      }
      @property filter {
         set {
            [[Set filter mode with key.

              This initiates the filter mode of genlist with user/application
              provided key. If key is NULL, the filter mode is turned off.

              The filter data passed has to be managed by application itself and
              should not be deleted before genlist is deleted(or while filtering
              is not done.
            ]]
         }
         values {
            key: void_ptr; [[Filter key]]
         }
      }
      filter_iterator_new {
         [[Returns an iterator over the list of filtered items.

           Return NULL if filter is not set. Application must take care
           of the case while calling the API. Must be freed after use.
         ]]
         return: iterator<ptr(Elm_Gen_Item)> @owned; [[Iterator on genlist]]
      }
      filtered_items_count @const {
         [[Return how many items have passed the filter currently.

           This behaviour is O(1) and returns the count of items which
           are currently passed by the filter. After "filter,done", the
           call returns total count of the filtered items.

           @since 1.18
         ]]
         return: uint; [[Count of items passing the filter]]
      }
      items_count @const {
         [[Return how many items are currently in a list.

           This behavior is O(1) and includes items which may or may not
           be realized.
         ]]
         return: uint; [[Item in list]]
      }
      item_prepend {
         [[Prepend a new item in a given genlist widget.

           This adds an item to the beginning of the list or beginning of
           the children of the parent if given.
         ]]
         return: Elm.Widget.Item; [[Handle to prepended item]]
         params {
            @in itc: ptr(const(Elm.Genlist.Item.Class)); [[The item class for the item.]]
            @in data: const(void_ptr); [[The item data.]]
            @in parent: Elm.Widget.Item @nullable; [[The parent item, or $null if none.]]
            @in type: Elm.Genlist.Item.Type; [[Item type.]]
            @in func: Evas_Smart_Cb @optional; [[Convenience function called when the item is selected.]]
            @in func_data: const(void_ptr) @optional; [[Data passed to $func above.]]
         }
      }
      clear {
         [[Remove all items from a given genlist widget.

           This removes (and deletes) all items in $obj, leaving it empty.
         ]]
      }
      item_append {
         [[Append a new item in a given genlist widget.

           This adds the given item to the end of the list or the end of
           the children list if the $parent is given.
         ]]
         return: Elm.Widget.Item; [[Handle to appended item]]
         params {
            @in itc: ptr(const(Elm.Genlist.Item.Class)); [[The item class for the item.]]
            @in data: const(void_ptr); [[The item data.]]
            @in parent: Elm.Widget.Item @nullable; [[The parent item, or $null if none.]]
            @in type: Elm.Genlist.Item.Type; [[Item type.]]
            @in func: Evas_Smart_Cb @optional; [[Convenience function called when the item is selected.]]
            @in func_data: const(void_ptr) @optional; [[Data passed to $func above.]]
         }
      }
      item_sorted_insert {
         [[Insert a new item into the sorted genlist object

           This inserts an item in the genlist based on user defined
           comparison function. The two arguments passed to the function
           $func are genlist item handles to compare.
         ]]
         return: Elm.Widget.Item; [[Handle to inserted item]]
         params {
            @in itc: ptr(const(Elm.Genlist.Item.Class)); [[The item class for the item.]]
            @in data: const(void_ptr); [[The item data.]]
            @in parent: Elm.Widget.Item @nullable; [[The parent item, or $null if none.]]
            @in type: Elm.Genlist.Item.Type; [[Item type.]]
            @in comp: Eina_Compare_Cb; [[The function called for the sort.]]
            @in func: Evas_Smart_Cb @optional; [[Convenience function called when the item is selected.]]
            @in func_data: const(void_ptr) @optional; [[Data passed to $func above.]]
         }
      }
      search_by_text_item_get {
         [[Get genlist item by given string.

           It takes pointer to the genlist item that will be used to start
           search from it.

           This function uses globs (like "*.jpg") for searching and takes
           search flags as last parameter That is a bitfield with values
           to be ored together or 0 for no flags.

           @since 1.11
         ]]
         return: Elm.Widget.Item; [[Searched item]]
         params {
            @in item_to_search_from: Elm.Widget.Item @optional; [[
               Pointer to item to start search from. If $null, search
               will be started from the first item of the genlist.
            ]]
            @in part_name: string; [[Name of the TEXT part of genlist item to search string in.]]
            @in pattern: string; [[The search pattern.]]
            @in flags: Elm.Glob.Match_Flags; [[Search flags.]]
         }
      }
   }
   implements {
      class.constructor;
      Efl.Object.constructor;
      Efl.Gfx.position { set; }
      Efl.Gfx.size { set; }
      Efl.Canvas.Group.group_member_add;
      Elm.Widget.theme_apply;
      Elm.Widget.widget_sub_object_add;
      Elm.Widget.on_access_update;
      Elm.Widget.focus_highlight_geometry { get; }
      Elm.Widget.on_focus_update;
      Elm.Widget.widget_sub_object_del;
      Elm.Widget.widget_event;
      Elm.Widget.focused_item { get; }
      Elm.Interface_Scrollable.item_loop_enabled { get; set; }
      Elm.Interface_Scrollable.bounce_allow { get; set; }
      Elm.Interface_Scrollable.policy { get; set; }
      Efl.Access.children { get; }
      Efl.Access.state_set { get; }
      Elm.Interface.Atspi_Widget_Action.elm_actions { get; }
      Efl.Access.Selection.selected_children_count { get; }
      Efl.Access.Selection.selected_child { get; }
      Efl.Access.Selection.selected_child_deselect;
      Efl.Access.Selection.child_select;
      Efl.Access.Selection.child_deselect;
      Efl.Access.Selection.is_child_selected;
      Efl.Access.Selection.all_children_select;
      Efl.Access.Selection.clear;
   }
   events {
      item,focused; [[Called when genlist item got focus]]
      item,unfocused; [[Called when genlist item lost focus]]
      vbar,drag; [[Called when vertical bar is dragged]]
      vbar,press; [[Called when vertical bar is pressed]]
      vbar,unpress; [[Called when vertical bar is no longer pressed]]
      hbar,drag; [[Called when horizontal bar is dragged]]
      hbar,press; [[Called when horizontal bar is pressed]]
      hbar,unpress; [[Called when horizontal bar is no longer pressed]]
      edge,top; [[Called when top edge is reached]]
      edge,bottom; [[Called when bottom edge is reached]]
      edge,left; [[Called when left edge is reached]]
      edge,right; [[Called when right edge is reached]]
      moved; [[Called when genlist item moved]] 
      moved,before; [[Called when genlist item moved before]]
      moved,after; [[Called when genlist item moved after]]
      swipe; [[Called when swipe is detected]]
      multi,pinch,in; [[Called when multitouch pinch in detected]] 
      multi,pinch,out; [[Called when multitouch pinch out detected]]
      multi,swipe,down; [[Called when multitouch swipe down detected]]
      multi,swipe,up; [[Called when multitouch swipe up detected]]
      multi,swipe,right; [[Called when multitouch swipe right detected]]
      multi,swipe,left; [[Called when multitouch swipe left detected]]
      released; [[Called when genlist is released]]
      activated; [[called when genlist is activated]]
      highlighted; [[Called when genlist is highlighted]]
      unhighlighted; [[Called when genlist is no longer highlighted]]
      realized; [[Called when genlist is realized]]
      unrealized; [[Called when genlist is unrealized]]
      contract,request; [[Called when contract is requested]]
      expand,request; [[Called when expand is requested]]
      contracted; [[called when genlist is contracted]]
      expanded; [[Called when genlist is expanded]]
      index,update; [[Called when genlist index updated]]
      tree,effect,finished; [[Called when genlist tree effect finished]]
      filter,done; [[Called when genlist filter is done]]
   }
}