diff options
author | David Walter Seikel | 2012-04-22 09:20:32 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-04-22 09:20:32 +1000 |
commit | 3ad3455551be0d7859ecb02290376206d5e66498 (patch) | |
tree | 497917e12b4d7f458dff9765d9b53f64c4e03fc3 /libraries/elementary/src/lib/elm_toolbar.h | |
parent | Update EFL to latest beta. (diff) | |
download | SledjHamr-3ad3455551be0d7859ecb02290376206d5e66498.zip SledjHamr-3ad3455551be0d7859ecb02290376206d5e66498.tar.gz SledjHamr-3ad3455551be0d7859ecb02290376206d5e66498.tar.bz2 SledjHamr-3ad3455551be0d7859ecb02290376206d5e66498.tar.xz |
And actually include new files, plus elementary libraries.
Diffstat (limited to 'libraries/elementary/src/lib/elm_toolbar.h')
-rw-r--r-- | libraries/elementary/src/lib/elm_toolbar.h | 900 |
1 files changed, 900 insertions, 0 deletions
diff --git a/libraries/elementary/src/lib/elm_toolbar.h b/libraries/elementary/src/lib/elm_toolbar.h new file mode 100644 index 0000000..6b01030 --- /dev/null +++ b/libraries/elementary/src/lib/elm_toolbar.h | |||
@@ -0,0 +1,900 @@ | |||
1 | /** | ||
2 | * @defgroup Toolbar Toolbar | ||
3 | * @ingroup Elementary | ||
4 | * | ||
5 | * @image html img/widget/toolbar/preview-00.png | ||
6 | * @image latex img/widget/toolbar/preview-00.eps width=\textwidth | ||
7 | * | ||
8 | * @image html img/toolbar.png | ||
9 | * @image latex img/toolbar.eps width=\textwidth | ||
10 | * | ||
11 | * A toolbar is a widget that displays a list of items inside | ||
12 | * a box. It can be scrollable, show a menu with items that don't fit | ||
13 | * to toolbar size or even crop them. | ||
14 | * | ||
15 | * Only one item can be selected at a time. | ||
16 | * | ||
17 | * Items can have multiple states, or show menus when selected by the user. | ||
18 | * | ||
19 | * Smart callbacks one can listen to: | ||
20 | * - "clicked" - when the user clicks on a toolbar item and becomes selected. | ||
21 | * - "longpressed" - when the toolbar is pressed for a certain amount of time. | ||
22 | * - "language,changed" - when the program language changes. | ||
23 | * | ||
24 | * Available styles for it: | ||
25 | * - @c "default" | ||
26 | * - @c "transparent" - no background or shadow, just show the content | ||
27 | * | ||
28 | * Default text parts of the toolbar items that you can use for are: | ||
29 | * @li "default" - label of the toolbar item | ||
30 | * | ||
31 | * Supported elm_object_item common APIs. | ||
32 | * @li @ref elm_object_item_disabled_set | ||
33 | * @li @ref elm_object_item_disabled_get | ||
34 | * @li @ref elm_object_item_part_text_set | ||
35 | * @li @ref elm_object_item_part_text_get | ||
36 | * | ||
37 | * List of examples: | ||
38 | * @li @ref toolbar_example_01 | ||
39 | * @li @ref toolbar_example_02 | ||
40 | * @li @ref toolbar_example_03 | ||
41 | */ | ||
42 | |||
43 | /** | ||
44 | * @addtogroup Toolbar | ||
45 | * @{ | ||
46 | */ | ||
47 | |||
48 | /** | ||
49 | * @enum _Elm_Toolbar_Shrink_Mode | ||
50 | * @typedef Elm_Toolbar_Shrink_Mode | ||
51 | * | ||
52 | * Set toolbar's items display behavior, it can be scrollable, | ||
53 | * show a menu with exceeding items, or simply hide them. | ||
54 | * | ||
55 | * @note Default value is #ELM_TOOLBAR_SHRINK_MENU. It reads value | ||
56 | * from elm config. | ||
57 | * | ||
58 | * Values <b> don't </b> work as bitmask, only one can be chosen. | ||
59 | * | ||
60 | * @see elm_toolbar_shrink_mode_set() | ||
61 | * @see elm_toolbar_shrink_mode_get() | ||
62 | * | ||
63 | * @ingroup Toolbar | ||
64 | */ | ||
65 | typedef enum | ||
66 | { | ||
67 | ELM_TOOLBAR_SHRINK_NONE, /**< Set toolbar minimum size to fit all the items. */ | ||
68 | ELM_TOOLBAR_SHRINK_HIDE, /**< Hide exceeding items. */ | ||
69 | ELM_TOOLBAR_SHRINK_SCROLL, /**< Allow accessing exceeding items through a scroller. */ | ||
70 | ELM_TOOLBAR_SHRINK_MENU, /**< Inserts a button to pop up a menu with exceeding items. */ | ||
71 | ELM_TOOLBAR_SHRINK_EXPAND, /**< Expand all items according the size of the toolbar. */ | ||
72 | ELM_TOOLBAR_SHRINK_LAST /**< Indicates error if returned by elm_toolbar_shrink_mode_get() */ | ||
73 | } Elm_Toolbar_Shrink_Mode; | ||
74 | |||
75 | typedef struct _Elm_Toolbar_Item_State Elm_Toolbar_Item_State; /**< State of a Elm_Toolbar_Item. Can be created with elm_toolbar_item_state_add() and removed with elm_toolbar_item_state_del(). */ | ||
76 | |||
77 | /** | ||
78 | * Add a new toolbar widget to the given parent Elementary | ||
79 | * (container) object. | ||
80 | * | ||
81 | * @param parent The parent object. | ||
82 | * @return a new toolbar widget handle or @c NULL, on errors. | ||
83 | * | ||
84 | * This function inserts a new toolbar widget on the canvas. | ||
85 | * | ||
86 | * @ingroup Toolbar | ||
87 | */ | ||
88 | EAPI Evas_Object *elm_toolbar_add(Evas_Object *parent); | ||
89 | |||
90 | /** | ||
91 | * Set the icon size, in pixels, to be used by toolbar items. | ||
92 | * | ||
93 | * @param obj The toolbar object | ||
94 | * @param icon_size The icon size in pixels | ||
95 | * | ||
96 | * @note Default value is @c 32. It reads value from elm config. | ||
97 | * | ||
98 | * @see elm_toolbar_icon_size_get() | ||
99 | * | ||
100 | * @ingroup Toolbar | ||
101 | */ | ||
102 | EAPI void elm_toolbar_icon_size_set(Evas_Object *obj, int icon_size); | ||
103 | |||
104 | /** | ||
105 | * Get the icon size, in pixels, to be used by toolbar items. | ||
106 | * | ||
107 | * @param obj The toolbar object. | ||
108 | * @return The icon size in pixels. | ||
109 | * | ||
110 | * @see elm_toolbar_icon_size_set() for details. | ||
111 | * | ||
112 | * @ingroup Toolbar | ||
113 | */ | ||
114 | EAPI int elm_toolbar_icon_size_get(const Evas_Object *obj); | ||
115 | |||
116 | /** | ||
117 | * Sets icon lookup order, for toolbar items' icons. | ||
118 | * | ||
119 | * @param obj The toolbar object. | ||
120 | * @param order The icon lookup order. | ||
121 | * | ||
122 | * Icons added before calling this function will not be affected. | ||
123 | * The default lookup order is #ELM_ICON_LOOKUP_THEME_FDO. | ||
124 | * | ||
125 | * @see elm_toolbar_icon_order_lookup_get() | ||
126 | * | ||
127 | * @ingroup Toolbar | ||
128 | */ | ||
129 | EAPI void elm_toolbar_icon_order_lookup_set(Evas_Object *obj, Elm_Icon_Lookup_Order order); | ||
130 | |||
131 | /** | ||
132 | * Gets the icon lookup order. | ||
133 | * | ||
134 | * @param obj The toolbar object. | ||
135 | * @return The icon lookup order. | ||
136 | * | ||
137 | * @see elm_toolbar_icon_order_lookup_set() for details. | ||
138 | * | ||
139 | * @ingroup Toolbar | ||
140 | */ | ||
141 | EAPI Elm_Icon_Lookup_Order elm_toolbar_icon_order_lookup_get(const Evas_Object *obj); | ||
142 | |||
143 | /** | ||
144 | * Append item to the toolbar. | ||
145 | * | ||
146 | * @param obj The toolbar object. | ||
147 | * @param icon A string with icon name or the absolute path of an image file. | ||
148 | * @param label The label of the item. | ||
149 | * @param func The function to call when the item is clicked. | ||
150 | * @param data The data to associate with the item for related callbacks. | ||
151 | * @return The created item or @c NULL upon failure. | ||
152 | * | ||
153 | * A new item will be created and appended to the toolbar, i.e., will | ||
154 | * be set as @b last item. | ||
155 | * | ||
156 | * Items created with this method can be deleted with | ||
157 | * elm_object_item_del(). | ||
158 | * | ||
159 | * Associated @p data can be properly freed when item is deleted if a | ||
160 | * callback function is set with elm_object_item_del_cb_set(). | ||
161 | * | ||
162 | * If a function is passed as argument, it will be called every time this item | ||
163 | * is selected, i.e., the user clicks over an unselected item. | ||
164 | * If such function isn't needed, just passing | ||
165 | * @c NULL as @p func is enough. The same should be done for @p data. | ||
166 | * | ||
167 | * Toolbar will load icon image from fdo or current theme. | ||
168 | * This behavior can be set by elm_toolbar_icon_order_lookup_set() function. | ||
169 | * If an absolute path is provided it will load it direct from a file. | ||
170 | * | ||
171 | * @see elm_toolbar_item_icon_set() | ||
172 | * @see elm_object_item_del() | ||
173 | * | ||
174 | * @ingroup Toolbar | ||
175 | */ | ||
176 | EAPI Elm_Object_Item *elm_toolbar_item_append(Evas_Object *obj, const char *icon, const char *label, Evas_Smart_Cb func, const void *data); | ||
177 | |||
178 | /** | ||
179 | * Prepend item to the toolbar. | ||
180 | * | ||
181 | * @param obj The toolbar object. | ||
182 | * @param icon A string with icon name or the absolute path of an image file. | ||
183 | * @param label The label of the item. | ||
184 | * @param func The function to call when the item is clicked. | ||
185 | * @param data The data to associate with the item for related callbacks. | ||
186 | * @return The created item or @c NULL upon failure. | ||
187 | * | ||
188 | * A new item will be created and prepended to the toolbar, i.e., will | ||
189 | * be set as @b first item. | ||
190 | * | ||
191 | * Items created with this method can be deleted with | ||
192 | * elm_object_item_del(). | ||
193 | * | ||
194 | * Associated @p data can be properly freed when item is deleted if a | ||
195 | * callback function is set with elm_object_item_del_cb_set(). | ||
196 | * | ||
197 | * If a function is passed as argument, it will be called every time this item | ||
198 | * is selected, i.e., the user clicks over an unselected item. | ||
199 | * If such function isn't needed, just passing | ||
200 | * @c NULL as @p func is enough. The same should be done for @p data. | ||
201 | * | ||
202 | * Toolbar will load icon image from fdo or current theme. | ||
203 | * This behavior can be set by elm_toolbar_icon_order_lookup_set() function. | ||
204 | * If an absolute path is provided it will load it direct from a file. | ||
205 | * | ||
206 | * @see elm_toolbar_item_icon_set() | ||
207 | * @see elm_object_item_del() | ||
208 | * | ||
209 | * @ingroup Toolbar | ||
210 | */ | ||
211 | EAPI Elm_Object_Item *elm_toolbar_item_prepend(Evas_Object *obj, const char *icon, const char *label, Evas_Smart_Cb func, const void *data); | ||
212 | |||
213 | /** | ||
214 | * Insert a new item into the toolbar object before item @p before. | ||
215 | * | ||
216 | * @param obj The toolbar object. | ||
217 | * @param before The toolbar item to insert before. | ||
218 | * @param icon A string with icon name or the absolute path of an image file. | ||
219 | * @param label The label of the item. | ||
220 | * @param func The function to call when the item is clicked. | ||
221 | * @param data The data to associate with the item for related callbacks. | ||
222 | * @return The created item or @c NULL upon failure. | ||
223 | * | ||
224 | * A new item will be created and added to the toolbar. Its position in | ||
225 | * this toolbar will be just before item @p before. | ||
226 | * | ||
227 | * Items created with this method can be deleted with | ||
228 | * elm_object_item_del(). | ||
229 | * | ||
230 | * Associated @p data can be properly freed when item is deleted if a | ||
231 | * callback function is set with elm_object_item_del_cb_set(). | ||
232 | * | ||
233 | * If a function is passed as argument, it will be called every time this item | ||
234 | * is selected, i.e., the user clicks over an unselected item. | ||
235 | * If such function isn't needed, just passing | ||
236 | * @c NULL as @p func is enough. The same should be done for @p data. | ||
237 | * | ||
238 | * Toolbar will load icon image from fdo or current theme. | ||
239 | * This behavior can be set by elm_toolbar_icon_order_lookup_set() function. | ||
240 | * If an absolute path is provided it will load it direct from a file. | ||
241 | * | ||
242 | * @see elm_toolbar_item_icon_set() | ||
243 | * @see elm_object_item_del() | ||
244 | * | ||
245 | * @ingroup Toolbar | ||
246 | */ | ||
247 | EAPI Elm_Object_Item *elm_toolbar_item_insert_before(Evas_Object *obj, Elm_Object_Item *before, const char *icon, const char *label, Evas_Smart_Cb func, const void *data); | ||
248 | |||
249 | /** | ||
250 | * Insert a new item into the toolbar object after item @p after. | ||
251 | * | ||
252 | * @param obj The toolbar object. | ||
253 | * @param after The toolbar item to insert after. | ||
254 | * @param icon A string with icon name or the absolute path of an image file. | ||
255 | * @param label The label of the item. | ||
256 | * @param func The function to call when the item is clicked. | ||
257 | * @param data The data to associate with the item for related callbacks. | ||
258 | * @return The created item or @c NULL upon failure. | ||
259 | * | ||
260 | * A new item will be created and added to the toolbar. Its position in | ||
261 | * this toolbar will be just after item @p after. | ||
262 | * | ||
263 | * Items created with this method can be deleted with | ||
264 | * elm_object_item_del(). | ||
265 | * | ||
266 | * Associated @p data can be properly freed when item is deleted if a | ||
267 | * callback function is set with elm_object_item_del_cb_set(). | ||
268 | * | ||
269 | * If a function is passed as argument, it will be called every time this item | ||
270 | * is selected, i.e., the user clicks over an unselected item. | ||
271 | * If such function isn't needed, just passing | ||
272 | * @c NULL as @p func is enough. The same should be done for @p data. | ||
273 | * | ||
274 | * Toolbar will load icon image from fdo or current theme. | ||
275 | * This behavior can be set by elm_toolbar_icon_order_lookup_set() function. | ||
276 | * If an absolute path is provided it will load it direct from a file. | ||
277 | * | ||
278 | * @see elm_toolbar_item_icon_set() | ||
279 | * @see elm_object_item_del() | ||
280 | * | ||
281 | * @ingroup Toolbar | ||
282 | */ | ||
283 | EAPI Elm_Object_Item *elm_toolbar_item_insert_after(Evas_Object *obj, Elm_Object_Item *after, const char *icon, const char *label, Evas_Smart_Cb func, const void *data); | ||
284 | |||
285 | /** | ||
286 | * Get the first item in the given toolbar widget's list of | ||
287 | * items. | ||
288 | * | ||
289 | * @param obj The toolbar object | ||
290 | * @return The first item or @c NULL, if it has no items (and on | ||
291 | * errors) | ||
292 | * | ||
293 | * @see elm_toolbar_item_append() | ||
294 | * @see elm_toolbar_last_item_get() | ||
295 | * | ||
296 | * @ingroup Toolbar | ||
297 | */ | ||
298 | EAPI Elm_Object_Item *elm_toolbar_first_item_get(const Evas_Object *obj); | ||
299 | |||
300 | /** | ||
301 | * Get the last item in the given toolbar widget's list of | ||
302 | * items. | ||
303 | * | ||
304 | * @param obj The toolbar object | ||
305 | * @return The last item or @c NULL, if it has no items (and on | ||
306 | * errors) | ||
307 | * | ||
308 | * @see elm_toolbar_item_prepend() | ||
309 | * @see elm_toolbar_first_item_get() | ||
310 | * | ||
311 | * @ingroup Toolbar | ||
312 | */ | ||
313 | EAPI Elm_Object_Item *elm_toolbar_last_item_get(const Evas_Object *obj); | ||
314 | |||
315 | /** | ||
316 | * Get the item after @p item in toolbar. | ||
317 | * | ||
318 | * @param it The toolbar item. | ||
319 | * @return The item after @p item, or @c NULL if none or on failure. | ||
320 | * | ||
321 | * @note If it is the last item, @c NULL will be returned. | ||
322 | * | ||
323 | * @see elm_toolbar_item_append() | ||
324 | * | ||
325 | * @ingroup Toolbar | ||
326 | */ | ||
327 | EAPI Elm_Object_Item *elm_toolbar_item_next_get(const Elm_Object_Item *it); | ||
328 | |||
329 | /** | ||
330 | * Get the item before @p item in toolbar. | ||
331 | * | ||
332 | * @param it The toolbar item. | ||
333 | * @return The item before @p item, or @c NULL if none or on failure. | ||
334 | * | ||
335 | * @note If it is the first item, @c NULL will be returned. | ||
336 | * | ||
337 | * @see elm_toolbar_item_prepend() | ||
338 | * | ||
339 | * @ingroup Toolbar | ||
340 | */ | ||
341 | EAPI Elm_Object_Item *elm_toolbar_item_prev_get(const Elm_Object_Item *it); | ||
342 | |||
343 | /** | ||
344 | * Set the priority of a toolbar item. | ||
345 | * | ||
346 | * @param it The toolbar item. | ||
347 | * @param priority The item priority. The default is zero. | ||
348 | * | ||
349 | * This is used only when the toolbar shrink mode is set to | ||
350 | * #ELM_TOOLBAR_SHRINK_MENU or #ELM_TOOLBAR_SHRINK_HIDE. | ||
351 | * When space is less than required, items with low priority | ||
352 | * will be removed from the toolbar and added to a dynamically-created menu, | ||
353 | * while items with higher priority will remain on the toolbar, | ||
354 | * with the same order they were added. | ||
355 | * | ||
356 | * @see elm_toolbar_item_priority_get() | ||
357 | * | ||
358 | * @ingroup Toolbar | ||
359 | */ | ||
360 | EAPI void elm_toolbar_item_priority_set(Elm_Object_Item *it, int priority); | ||
361 | |||
362 | /** | ||
363 | * Get the priority of a toolbar item. | ||
364 | * | ||
365 | * @param it The toolbar item. | ||
366 | * @return The @p item priority, or @c 0 on failure. | ||
367 | * | ||
368 | * @see elm_toolbar_item_priority_set() for details. | ||
369 | * | ||
370 | * @ingroup Toolbar | ||
371 | */ | ||
372 | EAPI int elm_toolbar_item_priority_get(const Elm_Object_Item *it); | ||
373 | |||
374 | /** | ||
375 | * Returns a pointer to a toolbar item by its label. | ||
376 | * | ||
377 | * @param obj The toolbar object. | ||
378 | * @param label The label of the item to find. | ||
379 | * | ||
380 | * @return The pointer to the toolbar item matching @p label or @c NULL | ||
381 | * on failure. | ||
382 | * | ||
383 | * @ingroup Toolbar | ||
384 | */ | ||
385 | EAPI Elm_Object_Item *elm_toolbar_item_find_by_label(const Evas_Object *obj, const char *label); | ||
386 | |||
387 | /* | ||
388 | * Get whether the @p item is selected or not. | ||
389 | * | ||
390 | * @param it The toolbar item. | ||
391 | * @return @c EINA_TRUE means item is selected. @c EINA_FALSE indicates | ||
392 | * it's not. If @p obj is @c NULL, @c EINA_FALSE is returned. | ||
393 | * | ||
394 | * @see elm_toolbar_selected_item_set() for details. | ||
395 | * @see elm_toolbar_item_selected_get() | ||
396 | * | ||
397 | * @ingroup Toolbar | ||
398 | */ | ||
399 | EAPI Eina_Bool elm_toolbar_item_selected_get(const Elm_Object_Item *it); | ||
400 | |||
401 | /** | ||
402 | * Set the selected state of an item. | ||
403 | * | ||
404 | * @param it The toolbar item | ||
405 | * @param selected The selected state | ||
406 | * | ||
407 | * This sets the selected state of the given item @p it. | ||
408 | * @c EINA_TRUE for selected, @c EINA_FALSE for not selected. | ||
409 | * | ||
410 | * If a new item is selected the previously selected will be unselected. | ||
411 | * Previously selected item can be get with function | ||
412 | * elm_toolbar_selected_item_get(). | ||
413 | * | ||
414 | * Selected items will be highlighted. | ||
415 | * | ||
416 | * @see elm_toolbar_item_selected_get() | ||
417 | * @see elm_toolbar_selected_item_get() | ||
418 | * | ||
419 | * @ingroup Toolbar | ||
420 | */ | ||
421 | EAPI void elm_toolbar_item_selected_set(Elm_Object_Item *it, Eina_Bool selected); | ||
422 | |||
423 | /** | ||
424 | * Get the selected item. | ||
425 | * | ||
426 | * @param obj The toolbar object. | ||
427 | * @return The selected toolbar item. | ||
428 | * | ||
429 | * The selected item can be unselected with function | ||
430 | * elm_toolbar_item_selected_set(). | ||
431 | * | ||
432 | * The selected item always will be highlighted on toolbar. | ||
433 | * | ||
434 | * @see elm_toolbar_selected_items_get() | ||
435 | * | ||
436 | * @ingroup Toolbar | ||
437 | */ | ||
438 | EAPI Elm_Object_Item *elm_toolbar_selected_item_get(const Evas_Object *obj); | ||
439 | |||
440 | /** | ||
441 | * Set the icon associated with @p item. | ||
442 | * | ||
443 | * @param it The toolbar item. | ||
444 | * @param icon A string with icon name or the absolute path of an image file. | ||
445 | * | ||
446 | * Toolbar will load icon image from fdo or current theme. | ||
447 | * This behavior can be set by elm_toolbar_icon_order_lookup_set() function. | ||
448 | * If an absolute path is provided it will load it direct from a file. | ||
449 | * | ||
450 | * @see elm_toolbar_icon_order_lookup_set() | ||
451 | * @see elm_toolbar_icon_order_lookup_get() | ||
452 | * | ||
453 | * @ingroup Toolbar | ||
454 | */ | ||
455 | EAPI void elm_toolbar_item_icon_set(Elm_Object_Item *it, const char *icon); | ||
456 | |||
457 | /** | ||
458 | * Get the string used to set the icon of @p item. | ||
459 | * | ||
460 | * @param it The toolbar item. | ||
461 | * @return The string associated with the icon object. | ||
462 | * | ||
463 | * @see elm_toolbar_item_icon_set() for details. | ||
464 | * | ||
465 | * @ingroup Toolbar | ||
466 | */ | ||
467 | EAPI const char *elm_toolbar_item_icon_get(const Elm_Object_Item *it); | ||
468 | |||
469 | /** | ||
470 | * Get the object of @p item. | ||
471 | * | ||
472 | * @param it The toolbar item. | ||
473 | * @return The object | ||
474 | * | ||
475 | * @ingroup Toolbar | ||
476 | */ | ||
477 | EAPI Evas_Object *elm_toolbar_item_object_get(const Elm_Object_Item *it); | ||
478 | |||
479 | /** | ||
480 | * Get the icon object of @p item. | ||
481 | * | ||
482 | * @param it The toolbar item. | ||
483 | * @return The icon object | ||
484 | * | ||
485 | * @see elm_toolbar_item_icon_set(), elm_toolbar_item_icon_file_set(), | ||
486 | * or elm_toolbar_item_icon_memfile_set() for details. | ||
487 | * | ||
488 | * @ingroup Toolbar | ||
489 | */ | ||
490 | EAPI Evas_Object *elm_toolbar_item_icon_object_get(Elm_Object_Item *it); | ||
491 | |||
492 | /** | ||
493 | * Set the icon associated with @p item to an image in a binary buffer. | ||
494 | * | ||
495 | * @param it The toolbar item. | ||
496 | * @param img The binary data that will be used as an image | ||
497 | * @param size The size of binary data @p img | ||
498 | * @param format Optional format of @p img to pass to the image loader | ||
499 | * @param key Optional key of @p img to pass to the image loader (eg. if @p img is an edje file) | ||
500 | * | ||
501 | * @return (@c EINA_TRUE = success, @c EINA_FALSE = error) | ||
502 | * | ||
503 | * @note The icon image set by this function can be changed by | ||
504 | * elm_toolbar_item_icon_set(). | ||
505 | * | ||
506 | * @ingroup Toolbar | ||
507 | */ | ||
508 | EAPI Eina_Bool elm_toolbar_item_icon_memfile_set(Elm_Object_Item *it, const void *img, size_t size, const char *format, const char *key); | ||
509 | |||
510 | /** | ||
511 | * Set the icon associated with @p item to an image in a binary buffer. | ||
512 | * | ||
513 | * @param it The toolbar item. | ||
514 | * @param file The file that contains the image | ||
515 | * @param key Optional key of @p img to pass to the image loader (eg. if @p img is an edje file) | ||
516 | * | ||
517 | * @return (@c EINA_TRUE = success, @c EINA_FALSE = error) | ||
518 | * | ||
519 | * @note The icon image set by this function can be changed by | ||
520 | * elm_toolbar_item_icon_set(). | ||
521 | * | ||
522 | * @ingroup Toolbar | ||
523 | */ | ||
524 | EAPI Eina_Bool elm_toolbar_item_icon_file_set(Elm_Object_Item *it, const char *file, const char *key); | ||
525 | |||
526 | /** | ||
527 | * Set or unset item as a separator. | ||
528 | * | ||
529 | * @param it The toolbar item. | ||
530 | * @param separator @c EINA_TRUE to set item @p item as separator or | ||
531 | * @c EINA_FALSE to unset, i.e., item will be used as a regular item. | ||
532 | * | ||
533 | * Items aren't set as separator by default. | ||
534 | * | ||
535 | * If set as separator it will display separator theme, so won't display | ||
536 | * icons or label. | ||
537 | * | ||
538 | * @see elm_toolbar_item_separator_get() | ||
539 | * | ||
540 | * @ingroup Toolbar | ||
541 | */ | ||
542 | EAPI void elm_toolbar_item_separator_set(Elm_Object_Item *it, Eina_Bool separator); | ||
543 | |||
544 | /** | ||
545 | * Get a value whether item is a separator or not. | ||
546 | * | ||
547 | * @param it The toolbar item. | ||
548 | * @return @c EINA_TRUE means item @p it is a separator. @c EINA_FALSE | ||
549 | * indicates it's not. If @p it is @c NULL, @c EINA_FALSE is returned. | ||
550 | * | ||
551 | * @see elm_toolbar_item_separator_set() for details. | ||
552 | * | ||
553 | * @ingroup Toolbar | ||
554 | */ | ||
555 | EAPI Eina_Bool elm_toolbar_item_separator_get(const Elm_Object_Item *it); | ||
556 | |||
557 | /** | ||
558 | * Set the shrink state of toolbar @p obj. | ||
559 | * | ||
560 | * @param obj The toolbar object. | ||
561 | * @param shrink_mode Toolbar's items display behavior. | ||
562 | * | ||
563 | * The toolbar won't scroll if #ELM_TOOLBAR_SHRINK_NONE, | ||
564 | * but will enforce a minimum size so all the items will fit, won't scroll | ||
565 | * and won't show the items that don't fit if #ELM_TOOLBAR_SHRINK_HIDE, | ||
566 | * will scroll if #ELM_TOOLBAR_SHRINK_SCROLL, and will create a button to | ||
567 | * pop up excess elements with #ELM_TOOLBAR_SHRINK_MENU. | ||
568 | * | ||
569 | * @ingroup Toolbar | ||
570 | */ | ||
571 | EAPI void elm_toolbar_shrink_mode_set(Evas_Object *obj, Elm_Toolbar_Shrink_Mode shrink_mode); | ||
572 | |||
573 | /** | ||
574 | * Get the shrink mode of toolbar @p obj. | ||
575 | * | ||
576 | * @param obj The toolbar object. | ||
577 | * @return Toolbar's items display behavior. | ||
578 | * | ||
579 | * @see elm_toolbar_shrink_mode_set() for details. | ||
580 | * | ||
581 | * @ingroup Toolbar | ||
582 | */ | ||
583 | EAPI Elm_Toolbar_Shrink_Mode elm_toolbar_shrink_mode_get(const Evas_Object *obj); | ||
584 | |||
585 | /** | ||
586 | * Enable/disable homogeneous mode. | ||
587 | * | ||
588 | * @param obj The toolbar object | ||
589 | * @param homogeneous Assume the items within the toolbar are of the | ||
590 | * same size (EINA_TRUE = on, EINA_FALSE = off). Default is @c EINA_FALSE. | ||
591 | * | ||
592 | * This will enable the homogeneous mode where items are of the same size. | ||
593 | * @see elm_toolbar_homogeneous_get() | ||
594 | * | ||
595 | * @ingroup Toolbar | ||
596 | */ | ||
597 | EAPI void elm_toolbar_homogeneous_set(Evas_Object *obj, Eina_Bool homogeneous); | ||
598 | |||
599 | /** | ||
600 | * Get whether the homogeneous mode is enabled. | ||
601 | * | ||
602 | * @param obj The toolbar object. | ||
603 | * @return Assume the items within the toolbar are of the same height | ||
604 | * and width (EINA_TRUE = on, EINA_FALSE = off). | ||
605 | * | ||
606 | * @see elm_toolbar_homogeneous_set() | ||
607 | * | ||
608 | * @ingroup Toolbar | ||
609 | */ | ||
610 | EAPI Eina_Bool elm_toolbar_homogeneous_get(const Evas_Object *obj); | ||
611 | |||
612 | /** | ||
613 | * Set the parent object of the toolbar items' menus. | ||
614 | * | ||
615 | * @param obj The toolbar object. | ||
616 | * @param parent The parent of the menu objects. | ||
617 | * | ||
618 | * Each item can be set as item menu, with elm_toolbar_item_menu_set(). | ||
619 | * | ||
620 | * For more details about setting the parent for toolbar menus, see | ||
621 | * elm_menu_parent_set(). | ||
622 | * | ||
623 | * @see elm_menu_parent_set() for details. | ||
624 | * @see elm_toolbar_item_menu_set() for details. | ||
625 | * | ||
626 | * @ingroup Toolbar | ||
627 | */ | ||
628 | EAPI void elm_toolbar_menu_parent_set(Evas_Object *obj, Evas_Object *parent); | ||
629 | |||
630 | /** | ||
631 | * Get the parent object of the toolbar items' menus. | ||
632 | * | ||
633 | * @param obj The toolbar object. | ||
634 | * @return The parent of the menu objects. | ||
635 | * | ||
636 | * @see elm_toolbar_menu_parent_set() for details. | ||
637 | * | ||
638 | * @ingroup Toolbar | ||
639 | */ | ||
640 | EAPI Evas_Object *elm_toolbar_menu_parent_get(const Evas_Object *obj); | ||
641 | |||
642 | /** | ||
643 | * Set the alignment of the items. | ||
644 | * | ||
645 | * @param obj The toolbar object. | ||
646 | * @param align The new alignment, a float between <tt> 0.0 </tt> | ||
647 | * and <tt> 1.0 </tt>. | ||
648 | * | ||
649 | * Alignment of toolbar items, from <tt> 0.0 </tt> to indicates to align | ||
650 | * left, to <tt> 1.0 </tt>, to align to right. <tt> 0.5 </tt> centralize | ||
651 | * items. | ||
652 | * | ||
653 | * Centered items by default. | ||
654 | * | ||
655 | * @see elm_toolbar_align_get() | ||
656 | * | ||
657 | * @ingroup Toolbar | ||
658 | */ | ||
659 | EAPI void elm_toolbar_align_set(Evas_Object *obj, double align); | ||
660 | |||
661 | /** | ||
662 | * Get the alignment of the items. | ||
663 | * | ||
664 | * @param obj The toolbar object. | ||
665 | * @return toolbar items alignment, a float between <tt> 0.0 </tt> and | ||
666 | * <tt> 1.0 </tt>. | ||
667 | * | ||
668 | * @see elm_toolbar_align_set() for details. | ||
669 | * | ||
670 | * @ingroup Toolbar | ||
671 | */ | ||
672 | EAPI double elm_toolbar_align_get(const Evas_Object *obj); | ||
673 | |||
674 | /** | ||
675 | * Set whether the toolbar item opens a menu. | ||
676 | * | ||
677 | * @param it The toolbar item. | ||
678 | * @param menu If @c EINA_TRUE, @p item will opens a menu when selected. | ||
679 | * | ||
680 | * A toolbar item can be set to be a menu, using this function. | ||
681 | * | ||
682 | * Once it is set to be a menu, it can be manipulated through the | ||
683 | * menu-like function elm_toolbar_menu_parent_set() and the other | ||
684 | * elm_menu functions, using the Evas_Object @c menu returned by | ||
685 | * elm_toolbar_item_menu_get(). | ||
686 | * | ||
687 | * So, items to be displayed in this item's menu should be added with | ||
688 | * elm_menu_item_add(). | ||
689 | * | ||
690 | * The following code exemplifies the most basic usage: | ||
691 | * @code | ||
692 | * tb = elm_toolbar_add(win) | ||
693 | * item = elm_toolbar_item_append(tb, "refresh", "Menu", NULL, NULL); | ||
694 | * elm_toolbar_item_menu_set(item, EINA_TRUE); | ||
695 | * elm_toolbar_menu_parent_set(tb, win); | ||
696 | * menu = elm_toolbar_item_menu_get(item); | ||
697 | * elm_menu_item_add(menu, NULL, "edit-cut", "Cut", NULL, NULL); | ||
698 | * menu_item = elm_menu_item_add(menu, NULL, "edit-copy", "Copy", NULL, | ||
699 | * NULL); | ||
700 | * @endcode | ||
701 | * | ||
702 | * @see elm_toolbar_item_menu_get() | ||
703 | * | ||
704 | * @ingroup Toolbar | ||
705 | */ | ||
706 | EAPI void elm_toolbar_item_menu_set(Elm_Object_Item *it, Eina_Bool menu); | ||
707 | |||
708 | /** | ||
709 | * Get toolbar item's menu. | ||
710 | * | ||
711 | * @param it The toolbar item. | ||
712 | * @return Item's menu object or @c NULL on failure. | ||
713 | * | ||
714 | * If @p item wasn't set as menu item with elm_toolbar_item_menu_set(), | ||
715 | * this function will set it. | ||
716 | * | ||
717 | * @see elm_toolbar_item_menu_set() for details. | ||
718 | * | ||
719 | * @ingroup Toolbar | ||
720 | */ | ||
721 | EAPI Evas_Object *elm_toolbar_item_menu_get(const Elm_Object_Item *it); | ||
722 | |||
723 | /** | ||
724 | * Add a new state to @p item. | ||
725 | * | ||
726 | * @param it The toolbar item. | ||
727 | * @param icon A string with icon name or the absolute path of an image file. | ||
728 | * @param label The label of the new state. | ||
729 | * @param func The function to call when the item is clicked when this | ||
730 | * state is selected. | ||
731 | * @param data The data to associate with the state. | ||
732 | * @return The toolbar item state, or @c NULL upon failure. | ||
733 | * | ||
734 | * Toolbar will load icon image from fdo or current theme. | ||
735 | * This behavior can be set by elm_toolbar_icon_order_lookup_set() function. | ||
736 | * If an absolute path is provided it will load it direct from a file. | ||
737 | * | ||
738 | * States created with this function can be removed with | ||
739 | * elm_toolbar_item_state_del(). | ||
740 | * | ||
741 | * @see elm_toolbar_item_state_del() | ||
742 | * @see elm_toolbar_item_state_sel() | ||
743 | * @see elm_toolbar_item_state_get() | ||
744 | * | ||
745 | * @ingroup Toolbar | ||
746 | */ | ||
747 | EAPI Elm_Toolbar_Item_State *elm_toolbar_item_state_add(Elm_Object_Item *it, const char *icon, const char *label, Evas_Smart_Cb func, const void *data); | ||
748 | |||
749 | /** | ||
750 | * Delete a previously added state to @p item. | ||
751 | * | ||
752 | * @param it The toolbar item. | ||
753 | * @param state The state to be deleted. | ||
754 | * @return @c EINA_TRUE on success or @c EINA_FALSE on failure. | ||
755 | * | ||
756 | * @see elm_toolbar_item_state_add() | ||
757 | */ | ||
758 | EAPI Eina_Bool elm_toolbar_item_state_del(Elm_Object_Item *it, Elm_Toolbar_Item_State *state); | ||
759 | |||
760 | /** | ||
761 | * Set @p state as the current state of @p it. | ||
762 | * | ||
763 | * @param it The toolbar item. | ||
764 | * @param state The state to use. | ||
765 | * @return @c EINA_TRUE on success or @c EINA_FALSE on failure. | ||
766 | * | ||
767 | * If @p state is @c NULL, it won't select any state and the default item's | ||
768 | * icon and label will be used. It's the same behaviour than | ||
769 | * elm_toolbar_item_state_unset(). | ||
770 | * | ||
771 | * @see elm_toolbar_item_state_unset() | ||
772 | * | ||
773 | * @ingroup Toolbar | ||
774 | */ | ||
775 | EAPI Eina_Bool elm_toolbar_item_state_set(Elm_Object_Item *it, Elm_Toolbar_Item_State *state); | ||
776 | |||
777 | /** | ||
778 | * Unset the state of @p it. | ||
779 | * | ||
780 | * @param it The toolbar item. | ||
781 | * | ||
782 | * The default icon and label from this item will be displayed. | ||
783 | * | ||
784 | * @see elm_toolbar_item_state_set() for more details. | ||
785 | * | ||
786 | * @ingroup Toolbar | ||
787 | */ | ||
788 | EAPI void elm_toolbar_item_state_unset(Elm_Object_Item *it); | ||
789 | |||
790 | /** | ||
791 | * Get the current state of @p it. | ||
792 | * | ||
793 | * @param it The toolbar item. | ||
794 | * @return The selected state or @c NULL if none is selected or on failure. | ||
795 | * | ||
796 | * @see elm_toolbar_item_state_set() for details. | ||
797 | * @see elm_toolbar_item_state_unset() | ||
798 | * @see elm_toolbar_item_state_add() | ||
799 | * | ||
800 | * @ingroup Toolbar | ||
801 | */ | ||
802 | EAPI Elm_Toolbar_Item_State *elm_toolbar_item_state_get(const Elm_Object_Item *it); | ||
803 | |||
804 | /** | ||
805 | * Get the state after selected state in toolbar's @p item. | ||
806 | * | ||
807 | * @param it The toolbar item to change state. | ||
808 | * @return The state after current state, or @c NULL on failure. | ||
809 | * | ||
810 | * If last state is selected, this function will return first state. | ||
811 | * | ||
812 | * @see elm_toolbar_item_state_set() | ||
813 | * @see elm_toolbar_item_state_add() | ||
814 | * | ||
815 | * @ingroup Toolbar | ||
816 | */ | ||
817 | EAPI Elm_Toolbar_Item_State *elm_toolbar_item_state_next(Elm_Object_Item *it); | ||
818 | |||
819 | /** | ||
820 | * Get the state before selected state in toolbar's @p item. | ||
821 | * | ||
822 | * @param it The toolbar item to change state. | ||
823 | * @return The state before current state, or @c NULL on failure. | ||
824 | * | ||
825 | * If first state is selected, this function will return last state. | ||
826 | * | ||
827 | * @see elm_toolbar_item_state_set() | ||
828 | * @see elm_toolbar_item_state_add() | ||
829 | * | ||
830 | * @ingroup Toolbar | ||
831 | */ | ||
832 | EAPI Elm_Toolbar_Item_State *elm_toolbar_item_state_prev(Elm_Object_Item *it); | ||
833 | |||
834 | |||
835 | /** | ||
836 | * Change a toolbar's orientation | ||
837 | * @param obj The toolbar object | ||
838 | * @param horizontal If @c EINA_TRUE, the toolbar is horizontal | ||
839 | * By default, a toolbar will be horizontal. Use this function to create a vertical toolbar. | ||
840 | * @ingroup Toolbar | ||
841 | */ | ||
842 | EAPI void elm_toolbar_horizontal_set(Evas_Object *obj, Eina_Bool horizontal); | ||
843 | |||
844 | /** | ||
845 | * Get a toolbar's orientation | ||
846 | * @param obj The toolbar object | ||
847 | * @return If @c EINA_TRUE, the toolbar is horizontal | ||
848 | * By default, a toolbar will be horizontal. Use this function to determine whether a toolbar is vertical. | ||
849 | * @ingroup Toolbar | ||
850 | */ | ||
851 | EAPI Eina_Bool elm_toolbar_horizontal_get(const Evas_Object *obj); | ||
852 | |||
853 | /** | ||
854 | * Get the number of items in a toolbar | ||
855 | * @param obj The toolbar object | ||
856 | * @return The number of items in @p obj toolbar | ||
857 | * @ingroup Toolbar | ||
858 | */ | ||
859 | EAPI unsigned int elm_toolbar_items_count(const Evas_Object *obj); | ||
860 | |||
861 | /** | ||
862 | * Set the toolbar select mode. | ||
863 | * | ||
864 | * @param obj The toolbar object | ||
865 | * @param mode The select mode | ||
866 | * | ||
867 | * elm_toolbar_select_mode_set() changes item select mode in the toolbar widget. | ||
868 | * - ELM_OBJECT_SELECT_MODE_DEFAULT : Items will only call their selection func and | ||
869 | * callback when first becoming selected. Any further clicks will | ||
870 | * do nothing, unless you set always select mode. | ||
871 | * - ELM_OBJECT_SELECT_MODE_ALWAYS : This means that, even if selected, | ||
872 | * every click will make the selected callbacks be called. | ||
873 | * - ELM_OBJECT_SELECT_MODE_NONE : This will turn off the ability to select items | ||
874 | * entirely and they will neither appear selected nor call selected | ||
875 | * callback functions. | ||
876 | * | ||
877 | * @see elm_toolbar_select_mode_get() | ||
878 | * | ||
879 | * @ingroup Toolbar | ||
880 | */ | ||
881 | EAPI void | ||
882 | elm_toolbar_select_mode_set(Evas_Object *obj, Elm_Object_Select_Mode mode); | ||
883 | |||
884 | /** | ||
885 | * Get the toolbar select mode. | ||
886 | * | ||
887 | * @param obj The toolbar object | ||
888 | * @return The select mode | ||
889 | * (If getting mode is failed, it returns ELM_OBJECT_SELECT_MODE_MAX) | ||
890 | * | ||
891 | * @see elm_toolbar_select_mode_set() | ||
892 | * | ||
893 | * @ingroup Toolbar | ||
894 | */ | ||
895 | EAPI Elm_Object_Select_Mode | ||
896 | elm_toolbar_select_mode_get(const Evas_Object *obj); | ||
897 | |||
898 | /** | ||
899 | * @} | ||
900 | */ | ||