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

enum Elm.Toolbar_Shrink_Mode
{
   [[Set toolbar's items display behavior, it can be scrollable,
     show a menu with exceeding items, or simply hide them.

     Default value is #ELM_TOOLBAR_SHRINK_MENU. It reads value
     from elm config.

     Values don't work as bitmask, only one can be chosen.

     See also @Elm.Toolbar.shrink_mode.set, @Elm.Toolbar.shrink_mode.get.
   ]]

   legacy: elm_toolbar_shrink;

   none, [[Set toolbar minimum size to fit all the items.]]
   hide, [[Hide exceeding items.]]
   scroll, [[Allow accessing exceeding items through a scroller.]]
   menu, [[Inserts a button to pop up a menu with exceeding items.]]
   expand, [[Expand all items according the size of the toolbar.]]
   last [[Indicates error if returned by elm_toolbar_shrink_mode_get()]]
}

class Elm.Toolbar (Efl.Ui.Widget, Efl.Ui.Focus.Composition, Elm.Interface_Scrollable, Efl.Ui.Direction,
                   Efl.Access.Widget.Action, Efl.Access.Selection, Efl.Access.Object,
                   Efl.Ui.Clickable, Efl.Ui.Selectable, Efl.Ui.Legacy)
{
   [[Elementary toolbar class]]
   legacy_prefix: elm_toolbar;
   eo_prefix: elm_obj_toolbar;
   event_prefix: elm_toolbar;
   methods {
      @property selected_item {
         get {
            [[Get the selected item in the widget.]]
         }
         values {
            item: Elm.Widget.Item; [[The selected item or $null.]]
         }
      }
      @property first_item {
         get {
            [[Get the first item in the widget.]]
         }
         values {
            item: Elm.Widget.Item; [[The first item or $null.]]
         }
      }
      @property last_item {
         get {
            [[Get the last item in the widget.]]
         }
         values {
            item: Elm.Widget.Item; [[The last item or $null.]]
         }
      }
      @property items {
         get {
            [[Returns a list of the widget item.]]
            return: iterator<Elm.Widget.Item> @owned @warn_unused; [[iterator to widget items]]
         }
      }
      @property homogeneous {
         [[Control homogeneous mode.

           This will enable the homogeneous mode where items are of the same size.]]
         set {
         }
         get {
         }
         values {
            homogeneous: bool; [[Assume the items within the toolbar are of the same size (true = on, false = off). Default is $false.]]
         }
      }
      @property align {
         [[Control the alignment of the items.

           Alignment of toolbar items, from 0.0 to indicates to align
           left, to 1.0, to align to right. 0.5 centralize
           items.

           Centered items by default.]]
         set {
         }
         get {
         }
         values {
            align: double; [[The new alignment, a float between 0.0 and 1.0.]]
         }
      }
      @property select_mode {
         [[Control the toolbar select mode.

           elm_toolbar_select_mode_set() changes item select mode in the toolbar 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 If getting mode fails, it returns #ELM_OBJECT_SELECT_MODE_MAX]]
         }
      }
      @property icon_size {
         [[Control the icon size, in pixels, to be used by toolbar items.

           Note: Default value is $32. It reads value from elm config.]]
         set {
         }
         get {
         }
         values {
            icon_size: int; [[The icon size in pixels]]
         }
      }
      @property shrink_mode {
         [[Control the item displaying mode of a given toolbar widget $obj.

           The toolbar won't scroll under #ELM_TOOLBAR_SHRINK_NONE mode, but
           it will enforce a minimum size, so that all the items will fit
           inside it. It won't scroll and won't show the items that don't fit
           under #ELM_TOOLBAR_SHRINK_HIDE mode. Finally, it'll scroll under
           #ELM_TOOLBAR_SHRINK_SCROLL mode, and it will create a button to
           aggregate items which didn't fit with the #ELM_TOOLBAR_SHRINK_MENU
           mode.

           If shrink mode is changed, Toolbar will send one of the following
           signal to each item for informing the current shrink mode.
             "elm,state,shrink,default"
             "elm,state,shrink,hide"
             "elm,state,shrink,scroll"
             "elm,state,shrink,menu"
             "elm,state,shrink,expand"

           Warning: This function's behavior will clash with those of
           elm_scroller_policy_set(), so use either one of them, but not both.]]
         set {
         }
         get {
         }
         values {
            shrink_mode: Elm.Toolbar_Shrink_Mode; [[Toolbar's items display behavior]]
         }
      }
      @property menu_parent {
         [[Control the parent object of the toolbar items' menus.

           Each item can be set as item menu, with elm_toolbar_item_menu_set().

           For more details about setting the parent for toolbar menus, see
           elm_menu_parent_set().

           See: elm_menu_parent_set() for details.
           See: elm_toolbar_item_menu_set() for details.]]
         set {
         }
         get {
         }
         values {
            parent: Efl.Canvas.Object; [[The parent of the menu objects.]]
         }
      }
      @property standard_priority {
         [[Set the standard priority of visible items in a toolbar

           If the priority of the item is up to standard priority, it is shown in basic panel.
           The other items are located in more menu or panel. The more menu or panel can be shown when the more item is clicked.

           @since 1.7]]
         set {
         }
         get {
         }
         values {
            priority: int; [[The standard_priority of visible items]]
         }
      }
      @property more_item {
         get {
            [[Get the more item which is auto-generated by toolbar.

              Toolbar generates 'more' item when there is no more space to fit items in
              and toolbar is in #ELM_TOOLBAR_SHRINK_MENU or #ELM_TOOLBAR_SHRINK_EXPAND mode.
              The more item can be manipulated by elm_object_item_text_set() and
              elm_object_item_content_set.]]

            return: Elm.Widget.Item; [[The toolbar more item.]]
         }
      }
      item_insert_before {
         [[Insert a new item into the toolbar object before item $before.

           A new item will be created and added to the toolbar. Its position in
           this toolbar 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 such function isn't needed, just passing
           $NULL as $func is enough. The same should be done for $data.

           Toolbar will load icon image from fdo or current theme.
           This behavior can be set by elm_toolbar_icon_order_lookup_set() function.
           If an absolute path is provided it will load it direct from a file.

           Note: This function does not accept relative icon path.

           See: elm_toolbar_item_icon_set()]]

         return: Elm.Widget.Item; [[The created item or $NULL upon failure.]]
         params {
            @in before: Elm.Widget.Item; [[The toolbar item to insert before.]]
            @in icon: string @optional; [[A string with icon name or the absolute path of an image file.]]
            @in label: string; [[The label of the item.]]
            @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_insert_after {
         [[Insert a new item into the toolbar object after item $after.

           A new item will be created and added to the toolbar. Its position in
           this toolbar 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 such function isn't needed, just passing
           $NULL as $func is enough. The same should be done for $data.

           Toolbar will load icon image from fdo or current theme.
           This behavior can be set by elm_toolbar_icon_order_lookup_set() function.
           If an absolute path is provided it will load it direct from a file.

           Note: This function does not accept relative icon path.

           See: elm_toolbar_item_icon_set()]]

         return: Elm.Widget.Item; [[The created item or $NULL upon failure.]]
         params {
            @in after: Elm.Widget.Item; [[The toolbar item to insert after.]]
            @in icon: string @optional; [[A string with icon name or the absolute path of an image file.]]
            @in label: string; [[The label of the item.]]
            @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_append {
         [[Append item to the toolbar.

           A new item will be created and appended to the toolbar, 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 such function isn't needed, just passing
           $NULL as $func is enough. The same should be done for $data.

           Toolbar will load icon image from fdo or current theme.
           This behavior can be set by elm_toolbar_icon_order_lookup_set() function.
           If an absolute path is provided it will load it direct from a file.

           Note: This function does not accept relative icon path.

           See: elm_toolbar_item_icon_set()]]

         return: Elm.Widget.Item; [[The created item or $NULL upon failure.]]
         params {
            @in icon: string @optional; [[A string with icon name or the absolute path of an image file.]]
            @in label: string; [[The label of the item.]]
            @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.]]
         }
      }
      items_count @const {
         [[Get the number of items in a toolbar]]
         return: uint; [[The number of items in $obj toolbar]]
      }
      item_prepend {
         [[Prepend item to the toolbar.

           A new item will be created and prepended to the toolbar, 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 such function isn't needed, just passing
           $NULL as $func is enough. The same should be done for $data.

           Toolbar will load icon image from fdo or current theme.
           This behavior can be set by elm_toolbar_icon_order_lookup_set() function.
           If an absolute path is provided it will load it direct from a file.

           Note: This function does not accept relative icon path.

           See: elm_toolbar_item_icon_set()]]

         return: Elm.Widget.Item; [[The created item or $NULL upon failure.]]
         params {
            @in icon: string @optional; [[A string with icon name or the absolute path of an image file.]]
            @in label: string; [[The label of the item.]]
            @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_find_by_label @const {
         [[Returns a pointer to a toolbar item by its label.]]

         return: Elm.Widget.Item; [[The pointer to the toolbar item matching $label or $NULL on failure.]]
         params {
            @in label: string; [[The label of the item to find.]]
         }
      }
   }
   implements {
      class.constructor;
      Efl.Object.constructor;
      Efl.Gfx.Entity.position { set; }
      Efl.Gfx.Entity.size { set; }
      Efl.Canvas.Group.group_calculate;
      Efl.Canvas.Group.group_member_add;
      Efl.Ui.Widget.on_access_update;
      Efl.Ui.Widget.theme_apply;
      Efl.Ui.Focus.Object.on_focus_update;
      Efl.Ui.Translatable.translation_update;
      Efl.Ui.Widget.widget_event;
      Efl.Ui.Widget.focus_highlight_geometry { get; }
      Efl.Ui.Widget.focused_item { get; }
      Efl.Ui.Direction.direction { get; set; [[Only supports $vertical and $horizontal. Default is $horizontal.]] }
      Efl.Ui.Widget.focus_state_apply;
      Efl.Access.Widget.Action.elm_actions { get; }
      Efl.Access.Object.access_children { get; }
      Efl.Access.Object.state_set { 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;
      Efl.Ui.Focus.Composition.prepare;
   }
   events {
      item,focused; [[Called when toolbar item got focus]]
      item,unfocused; [[Called when toolbar item lost focus]]
   }
}