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

class Elm.List (Efl.Ui.Layout.Object, Elm.Interface_Scrollable,
                Efl.Access.Widget.Action, Efl.Access.Selection, Efl.Access.Object,
                Efl.Ui.Clickable, Efl.Ui.Selectable, Efl.Ui.Legacy)
{
   [[Elementary list class]]
   legacy_prefix: elm_list;
   eo_prefix: elm_obj_list;
   event_prefix: elm_list;
   methods {
      @property horizontal {
         [[Control horizontal mode on the list object.

           Note: Vertical mode is set by default.

           On horizontal mode items are displayed on list from left to right,
           instead of from top to bottom. Also, the list will scroll horizontally.
           Each item will presents left icon on top and right icon, or end, at
           the bottom.]]
         set {
         }
         get {
         }
         values {
            horizontal: bool; [[$true to enable horizontal or $false to disable it, i.e., to enable vertical mode.]]
         }
      }
      @property select_mode {
         [[Control the list select mode.

           elm_list_select_mode_set() changes item select mode in the list widget.
           - #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.]]
         set {
         }
         get {
         }
         values {
            mode: Elm.Object.Select_Mode(Elm.Object.Select_Mode.max); [[The select mode]]
         }
      }
      @property focus_on_selection {
         [[Control 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.]]
         set {
         }
         get {
         }
         values {
            enabled: bool; [[The tree effect status ($true = enabled, $false = disabled)]]
         }
      }
      @property multi_select {
         [[Control multiple items selection on the list object.

           Disabled by default. If disabled, the user can select a single item of
           the list each time. Selected items are highlighted on list.
           If enabled, many items can be selected.

           If a selected item is selected again, it will be unselected.]]
         set {
         }
         get {
         }
         values {
            multi: bool; [[$true to enable multi selection or $false to disable it.]]
         }
      }
      @property multi_select_mode {
         [[Control the list multi select mode.

           - #ELM_OBJECT_MULTI_SELECT_MODE_DEFAULT : select/unselect items whenever each
           item is clicked.
           - #ELM_OBJECT_MULTI_SELECT_MODE_WITH_CONTROL : 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.

           See: @.multi_select

           @since 1.8]]
         set {
         }
         get {
         }
         values {
            mode: Elm.Object.Multi_Select_Mode(Elm.Object.Multi_Select_Mode.max); [[The multi select mode]]
         }
      }
      @property mode {
         [[Control which mode to use for the list object.

           Set list's resize behavior, transverse axis scroll and
           items cropping. See each mode's description for more details.

           Note: Default value is #ELM_LIST_SCROLL.

           Only one mode at a time can be set. If a previous one was set, it
           will be changed by the new mode after this call. Bitmasks won't
           work here as well.

           Warning: This function's behavior will clash with those of
           elm_scroller_content_min_limit(), so use either one of them, but
           not both.]]
         set {
         }
         get {
         }
         values {
            mode: Elm.List.Mode(Elm.List.Mode.last); [[One of #Elm_List_Mode: #ELM_LIST_COMPRESS, #ELM_LIST_SCROLL, #ELM_LIST_LIMIT or #ELM_LIST_EXPAND.]]
         }
      }
      @property selected_item {
         get {
            [[Get the selected item.

             The selected item can be unselected with function
             elm_list_item_selected_set().

             The selected item always will be highlighted on list.]]

            return: Elm.Widget.Item; [[The selected list item.]]
         }
      }
      @property items {
         get {
            [[Get a list of all the list items.]]

            return: const(list<Elm.Widget.Item>); [[A $list of list items, #Elm.Widget.Item, or $NULL on failure.]]
         }
      }
      @property first_item {
         get {
            [[Get the first item in the list

              This returns the first item in the list.]]

            return: Elm.Widget.Item; [[The first item, or NULL if none]]
         }
      }
      @property selected_items {
         get {
            [[Return a list of the currently selected list items.

              Multiple items can be selected if multi select is enabled. It can be
              done with elm_list_multi_select_set().]]

            return: const(list<Elm.Widget.Item>); [[An $list of list items, #Elm.Widget.Item, or $NULL on failure.]]
         }
      }
      @property last_item {
         get {
            [[Get the last item in the list

              This returns the last item in the list.]]

            return: Elm.Widget.Item; [[The last item, or NULL if none]]
         }
      }
      item_insert_before {
         [[Insert a new item into the list object before item $before.

           A new item will be created and added to the list. Its position in
           this list will be just before item $before.

           Items created with this method can be deleted with elm_object_item_del().

           Associated $data can be properly freed when item is deleted if a
           callback function is set with elm_object_item_del_cb_set().

           If a function is passed as argument, it will be called every time this item
           is selected, i.e., the user clicks over an unselected item.
           If always select is enabled it will call this function every time
           user clicks over an item (already selected or not).
           If such function isn't needed, just passing
           $NULL as $func is enough. The same should be done for $data.

           Note: Remember that the label parameter is copied inside the list. So if an
           application dynamically allocated the label, the application should free the
           label after this call.]]

         return: Elm.Widget.Item; [[The created item or $NULL upon failure.]]
         params {
            @in before: Elm.Widget.Item; [[The list item to insert before.]]
            @in label: string; [[The label of the list item.]]
            @in icon: Efl.Canvas.Object @optional; [[The icon object to use for the left side of the item. An icon can be any Evas object, but usually it is an icon created with elm_icon_add().]]
            @in end: Efl.Canvas.Object @optional; [[The icon object to use for the right side of the item. An icon can be any Evas object.]]
            @in func: Evas_Smart_Cb @optional; [[The function to call when the item is clicked.]]
            @in data: const(void_ptr) @optional; [[The data to associate with the item for related callbacks.]]
         }
      }
      go {
         [[Starts the list.

         Note: Call before running show() on the list object.
         Warning: If not called, it won't display the list properly.]]

         /* FIXME-doc
         @code
         li = elm_list_add(win);
         elm_list_item_append(li, "First", NULL, NULL, NULL, NULL);
         elm_list_item_append(li, "Second", NULL, NULL, NULL, NULL);
         elm_list_go(li);
         evas_object_show(li);
         @endcode */
      }
      item_insert_after {
         [[Insert a new item into the list object after item $after.

           A new item will be created and added to the list. Its position in
           this list will be just after item $after.

           Items created with this method can be deleted with elm_object_item_del().

           Associated $data can be properly freed when item is deleted if a
           callback function is set with elm_object_item_del_cb_set().

           If a function is passed as argument, it will be called every time this item
           is selected, i.e., the user clicks over an unselected item.
           If always select is enabled it will call this function every time
           user clicks over an item (already selected or not).
           If such function isn't needed, just passing
           $NULL as $func is enough. The same should be done for $data.

           Note: Remember that the label parameter is copied inside the list. So if an
           application dynamically allocated the label, the application should free the
           label after this call.]]

         return: Elm.Widget.Item; [[The created item or $NULL upon failure.]]
         params {
            @in after: Elm.Widget.Item; [[The list item to insert after.]]
            @in label: string; [[The label of the list item.]]
            @in icon: Efl.Canvas.Object @optional; [[The icon object to use for the left side of the item. An icon can be any Evas object, but usually it is an icon created with elm_icon_add().]]
            @in end: Efl.Canvas.Object @optional; [[The icon object to use for the right side of the item. An icon can be any Evas object.]]
            @in func: Evas_Smart_Cb @optional; [[The function to call when the item is clicked.]]
            @in data: const(void_ptr) @optional; [[The data to associate with the item for related callbacks.]]
         }
      }
      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 list.]]

         return: Elm.Widget.Item; [[The item at the coordinates or NULL if none]]
         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]]
         }
      }
      item_append {
         [[Append a new item to the list object.

           A new item will be created and appended to the list, i.e., will
           be set as last item.

           Items created with this method can be deleted with elm_object_item_del().

           Associated $data can be properly freed when item is deleted if a
           callback function is set with elm_object_item_del_cb_set().

           If a function is passed as argument, it will be called every time this item
           is selected, i.e., the user clicks over an unselected item.
           If always select is enabled it will call this function every time
           user clicks over an item (already selected or not).
           If such function isn't needed, just passing
           $NULL as $func is enough. The same should be done for $data.

           Note: Remember that the label parameter is copied inside the list. So if an
           application dynamically allocated the label, the application should free the
           label after this call.]]

         /* FIXME-doc
         Simple example (with no function callback or data associated):
         @code
         li = elm_list_add(win);
         ic = elm_icon_add(win);
         elm_image_file_set(ic, "path/to/image", NULL);
         elm_icon_resizable_set(ic, true, true);
         elm_list_item_append(li, "label", ic, NULL, NULL, NULL);
         elm_list_go(li);
         evas_object_show(li);
         @endcode

         @see elm_list_select_mode_set()
         @see elm_object_item_del()
         @see elm_object_item_del_cb_set()
         @see elm_list_clear()
         @see elm_icon_add()
         */

         return: Elm.Widget.Item; [[The created item or $NULL upon failure.]]
         params {
            @in label: string; [[The label of the list item.]]
            @in icon: Efl.Canvas.Object @optional; [[The icon object to use for the left side of the item. An icon can be any Evas object, but usually it is an icon created with elm_icon_add().]]
            @in end: Efl.Canvas.Object @optional; [[The icon object to use for the right side of the item. An icon can be any Evas object.]]
            @in func: Evas_Smart_Cb @optional; [[The function to call when the item is clicked.]]
            @in data: const(void_ptr) @optional; [[The data to associate with the item for related callbacks.]]
         }
      }
      item_prepend {
         [[Prepend a new item to the list object.

           A new item will be created and prepended to the list, i.e., will
           be set as first item.

           Items created with this method can be deleted with elm_object_item_del().

           Associated $data can be properly freed when item is deleted if a
           callback function is set with elm_object_item_del_cb_set().

           If a function is passed as argument, it will be called every time this item
           is selected, i.e., the user clicks over an unselected item.
           If always select is enabled it will call this function every time
           user clicks over an item (already selected or not).
           If such function isn't needed, just passing
           $NULL as $func is enough. The same should be done for $data.

           Note: Remember that the label parameter is copied inside the list. So if an
           application dynamically allocated the label, the application should free the
           label after this call.]]

         return: Elm.Widget.Item; [[The created item or $NULL upon failure.]]
         params {
            @in label: string; [[The label of the list item.]]
            @in icon: Efl.Canvas.Object @optional; [[The icon object to use for the left side of the item. An icon can be any Evas object, but usually it is an icon created with elm_icon_add().]]
            @in end: Efl.Canvas.Object @optional; [[The icon object to use for the right side of the item. An icon can be any Evas object.]]
            @in func: Evas_Smart_Cb @optional; [[The function to call when the item is clicked.]]
            @in data: const(void_ptr) @optional; [[The data to associate with the item for related callbacks.]]
         }
      }
      clear {
         [[Remove all list's items.]]
      }
      item_sorted_insert {
         [[Insert a new item into the sorted list object.

           Note: This function inserts values into a list object assuming it was
           sorted and the result will be sorted.

           A new item will be created and added to the list. Its position in
           this list will be found comparing the new item with previously inserted
           items using function $cmp_func.

           Items created with this method can be deleted with elm_object_item_del().

           Associated $data can be properly freed when item is deleted if a
           callback function is set with elm_object_item_del_cb_set().

           If a function is passed as argument, it will be called every time this item
           is selected, i.e., the user clicks over an unselected item.
           If always select is enabled it will call this function every time
           user clicks over an item (already selected or not).
           If such function isn't needed, just passing
           $NULL as $func is enough. The same should be done for $data.

           Note: Remember that the label parameter is copied inside the list. So if an
           application dynamically allocated the label, the application should free the
           label after this call.]]

         return: Elm.Widget.Item; [[The created item or $NULL upon failure.]]
         params {
            @in label: string; [[The label of the list item.]]
            @in icon: Efl.Canvas.Object @optional; [[The icon object to use for the left side of the item. An icon can be any Evas object, but usually it is an icon created with elm_icon_add().]]
            @in end: Efl.Canvas.Object @optional; [[The icon object to use for the right side of the item. An icon can be any Evas object.]]
            @in func: Evas_Smart_Cb @optional; [[The function to call when the item is clicked.]]
            @in data: const(void_ptr) @optional; [[The data to associate with the item for related callbacks.]]
            @in cmp_func: Eina_Compare_Cb; [[The comparing function to be used to sort list
                                             items by #Elm.Widget.Item item handles. This function will
                                             receive two items and compare them, returning a non-negative integer
                                             if the second item should be place after the first, or negative value
                                             if should be placed before.]]
         }
      }
   }
   implements {
      class.constructor;
      Efl.Object.constructor;
      Efl.Gfx.Entity.position { set; }
      Efl.Gfx.Entity.size { set; }
      Efl.Canvas.Group.group_member_add;
      Efl.Ui.Widget.theme_apply;
      Efl.Ui.Widget.on_access_update;
      Efl.Ui.Widget.focus_highlight_geometry { get; }
      Efl.Ui.Widget.on_disabled_update;
      Efl.Ui.Focus.Object.on_focus_update;
      Efl.Ui.Translatable.translation_update;
      Efl.Ui.Widget.widget_sub_object_del;
      Efl.Ui.Widget.widget_event;
      Efl.Ui.Widget.focused_item { get; }
      Elm.Interface_Scrollable.item_loop_enabled { get; set; }
      Elm.Interface_Scrollable.policy { set; }
      Efl.Access.Widget.Action.elm_actions { get; }
      Efl.Access.Object.access_children { 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.access_selection_clear;
   }
   events {
      activated: Efl.Object; [[Called when activated]]
      edge,top: void; [[Called when top edge was reached]]
      edge,bottom: void; [[Called when bottom edge was reached]]
      edge,left: void; [[Called when left edge was reached]]
      edge,right: void; [[Called when right edge was reached]]
      swipe: Efl.Object; [[Called when swipe is detected]]
      highlighted: Efl.Object; [[Called when highlighted]]
      unhighlighted: Efl.Object; [[Called when no longer highlighted]]
      item,focused: Efl.Object; [[Called when item got focus]]
      item,unfocused: Efl.Object; [[Called when item no longer has focus]]
      /* FIXME: Nobody emits these
      item,reorder,anim,start; [[Called when item reorder animation started]]
      item,reorder,anim,stop; [[Called when item reorder animation stopped]]
      */
   }
}