efl

Форк
0
/
elementary_examples.dox 
6879 строк · 241.9 Кб
1
/**
2
 * @page Examples Examples
3
 *
4
 * Here is a list of all Elementary examples.
5
 *
6
 * @ref bg_01_example_page
7
 *
8
 * @ref bg_02_example_page
9
 *
10
 * @ref bg_03_example_page
11
 *
12
 * @ref actionslider_example_page
13
 *
14
 * @ref transit_example_01_explained
15
 *
16
 * @ref transit_example_02_explained
17
 *
18
 * @ref general_functions_example_page
19
 *
20
 * @ref calendar_example_01
21
 *
22
 * @ref calendar_example_02
23
 *
24
 * @ref calendar_example_03
25
 *
26
 * @ref calendar_example_04
27
 *
28
 * @ref calendar_example_05
29
 *
30
 * @ref calendar_example_06
31
 *
32
 * @ref combobox_example_01
33
 *
34
 * @ref spinner_example
35
 *
36
 * @ref slider_example
37
 *
38
 * @ref panes_example
39
 *
40
 * @ref clock_example
41
 *
42
 * @ref datetime_example
43
 *
44
 * @ref dayselector_example
45
 *
46
 * @ref mapbuf_example
47
 *
48
 * @ref map_example_01
49
 *
50
 * @ref map_example_02
51
 *
52
 * @ref map_example_03
53
 *
54
 * @ref diskselector_example_01
55
 *
56
 * @ref diskselector_example_02
57
 *
58
 * @ref entry_example
59
 *
60
 * @ref list_example_01
61
 *
62
 * @ref list_example_02
63
 *
64
 * @ref list_example_03
65
 *
66
 * @ref toolbar_example_01
67
 *
68
 * @ref toolbar_example_02
69
 *
70
 * @ref toolbar_example_03
71
 *
72
 * @ref segment_control_example
73
 *
74
 * @ref flipselector_example
75
 *
76
 * @ref fileselector_example
77
 *
78
 * @ref fileselector_button_example
79
 *
80
 * @ref fileselector_entry_example
81
 *
82
 * @ref index_example_01
83
 *
84
 * @ref index_example_02
85
 *
86
 * @ref gengrid_example
87
 *
88
 * @ref genlist_example_01
89
 *
90
 * @ref genlist_example_02
91
 *
92
 * @ref genlist_example_03
93
 *
94
 * @ref genlist_example_04
95
 *
96
 * @ref genlist_example_05
97
 *
98
 * @ref glview_example_01_page
99
 *
100
 * @ref thumb_example_01
101
 *
102
 * @ref progressbar_example
103
 *
104
 * @ref slideshow_example
105
 *
106
 * @ref efl_thread_1
107
 *
108
 * @ref efl_thread_2
109
 *
110
 * @ref efl_thread_3
111
 *
112
 * @ref efl_thread_4
113
 *
114
 * @ref efl_thread_5
115
 *
116
 * @ref efl_thread_6
117
 *
118
 * @ref prefs_example_01
119
 *
120
 * @ref prefs_example_02
121
 *
122
 * @ref prefs_example_03
123
 */
124

125
/**
126
 * @page bg_01_example_page elm_bg - Plain color background.
127
 * @dontinclude bg_example_01.c
128
 *
129
 * The full code for this example can be found at @ref bg_example_01_c,
130
 * in the function @c test_bg_plain. It's part of the @c elementary_test
131
 * suite, and thus has the code for the three examples referenced by this
132
 * documentation.
133
 *
134
 * This first example just sets a default background with a plain color. The
135
 * first part consists of creating an Elementary window. It's the common
136
 * piece of code that you'll see everywhere in Elementary: @skip elm_main
137
 * @until autodel_set
138
 *
139
 * Now we really create our background object, using the window object as
140
 * its parent:
141
 *
142
 * @skipline bg_add
143
 *
144
 * Then we set the size hints of the background object so that it will use
145
 * all space available for it, and then add it as a resize object to the
146
 * window, making it visible in the end:
147
 *
148
 * @skip size_hint_weight_set
149
 * @until resize_object_add
150
 *
151
 * See evas_object_size_hint_weight_set() and elm_win_resize_object_add()
152
 * for more detailed info about these functions.
153
 *
154
 * The end of the example is quite simple, just setting the minimum and
155
 * maximum size of the background, so the Elementary window knows that it
156
 * has to have at least the minimum size. The background also won't scale to
157
 * a size above its maximum. Then we resize the window and show it in the
158
 * end:
159
 *
160
 * @skip set size hints
161
 * @until }
162
 *
163
 * And here we finish our very simple background object usage example.
164
 */
165

166
/**
167
 * @page bg_02_example_page elm_bg - Image background.
168
 * @dontinclude bg_example_02.c
169
 *
170
 * The full code for this example can be found at @ref bg_example_02_c,
171
 * in the function @c test_bg_image. It's part of the @c elementary_test
172
 * suite, and thus has the code for the three examples referenced by this
173
 * documentation.
174
 *
175
 * This is the second example, and shows how to use the Elementary
176
 * background object to set an image as background of your application.
177
 *
178
 * We start this example exactly in the same way as the previous one, even
179
 * when creating the background object:
180
 *
181
 * @skip elm_main
182
 * @until bg_add
183
 *
184
 * Now it's the different part.
185
 *
186
 * Our background will have an image, that will be displayed over the
187
 * background color. Before loading the image, we set the load size of the
188
 * image. The load size is a hint about the size that we want the image
189
 * displayed in the screen. It's not the exact size that the image will have,
190
 * but usually a bit bigger. The background object can still be scaled to a
191
 * size bigger than the one set here. Setting the image load size to
192
 * something smaller than its real size will reduce the memory used to keep
193
 * the pixmap representation of the image, and the time to load it. Here we
194
 * set the load size to 20x20 pixels, but the image is loaded with a size
195
 * bigger than that (since it's just a hint):
196
 *
197
 * @skipline load_size_set
198
 *
199
 * And set our background image to be centered, instead of stretched or
200
 * scaled, so the effect of the elm_bg_load_size_set() can be easily
201
 * understood:
202
 *
203
 * @skipline option_set
204
 *
205
 * We need a filename to set, so we get one from the previous installed
206
 * images in the @c PACKAGE_DATA_DIR, and write its full path to a buffer.
207
 * Then we use this buffer to set the filename in the background object:
208
 *
209
 * @skip snprintf
210
 * @until bg_file_set
211
 *
212
 * Notice that the third argument of the elm_bg_file_set() function is @c
213
 * NULL, since we are setting an image to this background. This function
214
 * also supports setting an edje group as background, in which case the @c
215
 * group parameter wouldn't be @c NULL, but be the name of the group
216
 * instead.
217
 *
218
 * Finally, we can set the size hints, add the background as a resize
219
 * object, and resize the window, exactly the same thing we do in the @ref
220
 * bg_01_example_page example:
221
 *
222
 * @skip size_hint
223
 * @until }
224
 *
225
 * And this is the end of this example.
226
 *
227
 * This example will look like this:
228
 *
229
 * @image html screenshots/bg_01.png
230
 * @image latex screenshots/bg_01.eps width=\textwidth
231
 */
232

233
/**
234
 * @page bg_03_example_page elm_bg - Background properties.
235
 * @dontinclude bg_example_03.c
236
 *
237
 * The full code for this example can be found at @ref bg_example_03_c, in the
238
 * function @c test_bg_options, with the callbacks @c _cb_overlay_changed, @c
239
 * _cb_color_changed and @c _cb_radio_changed defined in the beginning of the
240
 * file. It's part of the @c elementary_test suite, and thus has the code for
241
 * the three examples referenced by this documentation.
242
 *
243
 * This example will show the properties available for the background object,
244
 * and will use of some more widgets to set them.
245
 *
246
 * In order to do this, we will set some callbacks for these widgets. The
247
 * first is for the radio buttons that will be used to choose the option
248
 * passed as argument to elm_bg_option_set():
249
 *
250
 * @skip _cb_radio_changed
251
 * @until }
252
 *
253
 * The next callback will be used when setting the overlay (using
254
 * elm_object_content_set()):
255
 *
256
 * @skip _cb_overlay_changed
257
 * @until }
258
 * @until }
259
 *
260
 * And the last one, used to set the color (with elm_bg_color_set()):
261
 *
262
 * @skip _cb_color_changed
263
 * @until }
264
 *
265
 * We will get back to what these functions do soon. If you want to know more
266
 * about how to set these callbacks and what these widgets are, look for:
267
 * @li elm_radio_add()
268
 * @li elm_check_add()
269
 * @li elm_spinner_add()
270
 *
271
 * Now going to the main function, @c test_bg_options, we have the common
272
 * code with the other examples:
273
 *
274
 * @skip bg-options
275
 * @until autodel_set
276
 *
277
 * We add a plain background to this window, so it will have the default
278
 * background color behind everything:
279
 *
280
 * @skip bg = elm_bg_add
281
 * @until evas_object_show(bg)
282
 *
283
 * Then we add a vertical box (elm_box_add()) that will hold the background
284
 * object that we are going to play with, as well as a horizontal box that
285
 * will hold widgets:
286
 *
287
 * @skip elm_box_add
288
 * @until evas_object_show
289
 *
290
 * Now we add the background object that is going to be of use for our
291
 * example. It is an image background, as used in @ref bg_02_example_page ,
292
 * so the code should be familiar:
293
 *
294
 * @skip elm_bg_add
295
 * @until evas_object_show
296
 *
297
 * Notice the call to elm_box_pack_end(): it will pack the background object
298
 * in the end of the Elementary box declared above. Just refer to that
299
 * documentation for more info.
300
 *
301
 * Since this Elementary background is already an image background, we are
302
 * going to play with its other properties. We will change its option
303
 * (CENTER, SCALE, STRETCH, TILE), its color (RGB), and add an overlay to it.
304
 * For all of these properties, we are going to add widgets that will
305
 * configure them.
306
 *
307
 * First, lets add the horizontal box that will hold these widgets:
308
 * @skip hbox
309
 * @until align_set
310
 *
311
 * For now, just consider this @c hbox as a rectangle that will contain the
312
 * widgets, and will distribute them horizontally inside its content. Then we
313
 * add radio buttons that will allow us to choose the property to use with
314
 * this background:
315
 *
316
 * @skip radio_add
317
 * @until evas_object_show
318
 *
319
 * Again, I won't give details about the use of these widgets, just look for
320
 * their documentation if necessary. It's enough to know for now that we are
321
 * packing them in the @c hbox, setting a label for them, and the most
322
 * important parts: setting its value to @c ELM_BG_OPTION_CENTER and its
323
 * callback to @c _cb_radio_changed (the function defined in the beginning of
324
 * this example). We do this for the next 3 radio buttons added after this
325
 * one, each of them with a different value.
326
 *
327
 * Now taking a look at the code of the callback @c _cb_radio_changed again,
328
 * it will call elm_bg_option_set() with the value set from the checked radio
329
 * button, thus setting the option for this background. The background is
330
 * passed as argument to the @p data parameter of this callback, and is
331
 * referenced here as @c o_bg.
332
 *
333
 * Later we set the default value for this radio button:
334
 *
335
 * @skipline elm_radio_value_set
336
 *
337
 * Then we add a checkbox for the elm_object_content_set() function for the bg:
338
 *
339
 * @skip check_add
340
 * @until evas_object_show
341
 *
342
 * Now look at the code of the @c _cb_overlay_changed again. If the checkbox
343
 * state is checked, an overlay will be added to the background. It's done by
344
 * creating an Edje object, and setting it with elm_object_content_set() to the
345
 * background object. For information about what are and how to set Edje
346
 * object, look at the Edje documentation.
347
 *
348
 * Finally we add a spinner object (elm_spinner_add()) to be used to select
349
 * the color of our background. In its callback it's possible to see the call
350
 * to elm_bg_color_set(), which will change the color of this background.
351
 * This color is used by the background to fill areas where the image doesn't
352
 * cover (in this case, where we have an image background). The spinner is
353
 * also packed into the @c hbox :
354
 *
355
 * @skip elm_spinner_add
356
 * @until evas_object_show
357
 *
358
 * Then we just have to pack the @c hbox inside the @c box, set some size
359
 * hints, and show our window:
360
 *
361
 * @skip pack_end
362
 * @until }
363
 *
364
 * Now to see this code in action, open elementary_test, and go to the "Bg
365
 * Options" test. It should demonstrate what was implemented here.
366
 */
367

368
/**
369
 * @page actionslider_example_page Actionslider usage
370
 * @dontinclude actionslider_example_01.c
371
 *
372
 * For this example we are going to assume knowledge of evas smart callbacks
373
 * and some basic evas object functions. Elementary is not meant to be used
374
 * without evas, if you're not yet familiar with evas it probably is worth
375
 * checking that out.
376
 *
377
 * And now to the example, when using Elementary we start by including
378
 * Elementary.h:
379
 * @skipline #include
380
 *
381
 * Next we define some callbacks, they all share the same signature because
382
 * they are all to be used with evas_object_smart_callback_add().
383
 * The first one just prints the selected label(in two different ways):
384
 * @until }
385
 *
386
 * This next callback is a little more interesting, it makes the selected
387
 * label magnetic(except if it's the center label):
388
 * @until }
389
 *
390
 * This callback enables or disables the magnetic property of the center
391
 * label:
392
 * @until }
393
 *
394
 * And finally a callback to stop the main loop when the window is closed:
395
 * @until }
396
 *
397
 * To be able to create our actionsliders we need to do some setup, but this
398
 * isn't really relevant here, so if you want to know about that go @ref
399
 * Elm_Win "here".
400
 *
401
 * With all that boring stuff out of the way we can proceed to creating some
402
 * actionsliders.@n
403
 * All actionsliders are created the same way:
404
 * @skipline actionslider_add
405
 * Next we must choose where the indicator starts, and for this one we choose
406
 * the right, and set the right as magnetic:
407
 * @skipline indicator_pos_set
408
 * @until magnet_pos_set
409
 *
410
 * We then set the labels for the left and right, passing NULL as an argument
411
 * to any of the labels makes that position have no label.
412
 * @until Stop
413
 *
414
 * Furthermore we mark both left and right as enabled positions, if we didn't
415
 * do this all three positions would be enabled:
416
 * @until RIGHT
417
 *
418
 * Having the enabled positions we now add a smart callback to change
419
 * which position is magnetic, so that only the last selected position is
420
 * magnetic:
421
 * @until NULL
422
 *
423
 * And finally we set our printing callback and show the actionslider:
424
 * @until object_show
425
 * @skip pack_end
426
 *
427
 * For our next actionslider we are going to do much as we did for the
428
 * previous except we are going to have the center as the magnet(and not
429
 * change it):
430
 * @skipline actionslider_add
431
 * @skipline indicator_pos_set
432
 * @until object_show
433
 *
434
 * And another actionslider, in this one the indicator starts on the left.
435
 * It has labels only in the center and right, and both positions are
436
 * magnetic. Because the left doesn't have a label and is not magnetic once
437
 * the indicator leaves it can't return:
438
 * @skipline actionslider_add
439
 * @skipline indicator_pos_set
440
 * @until object_show
441
 * @note The greyed out area is a @ref Styles "style".
442
 *
443
 * And now an actionslider with a label in the indicator, and whose magnet
444
 * properties change based on what was last selected:
445
 * @skipline actionslider_add
446
 * @skipline indicator_pos_set
447
 * @until object_show
448
 * @note The greyed out area is a @ref Styles "style".
449
 *
450
 * We are almost done, this next one is just an actionslider with all
451
 * positions magnetized and having every possible label:
452
 * @skipline actionslider_add
453
 * @skipline indicator_pos_set
454
 * @until object_show
455
 *
456
 * And for our last actionslider we have one that turns the magnetic property
457
 * on and off:
458
 * @skipline actionslider_add
459
 * @skipline indicator_pos_set
460
 * @until object_show
461
 *
462
 * The example will look like this:
463
 *
464
 * @image html screenshots/actionslider_01.png
465
 * @image latex screenshots/actionslider_01.eps width=\textwidth
466
 *
467
 * See the full source code @ref actionslider_example_01 "here"
468
 */
469

470
/**
471
 * @page transit_example_03_c elm_transit - Combined effects and options.
472
 *
473
 * This example shows how to apply the following transition effects:
474
 * @li translation
475
 * @li color
476
 * @li rotation
477
 * @li wipe
478
 * @li zoom
479
 * @li resizing
480
 *
481
 * It allows you to apply more than one effect at once, and also allows to
482
 * set properties like event_enabled, auto_reverse, repeat_times and
483
 * tween_mode.
484
 *
485
 * @include transit_example_03.c
486
 * @example transit_example_03.c
487
 */
488

489
/**
490
 * @page transit_example_04_c elm_transit - Combined effects over two objects.
491
 *
492
 * This example shows how to apply the transition effects:
493
 * @li flip
494
 * @li resizable_flip
495
 * @li fade
496
 * @li blend
497
 * over two objects. This kind of transition effect is used to make one
498
 * object disappear and another one appear on its place.
499
 *
500
 * You can mix more than one effect of this type on the same objects, and the
501
 * transition will apply both.
502
 *
503
 * @include transit_example_04.c
504
 * @example transit_example_04.c
505
 */
506

507
/**
508
 * @page transit_example_01_explained elm_transit - Basic transit usage.
509
 * @dontinclude transit_example_01.c
510
 *
511
 * The full code for this example can be found at @ref transit_example_01_c.
512
 *
513
 * This example shows the simplest way of creating a transition and applying
514
 * it to an object. Similarly to every other elementary example, we create a
515
 * window, set its title, size, autodel property, and setup a callback to
516
 * exit the program when finished:
517
 *
518
 * @skip on_done
519
 * @until evas_object_resize
520
 *
521
 * We also add a resizable white background to use behind our animation:
522
 *
523
 * @skip bg_add
524
 * @until evas_object_show
525
 *
526
 * And then we add a button that we will use to demonstrate the effects of
527
 * our animation:
528
 *
529
 * @skip button_add
530
 * @until evas_object_show(win)
531
 *
532
 * Notice that we are not adding the button with elm_win_resize_object_add()
533
 * because we don't want the window to control the size of the button. We
534
 * will use the transition to change the button size, so it could conflict
535
 * with something else trying to control that size.
536
 *
537
 * Now, the simplest code possible to create the resize animation:
538
 *
539
 * @skip transit_add
540
 * @until transit_go
541
 *
542
 * As you can see, this code is very easy to understand. First, we create the
543
 * transition itself with elm_transit_add(). Then we add the button to this
544
 * transition with elm_transit_object_add(), which means that the transition
545
 * will operate over this button. The effect that we want now is changing the
546
 * object size from 100x50 to 300x150, and can be achieved by adding the
547
 * resize effect with elm_transit_effect_resizing_add().
548
 *
549
 * Finally, we set the transition time to 5 seconds and start the transition
550
 * with elm_transit_go(). If we wanted more effects applied to this
551
 * button, we could add them to the same transition. See the
552
 * @ref transit_example_03_c to watch many transitions being applied to an
553
 * object.
554
 */
555

556
/**
557
 * @page transit_example_02_explained elm_transit - Chained transitions.
558
 * @dontinclude transit_example_02.c
559
 *
560
 * The full code for this example can be found at @ref transit_example_02_c.
561
 *
562
 * This example shows how to implement a chain of transitions. This chain is
563
 * used to start a transition just after another transition ended. Similarly
564
 * to every other elementary example, we create a window, set its title,
565
 * size, autodel property, and setup a callback to exit the program when
566
 * finished:
567
 *
568
 * @skip on_done
569
 * @until evas_object_resize
570
 *
571
 * We also add a resizable white background to use behind our animation:
572
 *
573
 * @skip bg_add
574
 * @until evas_object_show
575
 *
576
 * This example will have a chain of 4 transitions, each of them applied to
577
 * one button. Thus we create 4 different buttons:
578
 *
579
 * @skip button_add
580
 * @until evas_object_show(bt4)
581
 *
582
 * Now we create a simple translation transition that will be started as soon
583
 * as the program loads. It will be our first transition, and the other
584
 * transitions will be started just after this transition ends:
585
 *
586
 * @skip transit_add
587
 * @until transit_go
588
 *
589
 * The code displayed until now has nothing different from what you have
590
 * already seen in @ref transit_example_01_explained, but now comes the new
591
 * part: instead of creating a second transition that will start later using
592
 * a timer, we create the it normally, and use
593
 * elm_transit_chain_transit_add() instead of elm_transit_go. Since we are
594
 * adding it in a chain after the first transition, it will start as soon as
595
 * the first transition ends:
596
 *
597
 * @skip transit_add
598
 * @until transit_chain_transit_add
599
 *
600
 * Finally we add the 2 other transitions to the chain, and run our program.
601
 * It will make one transition start after the other finish, and there is the
602
 * transition chain.
603
 */
604

605
/**
606
 * @page general_functions_example_page General (top-level) functions example
607
 * @dontinclude general_funcs_example.c
608
 *
609
 * As told in their documentation blocks, the
610
 * elm_app_compile_*_dir_set() family of functions have to be called
611
 * before elm_app_info_set():
612
 * @skip tell elm about
613
 * @until elm_app_info_set
614
 *
615
 * We are here setting the fallback paths to the compiling time target
616
 * paths, naturally. If you're building the example out of the
617
 * project's build system, we're assuming they are the canonical ones.
618
 *
619
 * After the program starts, elm_app_info_set() will actually run and
620
 * then you'll see a problem: Elementary does the prefix lookup @b
621
 * twice. This is so because of the quicklaunch infrastructure in
622
 * Elementary (@ref Start), which will register a predefined prefix
623
 * for possible users of the launch schema. We're not hooking into a
624
 * quick launch, so this first call can't be avoided.
625
 *
626
 * If you ran this example from your "bindir" installation
627
 * directory, no output will emerge from these both attempts -- it
628
 * will find the "magic" file there registered and set the prefixes
629
 * silently. Otherwise, you could get something like:
630
 @verbatim
631
 WARNING: Could not determine its installed prefix for 'ELM'
632
       so am falling back on the compiled in default:
633
         usr
634
       implied by the following:
635
         bindir    = usr/lib
636
         libdir    = usr/lib
637
         datadir   = usr/share/elementary
638
         localedir = usr/share/locale
639
       Try setting the following environment variables:
640
         ELM_PREFIX     - points to the base prefix of install
641
       or the next 4 variables
642
         ELM_BIN_DIR    - provide a specific binary directory
643
         ELM_LIB_DIR    - provide a specific library directory
644
         ELM_DATA_DIR   - provide a specific data directory
645
         ELM_LOCALE_DIR - provide a specific locale directory
646
 @endverbatim
647
 * if you also didn't change those environment variables (remember
648
 * they are also a valid way of communicating your prefix to the
649
 * binary) - this is the scenario where it fallbacks to the paths set
650
 * for compile time.
651
 *
652
 * Then, you can check the prefixes set on the standard output:
653
 * @skip prefix was set to
654
 * @until locale directory is
655
 *
656
 * In the fragment
657
 * @skip by using this policy
658
 * @until elm_win_autodel_set
659
 * we demonstrate the use of Elementary policies. The policy defining
660
 * under which circumstances our application should quit automatically
661
 * is set to when its last window is closed (this one has just one
662
 * window, though). This will save us from having to set a callback
663
 * ourselves on the window, like done in @ref bg_example_01_c "this"
664
 * example. Note that we need to tell the window to delete itself's
665
 * object on a request to destroy the canvas coming, with
666
 * elm_win_autodel_set().
667
 *
668
 * What follows is some boilerplate code, creating a frame with a @b
669
 * button, our object of interest, and, below, widgets to change the
670
 * button's behavior and exemplify the group of functions in question.
671
 *
672
 * @dontinclude general_funcs_example.c
673
 * We enabled the focus highlight object for this window, so that you
674
 * can keep track of the current focused object better:
675
 * @skip elm_win_focus_highlight_enabled_set
676
 * @until evas_object_show
677
 * Use the tab key to navigate through the focus chain.
678
 *
679
 * @dontinclude general_funcs_example.c
680
 * While creating the button, we exemplify how to use Elementary's
681
 * finger size information to scale our UI:
682
 * @skip fprintf(stdout, "Elementary
683
 * @until evas_object_show
684
 *
685
 * @dontinclude general_funcs_example.c
686
 * The first checkbox's callback is:
687
 * @skip static void
688
 * @until }
689
 * When unsetting the checkbox, we disable the button, which will get a new
690
 * decoration (greyed out) and stop receiving events. The focus chain
691
 * will also ignore it.
692
 *
693
 * Following, there are 2 more buttons whose actions are focus/unfocus
694
 * the top button, respectively:
695
 * @skip focus callback
696
 * @until }
697
 * and
698
 * @skip unfocus callback
699
 * @until }
700
 * Note the situations in which they won't take effect:
701
 * - the button is not allowed to get focus or
702
 * - the button is disabled
703
 *
704
 * The first restriction above you'll get by a second checkbox, whose
705
 * callback is:
706
 * @skip focus allow callback
707
 * @until }
708
 * Note that the button will still get mouse events, though.
709
 *
710
 * Next, there's a slider controlling the button's scale:
711
 * @skip scaling callback
712
 * @until }
713
 *
714
 * Experiment with it, so you understand the effect better. If you
715
 * change its value, it will mess with the button's original size,
716
 * naturally.
717
 *
718
 * The full code for this example can be found
719
 * @ref general_functions_example_c "here".
720
 */
721

722
/**
723
 * @page theme_example_01 Theme - Using extensions
724
 *
725
 * @dontinclude theme_example_01.c
726
 *
727
 * Using extensions is extremely easy, discarding the part where you have to
728
 * write the theme for them.
729
 *
730
 * In the following example we'll be creating two buttons, one to load or
731
 * unload our extension theme and one to cycle around three possible styles,
732
 * one of which we created.
733
 *
734
 * After including our one and only header we'll jump to the callback for
735
 * the buttons. First one takes care of loading or unloading our extension
736
 * file, relative to the default theme set (thus the @c NULL in the
737
 * functions first parameter).
738
 * @skipline Elementary.h
739
 * @skip static void
740
 * @until }
741
 * @until }
742
 * @until }
743
 *
744
 * The second button, as we said before, will just switch around different
745
 * styles. In this case we have three of them. The first one is our custom
746
 * style, named after something very unlikely to find in the default theme.
747
 * The other two styles are the standard and one more, anchor, which exists
748
 * in the default and is similar to the default, except the button vanishes
749
 * when the mouse is not over it.
750
 * @skip static void
751
 * @until }
752
 * @until }
753
 *
754
 * So what happens if the style switches to our custom one when the
755
 * extension is loaded? Elementary falls back to the default for the
756
 * widget.
757
 *
758
 * And the main function, simply enough, will create the window, set the
759
 * buttons and their callbacks, and just to begin with our button styled
760
 * we're also loading our extension at the beginning.
761
 * @skip int
762
 * @until ELM_MAIN
763
 *
764
 * In this case we wanted to easily remove extensions, but all adding an
765
 * extension does is tell Elementary where else it should look for themes
766
 * when it can't find them in the default theme. Another way to do this
767
 * is to set the theme search order using elm_theme_set(), but this requires
768
 * that the developer is careful not to override any user configuration.
769
 * That can be helped by adding our theme to the end of whatever is already
770
 * set, like in the following snippet.
771
 * @code
772
 * char buf[4096];
773
 * snprintf(buf, sizeof(buf), "%s:./theme_example.edj", elme_theme_get(NULL);
774
 * elm_theme_set(NULL, buf);
775
 * @endcode
776
 *
777
 * If we were using overlays instead of extensions, the same thing applies,
778
 * but the custom theme must be added to the front of the search path.
779
 *
780
 * In the end, we should be looking at something like this:
781
 *
782
 * @image html screenshots/theme_example_01.png
783
 * @image latex screenshots/theme_example_01.eps width=\textwidth
784
 *
785
 * That's all. Boringly simple, and the full code in one piece can be found
786
 * @ref theme_example_01.c "here".
787
 *
788
 * And the code for our extension is @ref theme_example.edc "here".
789
 *
790
 * @example theme_example_01.c
791
 * @example theme_example.edc
792
 */
793

794
/**
795
 * @page theme_example_02 Theme - Using overlays
796
 *
797
 * @dontinclude theme_example_02.c
798
 *
799
 * Overlays are like extensions in that you tell Elementary that some other
800
 * theme contains the styles you need for your program. The difference is that
801
 * they will be look in first, so they can override the default style of any
802
 * widget.
803
 *
804
 * There's not much to say about them that hasn't been said in our previous
805
 * example about @ref theme_example_01 "extensions", so going quickly through
806
 * the code we have a function to load or unload the theme, which will be
807
 * called when we click any button.
808
 * @skipline Elementary.h
809
 * @skip static void
810
 * @until }
811
 *
812
 * And the main function, creating the window and adding some buttons to it.
813
 * We load our theme as an overlay and nothing else. Notice there's no style
814
 * set for any button there, which means they should be using the default
815
 * that we override.
816
 * @skip int
817
 * @until ELM_MAIN
818
 *
819
 * That's pretty much it. The full code is @ref theme_example_02.c "here" and
820
 * the definition of the theme is the same as before, and can be found in
821
 * @ref theme_example.edc "here".
822
 *
823
 * @example theme_example_02.c
824
 */
825

826
 /**
827
  * @page button_example_00 Button - Hello, Button!
828
  *
829
  * @dontinclude button_example_00.c
830
  *
831
  * Keeping the tradition, this is a simple "Hello, World" button example. We
832
  * will show how to create a button and associate and action to be performed
833
  * when you click on it.
834
  *
835
  * In the end, we'll be presented with something that looks like this:
836
  *
837
  * @image html screenshots/button_00.png
838
  * @image latex screenshots/button_00.eps width=\textwidth
839
  *
840
  * The full code of the example is @ref button_example_00.c "here" and we
841
  * will follow here with a rundown of it.
842
  *
843
  *
844
  * There is only one button on the interface which performs a basic action:
845
  * close the application. This behavior is described by on_click() function,
846
  * that interrupt the program invoking elm_exit().
847
  * @skip static void
848
  * @until }
849
  *
850
  *
851
  * On the main() function, we set the basic characteristics of the user
852
  * interface. First we use the Elementary library to create a window and
853
  * set its policies (such as close when the user click on the window close
854
  * icon).
855
  *
856
  * @skip elm_win_add
857
  * @until elm_policy_set
858
  *
859
  * In order to turn it visible on the WM (Window Manager), we also have to
860
  * associate it to a canvas through Evas library, and set its dimensions.
861
  *
862
  * @skip evas_object_resize
863
  * @until evas_object_show(win)
864
  *
865
  * Then we create a background associated to the window, define its dimensions,
866
  * and turn it visible on the canvas.
867
  * @skip  elm_bg_add
868
  * @until evas_object_show(bg)
869
  *
870
  *
871
  * Finally we use Elementary to create a button and Evas to set its
872
  * proprieties. Here we have not only to give the button dimensions, but also
873
  * its coordinates and the action to be performed on the click event.
874
  * @skip elm_button_add
875
  * @until evas_object_show(btn)
876
  *
877
  *
878
  * And we are done.
879
  *
880
  * @example button_example_00.c
881
  */
882

883
/**
884
  * @page button_example_01 Button - Complete example
885
  *
886
  * @dontinclude button_example_01.c
887
  *
888
  * A button is simple, you click on it and something happens. That said,
889
  * we'll go through an example to show in detail the button API less
890
  * commonly used.
891
  *
892
  * In the end, we'll be presented with something that looks like this:
893
  *
894
  * @image html screenshots/button_01.png
895
  * @image latex screenshots/button_01.eps width=\textwidth
896
  *
897
  * The full code of the example is @ref button_example_01.c "here" and we
898
  * will follow here with a rundown of it.
899
  *
900
  * @skip Elementary.h
901
  * @until Elementary.h
902
  * @skip struct
903
  * @until App_Data
904
  *
905
  * We have several buttons to set different times for the autorepeat timeouts
906
  * of the buttons that use it and a few more that we keep track of in our
907
  * data struct. The mid button doesn't do much, just moves around according
908
  * to what other buttons the user presses. Then four more buttons to move the
909
  * central one, and we're also keeping track of the icon set in the middle
910
  * button, since when this one moves, we change the icon, and when movement
911
  * is finished (by releasing one of the four arrow buttons), we set back the
912
  * normal icon.
913
  * @skip static void
914
  * @until }
915
  *
916
  * Keeping any of those four buttons pressed will trigger their autorepeat
917
  * callback, where we move the button doing some size hint magic. To
918
  * understand how that works better, refer to the @ref Elm_Box documentation.
919
  * Also, the first time the function is called, we change the icon in the
920
  * middle button, using elm_object_content_unset() first to keep the reference
921
  * to the previous one, so we don't need to recreate it when we are done
922
  * moving it.
923
  * @skip static void
924
  * @until }
925
  * @until size_hint_align_set
926
  * @until }
927
  *
928
  * One more callback for the option buttons, that just sets the timeouts for
929
  * the different autorepeat options.
930
  *
931
  * @skip static void
932
  * @until }
933
  * @until }
934
  * @until }
935
  *
936
  * And the main function, which does some setting up of the buttons in boxes
937
  * to make things work. Here we'll go through some snippets only.
938
  *
939
  * For the option buttons, it's just the button with its label and callback.
940
  * @skip elm_button_add
941
  * @until smart_callback_add
942
  *
943
  * For the ones that move the central button, we have no labels. There are
944
  * icons instead, and the autorepeat option is toggled.
945
  * @skip Gap: 1.0
946
  * @skip elm_button_add
947
  * @until data.cursors.up
948
  *
949
  * And just to show the mid button, which doesn't have anything special.
950
  * @skip data.cursors.left
951
  * @skip elm_button_add
952
  * @until data.mid
953
  *
954
  * And we are done.
955
  *
956
  * @example button_example_01.c
957
  */
958

959
/**
960
 * @page bubble_01_example_page elm_bubble - Simple use.
961
 * @dontinclude bubble_example_01.c
962
 *
963
 * This example shows a bubble with all fields set(label, info, content and
964
 * icon) and the selected corner changing when the bubble is clicked. To be
965
 * able use a bubble we need to do some setup and create a window, for this
966
 * example we are going to ignore that part of the code since it isn't
967
 * relevant to the bubble.
968
 *
969
 * To have the selected corner change in a clockwise motion we are going to
970
 * use the following callback:
971
 * @skip static
972
 * @until }
973
 * @until }
974
 *
975
 * Here we are creating an elm_label that is going to be used as the content
976
 * for our bubble:
977
 * @skipline elm_label
978
 * @until show
979
 * @note You could use any evas_object for this, we are using an elm_label
980
 * for simplicity.
981
 *
982
 * Despite it's name the bubble's icon doesn't have to be an icon, it can be
983
 * any evas_object. For this example we are going to make the icon a simple
984
 * blue rectangle:
985
 * @until show
986
 *
987
 * And finally we have the actual bubble creation and the setting of it's
988
 * label, info and content:
989
 * @until content
990
 * @skipline show
991
 * @note Because we didn't set a corner, the default("top_left") will be
992
 * used.
993
 *
994
 * Now that we have our bubble all that is left is connecting the "clicked"
995
 * signals to our callback:
996
 * @line smart_callback
997
 *
998
 * This last bubble we created was very complete, so it's pertinent to show
999
 * that most of that stuff is optional a bubble can be created with nothing
1000
 * but content:
1001
 * @until content
1002
 * @skipline show
1003
 *
1004
 * Our example will look like this:
1005
 *
1006
 * @image html screenshots/bubble_example_01.png
1007
 * @image latex screenshots/bubble_example_01.eps width=\textwidth
1008
 *
1009
 * See the full source code @ref bubble_example_01.c here.
1010
 * @example bubble_example_01.c
1011
 */
1012

1013
/**
1014
 * @page box_example_01 Box - Basic API
1015
 *
1016
 * @dontinclude button_example_01.c
1017
 *
1018
 * As a special guest tonight, we have the @ref button_example_01 "simple
1019
 * button example". There are plenty of boxes in it, and to make the cursor
1020
 * buttons that moved a central one around when pressed, we had to use a
1021
 * variety of values for their hints.
1022
 *
1023
 * To start, let's take a look at the handling of the central button when
1024
 * we were moving it around. To achieve this effect without falling back to
1025
 * a complete manual positioning of the @c Evas_Object in our canvas, we just
1026
 * put it in a box and played with its alignment within it, as seen in the
1027
 * following snippet of the callback for the pressed buttons.
1028
 * @skip evas_object_size_hint_align_get
1029
 * @until evas_object_size_hint_align_set
1030
 *
1031
 * Not much to it. We get the current alignment of the object and change it
1032
 * by just a little, depending on which button was pressed, then set it
1033
 * again, making sure we stay within the 0.0-1.0 range so the button moves
1034
 * inside the space it has, instead of disappearing under the other objects.
1035
 *
1036
 * But as useful as an example as that may have been, the usual case with boxes
1037
 * is to set everything at the moment they are created, like we did for
1038
 * everything else in our main function.
1039
 *
1040
 * The entire layout of our program is made with boxes. We have one set as the
1041
 * resize object for the window, which means it will always be resized with
1042
 * the window. The weight hints set to @c EVAS_HINT_EXPAND will tell the
1043
 * window that the box can grow past it's minimum size, which allows resizing
1044
 * of it.
1045
 * @skip elm_main
1046
 * @skip elm_box_add
1047
 * @until evas_object_show
1048
 *
1049
 * Two more boxes, set to horizontal, hold the buttons to change the autorepeat
1050
 * configuration used by the buttons. We create each to take over all the
1051
 * available space horizontally, but we don't want them to grow vertically,
1052
 * so we keep that axis of the weight with 0.0. Then it gets packed in the
1053
 * main box.
1054
 * @skip box2
1055
 * @until evas_object_show
1056
 *
1057
 * The buttons in each of those boxes have nothing special, they are just packed
1058
 * in with their default values and the box will use their minimum size, as set
1059
 * by Elementary itself based on the label, icon, finger size and theme.
1060
 *
1061
 * But the buttons used to move the central one have a special disposition.
1062
 * The top one first, is placed right into the main box like our other smaller
1063
 * boxes. Set to expand horizontally and not vertically, and in this case we
1064
 * also tell it to fill that space, so it gets resized to take the entire
1065
 * width of the window.
1066
 * @skip Gap: 1.0
1067
 * @skip elm_button_add
1068
 * @until evas_object_show
1069
 *
1070
 * The bottom one will be the same, but for the other two we need to use a
1071
 * second box set to take as much space as we have, so we can place our side
1072
 * buttons in place and have the big empty space where the central button will
1073
 * move.
1074
 * @skip elm_box_add
1075
 * @until evas_object_show
1076
 *
1077
 * Then the buttons will have their hints inverted to the other top and bottom
1078
 * ones, to expand and fill vertically and keep their minimum size horizontally.
1079
 * @skip elm_button_add
1080
 * @until evas_object_show
1081
 *
1082
 * The central button takes every thing else. It will ask to be expanded in
1083
 * both directions, but without filling its cell. Changing its alignment by
1084
 * pressing the buttons will make it move around.
1085
 * @skip elm_button_add
1086
 * @until evas_object_show
1087
 *
1088
 * To end, the rightmost button is packed in the smaller box after the central
1089
 * one, and back to the main box we have the bottom button at the end.
1090
 */
1091

1092
/**
1093
 * @page box_example_02 Box - Layout transitions
1094
 *
1095
 * @dontinclude box_example_02.c
1096
 *
1097
 * Setting a customized layout for a box is simple once you have the layout
1098
 * function, which is just like the layout function for @c Evas_Box. The new
1099
 * and fancier thing we can do with Elementary is animate the transition from
1100
 * one layout to the next. We'll see now how to do that through a simple
1101
 * example, while also taking a look at some of the API that was left
1102
 * untouched in our @ref box_example_01 "previous example".
1103
 *
1104
 * @image html screenshots/box_example_02.png
1105
 * @image latex screenshots/box_example_02.eps width=\textwidth
1106
 *
1107
 * @skipline Elementary.h
1108
 *
1109
 * Our application data consists of a list of layout functions, given by
1110
 * @c transitions. We'll be animating through them throughout the entire run.
1111
 * The box with the stuff to move around and the last layout that was set to
1112
 * make things easier in the code.
1113
 * @skip typedef
1114
 * @until Transitions_Data
1115
 *
1116
 * The box starts with three buttons, clicking on any of them will take it
1117
 * out of the box without deleting the object. There are also two more buttons
1118
 * outside, one to add an object to the box and the other to clear it.
1119
 * This is all to show how you can interact with the items in the box, add
1120
 * things and even remove them, while the transitions occur.
1121
 *
1122
 * One of the callback we'll be using creates a new button, asks the box for
1123
 * the list of its children and if it's not empty, we add the new object after
1124
 * the first one, otherwise just place at the end as it will not make any
1125
 * difference.
1126
 * @skip static void
1127
 * @until }
1128
 * @until }
1129
 *
1130
 * The clear button is even simpler. Everything in the box will be deleted,
1131
 * leaving it empty and ready to fill it up with more stuff.
1132
 * @skip static void
1133
 * @until }
1134
 *
1135
 * And a little function to remove buttons from the box without deleting them.
1136
 * This one is set for the @c clicked callback of the original buttons,
1137
 * unpacking them when clicked and placing it somewhere in the screen where
1138
 * they will not disturb. Once we do this, the box no longer has any control
1139
 * of it, so it will be left untouched until the program ends.
1140
 * @skip static void
1141
 * @until }
1142
 *
1143
 * If we wanted, we could just call @c evas_object_del() on the object to
1144
 * destroy it. In this case, no unpack is really necessary, as the box would
1145
 * be notified of a child being deleted and adjust its calculations accordingly.
1146
 *
1147
 * The core of the program is the following function. It takes whatever
1148
 * function is first on our list of layouts and together with the
1149
 * @c last_layout, it creates an ::Elm_Box_Transition to use with
1150
 * elm_box_layout_transition(). In here, we tell it to start from whatever
1151
 * layout we last set, end with the one that was at the top of the list and
1152
 * when everything is finished, call us back so we can create another
1153
 * transition. Finally, move the new layout to the end of the list so we
1154
 * can continue running through them until the program ends.
1155
 * @skip static void
1156
 * @until }
1157
 *
1158
 * The main function doesn't have anything special. Creation of box, initial
1159
 * buttons and some callback setting. The only part worth mentioning is the
1160
 * initialization of our application data.
1161
 * @skip tdata.box
1162
 * @until evas_object_box_layout_stack
1163
 *
1164
 * We have a simple static variable, set the box, the first layout we are
1165
 * using as last and create the list with the different functions to go
1166
 * through.
1167
 *
1168
 * And in the end, we set the first layout and call the same function we went
1169
 * through before to start the run of transitions.
1170
 * @until _test_box_transition_change
1171
 *
1172
 * For the full code, follow @ref box_example_02.c "here".
1173
 *
1174
 * @example box_example_02.c
1175
 */
1176

1177
/**
1178
 * @page calendar_example_01 Calendar - Simple creation.
1179
 * @dontinclude calendar_example_01.c
1180
 *
1181
 * As a first example, let's just display a calendar in our window,
1182
 * explaining all steps required to do so.
1183
 *
1184
 * First you should declare objects we intend to use:
1185
 * @skipline Evas_Object
1186
 *
1187
 * Then a window is created, a title is set and its set to be autodeleted.
1188
 * More details can be found on windows examples:
1189
 * @until elm_win_autodel
1190
 *
1191
 * Next a simple background is placed on our windows. More details on
1192
 * @ref bg_01_example_page :
1193
 * @until evas_object_show(bg)
1194
 *
1195
 * Now, the exciting part, let's add the calendar with elm_calendar_add(),
1196
 * passing our window object as parent.
1197
 * @until evas_object_show(cal);
1198
 *
1199
 * To conclude our example, we should show the window and run elm mainloop:
1200
 * @until ELM_MAIN
1201
 *
1202
 * Our example will look like this:
1203
 *
1204
 * @image html screenshots/calendar_example_01.png
1205
 * @image latex screenshots/calendar_example_01.eps width=\textwidth
1206
 *
1207
 * See the full source code @ref calendar_example_01.c here.
1208
 * @example calendar_example_01.c
1209
 */
1210

1211
/**
1212
 * @page calendar_example_02 Calendar - Layout strings formatting.
1213
 * @dontinclude calendar_example_02.c
1214
 *
1215
 * In this simple example, we'll explain how to format the label displaying
1216
 * month and year, and also set weekday names.
1217
 *
1218
 * To format month and year label, we need to create a callback function
1219
 * to create a string given the selected time, declared under a
1220
 * <tt> struct tm </tt>.
1221
 *
1222
 * <tt> struct tm </tt>, declared on @c time.h, is a structure composed by
1223
 * nine integers:
1224
 * @li tm_sec   seconds [0,59]
1225
 * @li tm_min   minutes [0,59]
1226
 * @li tm_hour  hour [0,23]
1227
 * @li tm_mday  day of month [1,31]
1228
 * @li tm_mon   month of year [0,11]
1229
 * @li tm_year  years since 1900
1230
 * @li tm_wday  day of week [0,6] (Sunday = 0)
1231
 * @li tm_yday  day of year [0,365]
1232
 * @li tm_isdst daylight savings flag
1233
 * @note glib version has 2 additional fields.
1234
 *
1235
 * For our function, only stuff that matters are tm_mon and tm_year.
1236
 * But we don't need to access it directly, since there are nice functions
1237
 * to format date and time, as @c strftime.
1238
 * We will get abbreviated month (%b) and year (%y) (check strftime manpage
1239
 * for more) in our example:
1240
 * @skipline static char
1241
 * @until }
1242
 *
1243
 * We need to alloc the string to be returned, and calendar widget will
1244
 * free it when it's not needed, what is done by @c strdup.
1245
 * So let's register our callback to calendar object:
1246
 * @skipline elm_calendar_format_function_set
1247
 *
1248
 * To set weekday names, we should declare them as an array of strings:
1249
 * @dontinclude calendar_example_02.c
1250
 * @skipline weekdays[]
1251
 * @until }
1252
 *
1253
 * And finally set them to calendar:
1254
 * @skipline weekdays_names_set
1255
 *
1256
 * Our example will look like this:
1257
 *
1258
 * @image html screenshots/calendar_example_02.png
1259
 * @image latex screenshots/calendar_example_02.eps width=\textwidth
1260
 *
1261
 * See the full source code @ref calendar_example_02.c here.
1262
 * @example calendar_example_02.c
1263
 */
1264

1265
/**
1266
 * @page calendar_example_03 Calendar - Years restrictions.
1267
 * @dontinclude calendar_example_03.c
1268
 *
1269
 * This example explains how to set max and min year to be displayed
1270
 * by a calendar object. This means that user won't be able to
1271
 * see or select a date before and after selected years.
1272
 * By default, limits are 1902 and maximum value will depends
1273
 * on platform architecture (year 2037 for 32 bits); You can
1274
 * read more about time functions on @c ctime manpage.
1275
 *
1276
 * Straigh to the point, to set it is enough to call
1277
 * elm_calendar_min_max_year_set(). First value is minimum year, second
1278
 * is maximum. If first value is negative, it won't apply limit for min
1279
 * year, if the second one is negative, won't apply for max year.
1280
 * Setting both to negative value will clear limits (default state):
1281
 * @skipline elm_calendar_min_max_year_set
1282
 *
1283
 * Our example will look like this:
1284
 *
1285
 * @image html screenshots/calendar_example_03.png
1286
 * @image latex screenshots/calendar_example_03.eps width=\textwidth
1287
 *
1288
 * See the full source code @ref calendar_example_03.c here.
1289
 * @example calendar_example_03.c
1290
 */
1291

1292
/**
1293
 * @page calendar_example_04 Calendar - Days selection.
1294
 * @dontinclude calendar_example_04.c
1295
 *
1296
 * It's possible to disable date selection and to select a date
1297
 * from your program, and that's what we'll see on this example.
1298
 *
1299
 * If isn't required that users could select a day on calendar,
1300
 * only interacting going through months, disabling days selection
1301
 * could be a good idea to avoid confusion. For that:
1302
 * @skipline elm_calendar_select_mode_set
1303
 *
1304
 * Also, regarding days selection, you could be interested to set a
1305
 * date to be highlighted on calendar from your code, maybe when
1306
 * a specific event happens, or after calendar creation. As @c time output is
1307
 * in seconds, we define the number of seconds contained within a day as a
1308
 * constant:
1309
 * @dontinclude calendar_example_04.c
1310
 * @skipline SECS_DAY
1311
 *
1312
 * Now let's select two days from current day:
1313
 * @skipline time(NULL)
1314
 * @until elm_calendar_selected_time_set
1315
 *
1316
 * Our example will look like this:
1317
 *
1318
 * @image html screenshots/calendar_example_04.png
1319
 * @image latex screenshots/calendar_example_04.eps width=\textwidth
1320
 *
1321
 * See the full source code @ref calendar_example_04.c here.
1322
 * @example calendar_example_04.c
1323
 */
1324

1325
/**
1326
 * @page calendar_example_05 Calendar - Signal callback and getters.
1327
 * @dontinclude calendar_example_05.c
1328
 *
1329
 * Most of setters explained on previous examples have associated getters.
1330
 * That's the subject of this example. We'll add a callback to display
1331
 * all calendar information every time user interacts with the calendar.
1332
 *
1333
 * Let's check our callback function:
1334
 * @skipline static void
1335
 * @until double interval;
1336
 *
1337
 * To get selected day, we need to call elm_calendar_selected_time_get(),
1338
 * but to assure nothing wrong happened, we must check for function return.
1339
 * It'll return @c EINA_FALSE if fail. Otherwise we can use time set to
1340
 * our structure @p stime.
1341
 * @skipline elm_calendar_selected_time_get
1342
 * @until return
1343
 *
1344
 * Next we'll get information from calendar and place on declared vars:
1345
 * @skipline interval
1346
 * @until elm_calendar_weekdays_names_get
1347
 *
1348
 * The only tricky part is that last line gets an array of strings
1349
 * (char arrays), one for each weekday.
1350
 *
1351
 * Then we can simple print that to stdin:
1352
 * @skipline printf
1353
 * @until }
1354
 *
1355
 * <tt> struct tm </tt> is declared on @c time.h. You can check @c ctime
1356
 * manpage to read about it.
1357
 *
1358
 * To register this callback, that will be called every time user selects
1359
 * a day or goes to next or previous month, just add a callback for signal
1360
 * @b changed.
1361
 * @skipline evas_object_smart_callback_add
1362
 *
1363
 * Our example will look like this:
1364
 *
1365
 * @image html screenshots/calendar_example_05.png
1366
 * @image latex screenshots/calendar_example_05.eps width=\textwidth
1367
 *
1368
 * See the full source code @ref calendar_example_05.c here.
1369
 * @example calendar_example_05.c
1370
 */
1371

1372
/**
1373
 * @page calendar_example_06 Calendar - Calendar marks.
1374
 * @dontinclude calendar_example_06.c
1375
 *
1376
 * On this example marks management will be explained. Functions
1377
 * elm_calendar_mark_add(), elm_calendar_mark_del() and
1378
 * elm_calendar_marks_clear() will be covered.
1379
 *
1380
 * To add a mark, will be required to choose three things:
1381
 * @li mark style
1382
 * @li mark date, or start date if it will be repeated
1383
 * @li mark periodicity
1384
 *
1385
 * Style defines the kind of mark will be displayed over marked day,
1386
 * on calendar. Default theme supports @b holiday and @b checked.
1387
 * If more is required, is possible to set a new theme to calendar
1388
 * widget using elm_object_style_set(), and use
1389
 * the signal that will be used by such marks.
1390
 *
1391
 * Date is a <tt> struct tm </tt>, as defined by @c time.h. More can
1392
 * be read on @c ctime manpage.
1393
 * If a date relative from current is required, this struct can be set
1394
 * as:
1395
 * @skipline time(NULL)
1396
 * @until localtime_r
1397
 *
1398
 * Or if it's an absolute date, you can just declare the struct like:
1399
 * @dontinclude calendar_example_06.c
1400
 * @skipline sunday
1401
 * @until christmas.tm_mon
1402
 *
1403
 * Periodicity is how frequently the mark will be displayed over the
1404
 * calendar.  Can be a unique mark (that don't repeat), or it can repeat
1405
 * daily, weekly, monthly or annually. It's enumerated by
1406
 * @c Elm_Calendar_Mark_Repeat_Type.
1407
 *
1408
 * So let's add some marks to our calendar. We will add christmas holiday,
1409
 * set Sundays as holidays, and check current day and day after that.
1410
 * @dontinclude calendar_example_06.c
1411
 * @skipline sunday
1412
 * @until christmas.tm_mon
1413
 * @skipline current_time
1414
 * @until ELM_CALENDAR_WEEKLY
1415
 *
1416
 * We kept the return of first mark add, because we don't really won't it
1417
 * to be checked, so let's remove it:
1418
 * @skipline elm_calendar_mark_del
1419
 *
1420
 * After all marks are added and removed, is required to draw them:
1421
 * @skipline elm_calendar_marks_draw
1422
 *
1423
 * Finally, to clear all marks, let's set a callback for our button:
1424
 * @skipline elm_button_add
1425
 * @until evas_object_show(bt);
1426
 *
1427
 * This callback will receive our calendar object, and should clear it:
1428
 * @dontinclude calendar_example_06.c
1429
 * @skipline static
1430
 * @until }
1431
 * @note Remember to draw marks after clear the calendar.
1432
 *
1433
 * Our example will look like this:
1434
 *
1435
 * @image html screenshots/calendar_example_06.png
1436
 * @image latex screenshots/calendar_example_06.eps width=\textwidth
1437
 *
1438
 * See the full source code @ref calendar_example_06.c here.
1439
 * @example calendar_example_06.c
1440
 */
1441

1442
/**
1443
 * @page spinner_example Spinner widget example
1444
 *
1445
 * This code places seven Elementary spinner widgets on a window, each of
1446
 * them exemplifying a part of the widget's API.
1447
 *
1448
 * The first of them is the default spinner:
1449
 * @dontinclude spinner_example.c
1450
 * @skipline elm_spinner_add
1451
 * @until evas_object_show
1452
 * As you see, the defaults for a spinner are:
1453
 * @li no wrap
1454
 * @li min value set to 0
1455
 * @li max value set to 100
1456
 * @li step value set to 1
1457
 * @li label format set to "%0.f"
1458
 *
1459
 * If another format is required, see the second spinner. It will put a text
1460
 * before and after the value, and also format value to display two decimals:
1461
 * @skipline format_set
1462
 *
1463
 * The third one will use a customized step, define new minimum and maximum
1464
 * values and enable wrap, so when value reaches minimum it jumps to maximum,
1465
 * or jumps to minimum after maximum value is reached. Format is set to display
1466
 * a decimal:
1467
 * @skipline elm_spinner_add
1468
 * @until evas_object_show
1469
 *
1470
 * The fourth uses @c vertical style, so instead of left and right arrows,
1471
 * top and bottom are displayed. Also the change interval is reduced, so
1472
 * user can change value faster.
1473
 * @skipline style
1474
 * @skipline interval
1475
 *
1476
 * In the fifth the user won't be allowed to set value directly, i.e., will
1477
 * be obligate change value only using arrows:
1478
 * @skipline editable
1479
 *
1480
 * The sixth widget will receive a lot of special values, so
1481
 * instead of reading numeric values, user will see labels for each one.
1482
 * Also direct edition is disabled, otherwise users would see the numeric
1483
 * value on edition mode. User will be able to select a month in this widget:
1484
 * @skipline elm_spinner_add
1485
 * @until evas_object_show
1486
 *
1487
 * Finally the last widget will exemplify how to listen to widget's signals,
1488
 * <tt> changed </tt> and <tt> delay,changed </tt>. First we need to
1489
 * implement callback functions that will simply print spinner's value:
1490
 * @dontinclude spinner_example.c
1491
 * @skip static
1492
 * @skip }
1493
 * @skipline static
1494
 * @until }
1495
 * @until }
1496
 *
1497
 * The first callback function should be called everytime value changes,
1498
 * the second one only after user stops to increment or decrement. Try
1499
 * to keep arrows pressed and check the difference.
1500
 * @skip smart_callback
1501
 * @skipline smart_callback
1502
 * @skipline smart_callback
1503
 *
1504
 * See the full @ref spinner_example.c "example", whose window should
1505
 * look like this picture:
1506
 *
1507
 * @image html screenshots/spinner_example.png
1508
 * @image latex screenshots/spinner_example.eps width=\textwidth
1509
 *
1510
 * See the full @ref spinner_example.c "source code" for this example.
1511
 *
1512
 * @example spinner_example.c
1513
 */
1514

1515
/**
1516
 * @page slider_example Slider widget example
1517
 *
1518
 * This code places seven Elementary slider widgets on a window, each of
1519
 * them exemplifying a part of the widget's API.
1520
 *
1521
 * The first of them is the default slider:
1522
 * @dontinclude slider_example.c
1523
 * @skipline elm_slider_add
1524
 * @until evas_object_show
1525
 *
1526
 * As you see, the defaults for a slider are:
1527
 * @li horizontal
1528
 * @li no label
1529
 * @li no values (on indicator or unit labels)
1530
 *
1531
 * Actually it's pretty useless this way. So let's learn how to improve it.
1532
 *
1533
 * If some decoration is required, a label can be set, and icon before and
1534
 * after the bar as well. On the second slider will add a @c home icon
1535
 * and a @c folder icon at @c end.
1536
 * @skip elm_object_text_set
1537
 * @until elm_object_part_content_set(sl, "end", ic)
1538
 *
1539
 * If the bar size need to be changed, it can be done with span set function,
1540
 * that doesn't accounts other widget's parts size. Also the bar can starts
1541
 * with a not default value (0.0), as we done on third slider:
1542
 * @skipline value_set
1543
 * @skipline span_size_set
1544
 *
1545
 * So far, users won't be able to see the slider value. If it's required,
1546
 * it can be displayed in two different areas, units label or above
1547
 * the indicator.
1548
 *
1549
 * Let's place a units label on our widget, and also let's set minimum and
1550
 * maximum value (uses 0.0 and 1.0 by default):
1551
 * @skipline unit_format_set
1552
 * @skipline min_max_set
1553
 *
1554
 * If above the indicator is the place to display the value, just set it.
1555
 * Also, is possible to invert a bar, as you can see:
1556
 * @skipline indicator_format_set
1557
 * @skipline inverted_set
1558
 *
1559
 * But if you require to use a function a bit more customized to show the value,
1560
 * is possible to registry a callback function that will be called
1561
 * to display unit or indicator label. Only the value will be passed to this
1562
 * function, that should return a string.
1563
 * In this case, a function to free this string will be required.
1564
 *
1565
 * Let's exemplify with indicator label on our sixth slider:
1566
 * @dontinclude slider_example.c
1567
 * @skip static
1568
 * @skip }
1569
 * @skip static
1570
 * @skip }
1571
 * @skip static
1572
 * @skip }
1573
 * @skipline static
1574
 * @until }
1575
 * @until }
1576
 *
1577
 * Setting callback functions:
1578
 * @skipline indicator_format_function_set
1579
 * @skipline _indicator_free
1580
 *
1581
 * Also, a slider can be displayed vertically:
1582
 * @dontinclude slider_example.c
1583
 * @skipline elm_slider_horizontal_set
1584
 *
1585
 * Finally the last widget will exemplify how to listen to widget's signals,
1586
 * <tt> changed </tt> and <tt> delay,changed </tt>. First we need to
1587
 * implement callback functions that will simply print slider's value:
1588
 * @dontinclude slider_example.c
1589
 * @skip static
1590
 * @skip }
1591
 * @skipline static
1592
 * @until }
1593
 * @until }
1594
 *
1595
 * The first callback function should be called everytime value changes,
1596
 * the second one only after user stops to increment or decrement. Try
1597
 * to keep arrows pressed and check the difference.
1598
 * @skip smart_callback
1599
 * @skipline smart_callback
1600
 * @skipline smart_callback
1601
 *
1602
 * See the full @ref slider_example.c "example", whose window should
1603
 * look like this picture:
1604
 *
1605
 * @image html screenshots/slider_example.png
1606
 * @image latex screenshots/slider_example.eps width=\textwidth
1607
 *
1608
 * See the full @ref slider_example.c "source code" for this example.
1609
 *
1610
 * @example slider_example.c
1611
 */
1612

1613
/**
1614
 * @page panes_example Panes widget example
1615
 *
1616
 * This code places two Elementary panes widgets on a window, one of them
1617
 * displayed vertically and the other horizontally, to exemplify
1618
 * a part of the widget's API. Also, all the signals emitted by this
1619
 * widget will be covered.
1620
 *
1621
 * Let's start adding a panes to our window:
1622
 * @dontinclude panes_example.c
1623
 * @skipline elm_panes_add
1624
 * @until evas_object_show
1625
 *
1626
 * Now we will set a content (a simple button) to the left side of our
1627
 * panes widget:
1628
 * @skipline elm_button_add
1629
 * @until content_left_set
1630
 *
1631
 * The content of the right side will be something a bit more elaborated, we'll
1632
 * place another panes, displayed vertically (it's displayed horizontally
1633
 * by default):
1634
 * @skipline elm_panes_add
1635
 * @until content_right_set
1636
 *
1637
 * When populating a panes displayed vertically, remember that left content
1638
 * will be placed at top, and right content will place at bottom. Next
1639
 * we will add two buttons to exemplify that:
1640
 * @skipline elm_button_add
1641
 * @until content_right_set
1642
 *
1643
 * Panes widgets emits 4 different signals, depending on users interaction
1644
 * with the draggable bar. We'll add a callback function for each of them.
1645
 *
1646
 * <tt> "clicked" signal </tt>:
1647
 *
1648
 * Callback function that just print "Clicked" to stdin:
1649
 * @dontinclude panes_example.c
1650
 * @skip static void
1651
 * @skip }
1652
 * @skip static void
1653
 * @skip }
1654
 * @skip static void
1655
 * @skip }
1656
 * @skipline static void
1657
 * @until }
1658
 *
1659
 * Also, add callback function to the panes:
1660
 * @skipline "clicked"
1661
 *
1662
 * <tt> "press" signal </tt>:
1663
 *
1664
 * Callback function that just print "Pressed" to stdin:
1665
 * @dontinclude panes_example.c
1666
 * @skip static void
1667
 * @skip }
1668
 * @skipline static void
1669
 * @until }
1670
 *
1671
 * Also, add callback function to the panes:
1672
 * @skipline "press"
1673
 *
1674
 * Now, let's try to make our callback functions a bit more useful:
1675
 *
1676
 * <tt> "unpress" signal </tt>:
1677
 *
1678
 * Suppose we want to know the size proportion of left content after
1679
 * user drags the bar. We need to listen for @c unpress signal, and
1680
 * get this size from our panes widget. It's done on the following
1681
 * function:
1682
 * @dontinclude panes_example.c
1683
 * @skip static void
1684
 * @skip }
1685
 * @skip static void
1686
 * @skip }
1687
 * @skipline static void
1688
 * @until }
1689
 *
1690
 * Adding the callback function to the panes:
1691
 * @skipline "unpress"
1692

1693
 * <tt> "clicked,double" signal </tt>:
1694
 *
1695
 * Now, a interesting feature that could be addded to panes widget.
1696
 * Hide a content when user double click the draggable bar. It's done
1697
 * using a variable to store size and content left size getter and setter
1698
 * on the following function:
1699
 * @dontinclude panes_example.c
1700
 * @skipline static double
1701
 * @skip static void
1702
 * @skip }
1703
 * @skip static void
1704
 * @skip }
1705
 * @skip static void
1706
 * @skip }
1707
 * @skipline static void
1708
 * @until }
1709
 * @until }
1710
 * @until }
1711
 *
1712
 * Adding the callback function to the panes:
1713
 * @skipline "clicked,double"
1714
 * @until panes);
1715
 *
1716
 * See the full @ref panes_example.c "example", whose window should
1717
 * look like this picture:
1718
 *
1719
 * @image html screenshots/panes_example.png
1720
 * @image latex screenshots/panes_example.eps width=\textwidth
1721
 *
1722
 * @example panes_example.c
1723
 */
1724

1725
/**
1726
 * @page clock_example Clock widget example
1727
 *
1728
 * This code places five Elementary clock widgets on a window, each of
1729
 * them exemplifying a part of the widget's API.
1730
 *
1731
 * The first of them is the pristine clock:
1732
 * @dontinclude clock_example.c
1733
 * @skip pristine
1734
 * @until evas_object_show
1735
 * As you see, the defaults for a clock are:
1736
 * - military time
1737
 * - no seconds shown
1738
 *
1739
 * For am/pm time, see the second clock:
1740
 * @dontinclude clock_example.c
1741
 * @skip am/pm
1742
 * @until evas_object_show
1743
 *
1744
 * The third one will show the seconds digits, which will flip in
1745
 * synchrony with system time. Note, besides, that the time itself is
1746
 * @b different from the system's -- it was customly set with
1747
 * elm_clock_time_set():
1748
 * @dontinclude clock_example.c
1749
 * @skip with seconds
1750
 * @until evas_object_show
1751
 *
1752
 * In both fourth and fifth ones, we turn on the <b>edition
1753
 * mode</b>. See how you can change each of the sheets on it, and be
1754
 * sure to try holding the mouse pressed over one of the sheet
1755
 * arrows. The forth one also starts with a custom time set:
1756
 * @dontinclude clock_example.c
1757
 * @skip in edition
1758
 * @until evas_object_show
1759
 *
1760
 * The fifth, besides editable, has only the time @b units editable,
1761
 * for hours, minutes and seconds. This exemplifies
1762
 * elm_clock_edit_mode_set():
1763
 * @dontinclude clock_example.c
1764
 * @skip but only
1765
 * @until evas_object_show
1766
 *
1767
 * See the full @ref clock_example.c "example", whose window should
1768
 * look like this picture:
1769
 *
1770
 * @image html screenshots/clock_example.png
1771
 * @image latex screenshots/clock_example.eps width=\textwidth
1772
 *
1773
 * See the full @ref clock_example_c "source code" for this example.
1774
 *
1775
 */
1776

1777
/**
1778
 * @page datetime_example Datetime widget example
1779
 *
1780
 * This code places three Elementary Datetime widgets on a window, each of
1781
 * them exemplifying the widget's different usage.
1782
 *
1783
 * The first of them is <b>"only Date display"</b>:
1784
 * @dontinclude datetime_example.c
1785
 * @skip only DATE
1786
 * @until evas_object_show
1787
 *
1788
 * For <b>"only Time display"</b>, see the second datetime:
1789
 * @dontinclude datetime_example.c
1790
 * @skip only TIME
1791
 * @until evas_object_show
1792
 *
1793
 * The third one will display datetime shows both <b>Date and Time</b>, corresponding format will be
1794
 * taken from system @b locale. Note, besides, that the strings are different
1795
 *  for different language settings.
1796
 *
1797
 * <b>Datetime format</b> can be programmatically set by using
1798
 * elm_datetime_format_set():
1799
 * @dontinclude datetime_example.c
1800
 * @skip DATE and TIME
1801
 * @until evas_object_show
1802
 * The default format of any locale consists:
1803
 * - Year Field
1804
 * - Month Field
1805
 * - Date Field
1806
 * - Hour Field(12hr/24hr format)
1807
 * - Minute Field
1808
 * - AM/PM (if exists).
1809
 *
1810
 * This is how the example program's window looks like with the datetime widget
1811
 * showing only date, only time and both date & time:
1812
 *
1813
 * @image html screenshots/datetime_example.png
1814
 * @image latex screenshots/datetime_example.eps width=\textwidth
1815
 *
1816
 * See the full @ref datetime_example_c "source code" for
1817
 * this example.
1818
 *
1819
 */
1820

1821
/**
1822
 * @page dayselector_example Dayselector widget example
1823
 *
1824
 * This code places two Elementary dayselector widgets on a window, each of
1825
 * them exemplifying the different widget styles.
1826
 *
1827
 * The first of them is the dayselector in default style:
1828
 * @dontinclude dayselector_example.c
1829
 * @skip weekdays starting from Sunday
1830
 * @until evas_object_show
1831
 *
1832
 * As you see, the default style displays the weekdays starting from Sunday.
1833
 *
1834
 * One can select/unselect a day just by clicking on the day object.
1835
 * The selection toggles once it is being pressed.
1836
 *
1837
 *
1838
 * For showing weekdays starting from Monday, see the second dayselector:
1839
 * @dontinclude dayselector_example.c
1840
 * @skip weekdays starting from Monday
1841
 * @until evas_object_show
1842
 *
1843
 *
1844
 * The following code exemplifies the selection APIs of Dayselector:
1845
 * @dontinclude dayselector_example.c
1846
 * @skip Callback function
1847
 * @until End of clicked callback
1848
 *
1849
 *
1850
 * See the full @ref dayselector_example.c "example", whose window should
1851
 * look like this picture:
1852
 *
1853
 * @image html screenshots/dayselector_example.png
1854
 * @image latex screenshots/dayselector_example.eps width=\textwidth
1855
 *
1856
 * See the full @ref dayselector_example_c "source code" for this example.
1857
 *
1858
 */
1859

1860
/**
1861
 * @page mapbuf_example Mapbuf Widget Example
1862
 *
1863
 * This code places an Elementary mapbuf widget on a window,
1864
 * to exemplify part of the widget's API.
1865
 *
1866
 * First we'll add an window with a background and a vertical box to
1867
 * pack our interface elements:
1868
 * @dontinclude mapbuf_example.c
1869
 * @skipline win_add
1870
 * @until show(bx)
1871
 *
1872
 * Next we'll simply add the mapbuf widget to the box:
1873
 * @skipline mapbuf_add
1874
 * @until pack_end
1875
 *
1876
 * But mapbuf is a container widget, it won't do anything alone. So let's
1877
 * create a table full of icons. For that we'll loop to fill each line of each
1878
 * column. See @ref tutorial_table_01 "tutorial_table_01"
1879
 * if you don't know how to use tables:
1880
 * @skipline table_add
1881
 * @until }
1882
 * @until }
1883
 *
1884
 * Finally, setting mapbuf content:
1885
 * @skipline content_set
1886
 * @skipline show
1887
 *
1888
 * Also, would be good a horizontal box with some controls to change mapbuf
1889
 * behavior:
1890
 * @skipline box_add
1891
 * @until show
1892
 *
1893
 * By default map is disabled. So just setting content isn't enough.
1894
 * Alpha and smooth settings will be applied when map is enabled.
1895
 * So we'll add a check for that. Everytime the map properties
1896
 * are changed, map will need to be enabled again. So if you
1897
 * want to play a bit with our example, remember to always enable
1898
 * map again after concluding your changes.
1899
 * @skipline check_add
1900
 * @until show
1901
 *
1902
 * We have added a callback function to this check, so it will enable
1903
 * or disable map:
1904
 * @dontinclude mapbuf_example.c
1905
 * @skip static
1906
 * @skip }
1907
 * @skipline static
1908
 * @until }
1909
 *
1910
 * Let's add check boxes for alpha blending and smooth rendering:
1911
 * @skipline check_add
1912
 * @until show
1913
 * @until show
1914
 *
1915
 * By default, mapbuf would enable alpha blending and smooth rendering,
1916
 * so we need to check boxes to be consistent with its behavior.
1917
 *
1918
 * Callback functions look like the one added to the check. This way we
1919
 * could enable or disable the both properties:
1920
 * @dontinclude mapbuf_example.c
1921
 * @skip static
1922
 * @skip }
1923
 * @skip static
1924
 * @skip }
1925
 * @skipline static
1926
 * @until }
1927
 * @until }
1928
 *
1929
 * You'll see that disabling alpha blending will set a black rectangle below
1930
 * the icons. That's the reason you only should enable that when you're sure
1931
 * the mapbuf content is 100% solid.
1932
 *
1933
 * See @ref mapbuf_example.c "mapbuf_example.c", whose window should
1934
 * look like this picture:
1935
 *
1936
 * @image html screenshots/mapbuf_example.png
1937
 * @image latex screenshots/mapbuf_example.eps width=\textwidth
1938
 *
1939
 * @example mapbuf_example.c
1940
 */
1941

1942
/**
1943
 * @page map_example_01 Map Example - Creation and Zoom
1944
 *
1945
 * This code places an Elementary map widget on a window,
1946
 * to exemplify part of the widget's API.
1947
 *
1948
 * Let's start adding a map to our window:
1949
 * @dontinclude map_example_01.c
1950
 * @skipline elm_map_add
1951
 * @until evas_object_show
1952
 *
1953
 * It's enough to display a world map inside our window. But usually you'll
1954
 * need to let user interact with the map. We need to place some buttons,
1955
 * so the user could control the map. It's done on the following code.
1956
 * If you don't know about boxes, or buttons, check their examples,
1957
 * @ref box_example_01 "Box Example 1" and
1958
 * @ref button_example_01 "Button Example 1".
1959
 * @skipline elm_box_add
1960
 * @until _bt_zoom_fill
1961
 *
1962
 * We are adding callback functions that will be called when the user clicks
1963
 * over these buttons. Let's study such functions, starting from the function
1964
 * that will zoom in the map:
1965
 * @dontinclude map_example_01.c
1966
 * @skipline static void
1967
 * @until }
1968
 *
1969
 * First thing done is assure zoom mode is set to manual. It's the default
1970
 * mode, but the other buttons will change this, so before setting a new
1971
 * zoom value, we need to change the zoom mode.
1972
 *
1973
 * Then, we get the current zoom value, increment that, and set the new
1974
 * value to the map. If it's bigger than max zoom value allowed, it will
1975
 * remain on the maximum allowed, nothing bad will happen. This way we
1976
 * don't need to check first if it won't be bigger than max.
1977
 *
1978
 * Zoom out function is basically the same thing, but zoom will be decremented
1979
 * instead of incremented:
1980
 * @skipline static void
1981
 * @until }
1982
 *
1983
 * The "X" button, when pressed, will call a function that will
1984
 * zoom the map until it fits
1985
 * inside the scroll frame with no pixels outside this area:
1986
 * @skipline static void
1987
 * @until }
1988
 *
1989
 * And the "#" button, will call a function that will zoom until map fills
1990
 * scroll, ensuring no pixels are left unfilled:
1991
 * @skipline static void
1992
 * @until }
1993
 *
1994
 * But we can also set map to show something different from default
1995
 * world map, changing the zoom level and region shown. Let's pick a
1996
 * wonderful city coordinates, one placed at <tt> 43 20 S, 22 90 W </tt>.
1997
 * Since map uses double variables to represent latitude and longitude,
1998
 * to represent north or east, we should represent it as positive values,
1999
 * and south or west as negative. Also, the value will be represented as
2000
 * degree.min. So, for example, our longitude <tt> 43 20 S </tt> will
2001
 * be represented
2002
 * by the value <tt> -43.20 </tt>. A zoom set to @c 12 should be enough
2003
 * to show a city.
2004
 * @skipline region_show
2005
 * @until zoom_set
2006
 *
2007
 * See @ref map_example_01.c "map_example_01.c" for full source,
2008
 * whose window should
2009
 * look like this picture:
2010
 *
2011
 * @image html screenshots/map_example_01.png
2012
 * @image latex screenshots/map_example_01.eps width=\textwidth
2013
 *
2014
 * @example map_example_01.c
2015
 */
2016

2017
/**
2018
 * @page map_example_02 Map Example - Overlay Usage
2019
 *
2020
 * This code places an Elementary map widget on a window,
2021
 * to exemplify part of the widget's API, related to overlays.
2022
 *
2023
 * We'll start this example in the same way as
2024
 * @ref map_example_01 "Map Example 1". Adding a map with buttons to control
2025
 * zoom, so if you didn't read it yet, just do it now.
2026
 * @dontinclude map_example_02.c
2027
 * @skipline elm_map_add
2028
 * @until zoom_fill
2029
 *
2030
 * Overlays can be placed over the map to represent anything we want. Let's
2031
 * say we want to represent some countries and cities with overlays.
2032
 *
2033
 * Before we create city or country overlays, let's create class overlays.
2034
 *
2035
 * @skipline elm_map_overlay_class_add
2036
 * @until elm_map_overlay_icon_set
2037
 * These lines create a class overlay which represents cities.
2038
 * This class overlay will be used for grouping city overlays.
2039
 * Later city overlays in the same class are appended to this class overlay.
2040
 * if city overlays are near each other, they will be grouped.
2041
 *
2042
 * We can set the icon for the class so that the icon will be displayed
2043
 * when city overlays are grouped.
2044
 * We can set the zoom required to display the overlays that belongs
2045
 * to this class, so if the zoom is less than this value, nothing
2046
 * will be shown.
2047
 *
2048
 * Country class can be created in the same way.
2049
 * @skipline elm_map_overlay_class_add
2050
 * @until elm_map_overlay_icon_set
2051
 *
2052
 * Next we'll create some overlays representing cities and countries.
2053
 * We set the data for the overlay so that can be used later when
2054
 * clicked callback is called.
2055
 * We'll append them into city class to be grouped.
2056
 * We'll append them in a list, to close up them later.
2057
 * To create a default overlay, we need to pass the coordinates.
2058
 * @skipline elm_map_overlay_add
2059
 * @until eina_list_append
2060
 *
2061
 * We subscribe a smart callback "overlay,clicked" to create bubble on
2062
 * the clicked overlay.
2063
 * @dontinclude map_example_02.c
2064
 * @skipline "overlay,clicked"
2065
 *
2066
 * Finally, on our @c main function, we ask the map to show all the overlays
2067
 * with the biggest zoom possible, passing the list of overlays added.
2068
 * @skipline elm_map_overlays_show
2069
 *
2070
 * We have created a specific structure for this example to store the name
2071
 * of the place and a path to a image file to represent it.
2072
 * @dontinclude map_example_02.c
2073
 * @skipline typedef
2074
 * @until Overlay_Data;
2075
 *
2076
 * We'll create instances for each place:
2077
 * @skipline argentina
2078
 * @until sky_03
2079
 *
2080
  * To return an icon, all we need to do is to add a elm_icon and return it:
2081
 * @dontinclude map_example_02.c
2082
 * @skipline _icon_get(
2083
 * @until }
2084
 *
2085
 * For the content, let's return something more elaborate. We will return
2086
 * a box with an image representing the place, and the name of this place:
2087
 * @skipline _box_get(
2088
 * @until }
2089
 *
2090
 * See @ref map_example_02.c "map_example_02.c" for full source,
2091
 * whose window should
2092
 * look like this picture:
2093
 *
2094
 * @image html screenshots/map_example_02.png
2095
 * @image latex screenshots/map_example_02.eps width=\textwidth
2096
 *
2097
 * @example map_example_02.c
2098
 */
2099

2100
/**
2101
 * @page map_example_03 Map Example - Route and Name Usage
2102
 *
2103
 * This code places an Elementary map widget on a window,
2104
 * to exemplify part of the widget's API, related routes and names.
2105
 *
2106
 * In this example, we will suppose we need to set a route for the user
2107
 * from his current point (a gps could provide us this information)
2108
 * to somewhere else. So we would have coordinates of this
2109
 * start point, and would like that he enters the address of his
2110
 * destination in a entry, and we'll trace a route on the map.
2111
 *
2112
 * We'll start this example in the same way
2113
 * @ref map_example_01 "Map Example 1". Adding a map with buttons to control
2114
 * zoom, so if you didn't read it yet, just do it now. Actually there is
2115
 * a change, that we're aligning buttons to the top, since we want a
2116
 * vertical control box this time.
2117
 * @dontinclude map_example_03.c
2118
 * @skipline elm_map_add
2119
 * @until zoom_fill
2120
 * @until align_set
2121
 *
2122
 * Next we set the box to be vertical and change it's size, weight
2123
 * and alignment, so it will occupy the top of the window, from left
2124
 * to right:
2125
 * @skipline horizontal_set
2126
 * @until align_set
2127
 *
2128
 * We'll add an entry with a preliminary address, that I know will
2129
 * find a coordinate, to exemplify how names work. But you can try
2130
 * lots of addresses. From city or country names to pubs, or whatever
2131
 * you want. To try is enough to run the example, type the address and
2132
 * press "Route" button. This button will call a function that will
2133
 * get the typed address and find the route.
2134
 * @skipline entry_add
2135
 * @until align_set
2136
 * @until align_set
2137
 *
2138
 * The button pass an structure
2139
 * instance we make for this example, with all the fields we'll need.
2140
 * @dontinclude map_example_03.c
2141
 * @skipline _Example_Data
2142
 * @until example_data;
2143
 *
2144
 * Let's initialize it's fields:
2145
 * @skipline example_data.map
2146
 * @until example_data.start_lat
2147
 *
2148
 * @c map and @c entry are our elementary objects, @c route is set to @c NULL,
2149
 * since we don't have one yet, and the coordinates of the start point is set
2150
 * (longitude and latitude).
2151
 *
2152
 * Also, let's show this start point at the center of the map, and set a zoom
2153
 * nice enough to close it:
2154
 * @skipline region_show
2155
 * @until zoom_set
2156
 *
2157
 * These lines were already explained on @ref map_example_02 "Map Example 2".
2158
 *
2159
 * Now we'll see the "Route" button callback function:
2160
 * @dontinclude map_example_03.c
2161
 * @skip static void
2162
 * @skip }
2163
 * @skipline static void
2164
 * @until }
2165
 *
2166
 * First we get the address string from our entry. Then we use @c name
2167
 * conversion
2168
 * util functions, so we could get coordinates for this address. These
2169
 * functions return an #Elm_Map_Name handle for us.
2170
 * Function elm_map_name_geo_request() will do this job for us,
2171
 * but it's an asynchronous function, since it requires this
2172
 * information from the server.
2173
 *
2174
 * That's the reason we need to wait for
2175
 * <tt> "name,loaded" </tt> signal. We add a callback function for this:
2176
 * @dontinclude map_example_03.c
2177
 * @skipline static void
2178
 * @until }
2179
 *
2180
 * This function will check if a previous route was traced, and if it was,
2181
 * it will remove it. Next we'll get destination coordinates from our
2182
 * @c name, and use them to add a new route.
2183
 *
2184
 * To trace a route we need to know how the user will go through the path.
2185
 * Let's suppose he'll be walking, but doesn't like to walk, so we
2186
 * need to choose the shortest path instead of the route that would
2187
 * made him spend less time. Coordinates of the point from where he will
2188
 * start and of the destination point need to be passed as well.
2189
 *
2190
 * Finally we'll set a color different from solid red (default), to show
2191
 * our route. We set it green.
2192
 *
2193
 * See @ref map_example_03.c "map_example_03.c" for full source,
2194
 * whose window should
2195
 * look like this picture:
2196
 *
2197
 * @image html screenshots/map_example_03.png
2198
 * @image latex screenshots/map_example_03.eps width=\textwidth
2199
 *
2200
 * @example map_example_03.c
2201
 */
2202

2203
/**
2204
 * @page diskselector_example_01 Diskselector widget example
2205
 *
2206
 * This code places 4 Elementary diskselector widgets on a window, each of
2207
 * them exemplifying a part of the widget's API.
2208
 *
2209
 * All of them will have weekdays as items, since we won't focus
2210
 * on items management on this example. For an example about this subject,
2211
 * check @ref diskselector_example_02.
2212
 *
2213
 * The first of them is a default diskselector.
2214
 * @dontinclude diskselector_example_01.c
2215
 * @skipline lbl
2216
 * @until }
2217
 * @skipline elm_diskselector_add
2218
 * @until evas_object_show
2219
 *
2220
 * We are just adding the diskselector, so as you can see, defaults for it are:
2221
 * @li Only 3 items visible each time.
2222
 * @li Only 3 characters are displayed for labels on side positions.
2223
 * @li The first added item remains centered, i.e., it's the selected item.
2224
 *
2225
 * To add items, we are just appending it on a loop, using function
2226
 * elm_diskselector_item_append(), that will be better explained on
2227
 * items management example.
2228
 *
2229
 * For a circular diskselector, check the second widget. A circular
2230
 * diskselector will display first item after last, and last previous to
2231
 * the first one. So, as you can see, @b Sa will appears on left side
2232
 * of selected @b Sunday. This property is set with
2233
 * elm_diskselector_round_enabled_set().
2234
 *
2235
 * Also, we decide to display only 2 character for side labels, instead of 3.
2236
 * For this we call elm_diskselector_side_text_max_length_set(). As result,
2237
 * we'll see @b Mo displayed instead of @b Mon, when @b Monday is on a
2238
 * side position.
2239
 *
2240
 * @skipline elm_diskselector_add
2241
 * @until evas_object_show
2242
 *
2243
 * But so far, we are only displaying 3 items at once. If more are wanted,
2244
 * is enough to call elm_diskselector_display_item_num_set(), as you can
2245
 * see here:
2246
 * @skipline elm_diskselector_add
2247
 * @until elm_diskselector_display_item_num_set
2248
 *
2249
 * @note You can't set less than 3 items to be displayed.
2250
 *
2251
 * You can get the number of items in the diskselector by calling
2252
 * elm_diskselector_display_item_num_get(), as you can see here:
2253
 * @skipline elm_diskselector_display_item_num_get
2254
 *
2255
 * Finally, if a bounce effect is required, or you would like to see
2256
 * scrollbars, it is possible. But, for default theme, diskselector
2257
 * scrollbars will be invisible anyway.
2258
 * @skipline elm_diskselector_add
2259
 * @until evas_object_show
2260
 *
2261
 * See the full @ref diskselector_example_01.c "diskselector_example_01.c"
2262
 * code, whose window should look like this picture:
2263
 *
2264
 * @image html screenshots/diskselector_example_01.png
2265
 * @image latex screenshots/diskselector_example_01.eps width=\textwidth
2266
 *
2267
 * @example diskselector_example_01.c
2268
 */
2269

2270
/**
2271
 * @page diskselector_example_02 Diskselector - Items management
2272
 *
2273
 * This code places an Elementary diskselector widgets on a window,
2274
 * along with some buttons trigerring actions on it (though its API).
2275
 * It covers most of diskselector item functions.
2276
 *
2277
 * On our @c main function, we are adding a default diskselector with
2278
 * 3 items. We are only setting their labels (second parameter of function
2279
 * elm_diskselector_item_append):
2280
 * @dontinclude diskselector_example_02.c
2281
 * @skipline elm_diskselector_add
2282
 * @until Item 2
2283
 *
2284
 * Next we are adding lots of buttons, each one for a callback function
2285
 * that will realize a task covering part of diskselector items API.
2286
 * Lets check the first one:
2287
 * @skipline elm_button_add
2288
 * @until evas_object_show
2289
 *
2290
 * We are labeling the button with a task description with
2291
 * elm_object_text_set() and setting a callback
2292
 * function evas_object_smart_callback_add().
2293
 * Each callback function will have the signature:
2294
 * <tt> static void _task_cb(void *data, Evas_Object *obj,
2295
 * void *event_info)</tt> with the function name varying for each task.
2296
 *
2297
 * Now let's cover all of them.
2298
 *
2299
 * <b> Appending an item: </b>
2300
 * @dontinclude diskselector_example_02.c
2301
 * @skipline _add_cb
2302
 * @until }
2303
 *
2304
 * All items are included on diskselector after last one. You @b can't
2305
 * prepend items.
2306
 *
2307
 * The first parameter of elm_diskselector_item_append() is the diskselector
2308
 * object, that we are receiving as data on our callback function.
2309
 * The second one is a label, the string that will be placed in the center
2310
 * of our item. As we don't want icons or callback functions, we can
2311
 * send NULL as third, fourth and fifth parameters.
2312
 *
2313
 * <b> Appending an item with icon: </b>
2314
 * @dontinclude diskselector_example_02.c
2315
 * @skipline _add_ic_cb
2316
 * @until }
2317
 *
2318
 * If an icon is required, you can pass it as third parameter on our
2319
 * elm_diskselector_item_append() function. It will be place on the
2320
 * left side of item's label, that will be shifted to right a bit.
2321
 *
2322
 * For more details about how to create icons, look for elm_icon examples.
2323
 *
2324
 * <b> Appending an item with callback function for selected: </b>
2325
 * @dontinclude diskselector_example_02.c
2326
 * @skipline _sel_cb
2327
 * @until }
2328
 * @until }
2329
 *
2330
 * To set a callback function that will be called every time an item is
2331
 * selected, i.e., everytime the diskselector stops with this item in
2332
 * center position, just pass the function as fourth parameter.
2333
 *
2334
 * <b> Appending an item with callback function for selected with data: </b>
2335
 * @dontinclude diskselector_example_02.c
2336
 * @skipline _sel_data_cb
2337
 * @until }
2338
 * @until }
2339
 * @until }
2340
 * @until }
2341
 *
2342
 * If the callback function request an extra data, it can be attached to our
2343
 * item passing a pointer for data as fifth parameter.
2344
 * Our function _sel_data_cb will receive it as <tt> void *data </tt>.
2345
 *
2346
 * If you want to free this data, or handle that the way you need when the
2347
 * item is deleted, set a callback function for that, with
2348
 * elm_object_item_del_cb_set().
2349
 *
2350
 * As you can see we check if @c it is not @c NULL after appending it.
2351
 * If an error happens, we won't try to set a function for it.
2352
 *
2353
 * <b> Deleting an item: </b>
2354
 * @dontinclude diskselector_example_02.c
2355
 * @skipline _del_cb(void
2356
 * @until }
2357
 *
2358
 * To delete an item we simple need to call elm_object_item_del() with
2359
 * a pointer for such item.
2360
 *
2361
 * If you need, you can get selected item with
2362
 * elm_diskselector_selected_item_get(), that will return a pointer for it.
2363
 *
2364
 * <b> Unselecting an item: </b>
2365
 * @dontinclude diskselector_example_02.c
2366
 * @skipline _unselect_cb
2367
 * @until }
2368
 *
2369
 * To select an item, you should call elm_diskselector_item_selected_set()
2370
 * passing @c EINA_TRUE, and to unselect it, @c EINA_FALSE.
2371
 *
2372
 * If you unselect the selected item, diskselector will automatically select
2373
 * the first item.
2374
 *
2375
 * <b> Printing all items: </b>
2376
 * @dontinclude diskselector_example_02.c
2377
 * @skipline _print_cb
2378
 * @until }
2379
 *
2380
 * <b> Clearing the diskselector: </b>
2381
 * @dontinclude diskselector_example_02.c
2382
 * @skipline _clear_cb
2383
 * @until }
2384
 *
2385
 * <b> Selecting the first item: </b>
2386
 * @dontinclude diskselector_example_02.c
2387
 * @skipline _select_first_cb
2388
 * @until }
2389
 *
2390
 * <b> Selecting the last item: </b>
2391
 * @dontinclude diskselector_example_02.c
2392
 * @skipline _select_last_cb
2393
 * @until }
2394
 *
2395
 * <b> Selecting the next item: </b>
2396
 * @dontinclude diskselector_example_02.c
2397
 * @skipline _select_next_cb
2398
 * @until }
2399
 *
2400
 * <b> Selecting the previous item: </b>
2401
 * @dontinclude diskselector_example_02.c
2402
 * @skipline _select_prev_cb
2403
 * @until }
2404
 *
2405
 * See the full @ref diskselector_example_02.c "diskselector_example_02.c"
2406
 * code, whose window should look like this picture:
2407
 *
2408
 * @image html screenshots/diskselector_example_02.png
2409
 * @image latex screenshots/diskselector_example_02.eps width=\textwidth
2410
 *
2411
 * @example diskselector_example_02.c
2412
 */
2413

2414
/**
2415
 * @page list_example_01 List widget example
2416
 *
2417
 * This code places a single Elementary list widgets on a window, just
2418
 * to exemplify the more simple and common use case: a list will be created
2419
 * and populated with a few items.
2420
 *
2421
 * To keep it simple, we won't show how to customize the list, for this check
2422
 * @ref list_example_02. Also, we won't focus
2423
 * on items management on this example. For an example about this subject,
2424
 * check @ref list_example_03.
2425
 *
2426
 * To add a list widget.
2427
 * @dontinclude list_example_01.c
2428
 * @skipline elm_list_add
2429
 *
2430
 * We are just adding the list, so as you can see, defaults for it are:
2431
 * @li Items are displayed vertically.
2432
 * @li Only one item can be selected.
2433
 * @li The list doesn't bounce.
2434
 *
2435
 * To add items, we are just appending it on a loop, using function
2436
 * elm_list_item_append(), that will be better explained on
2437
 * items management example.
2438
 * @dontinclude list_example_01.c
2439
 * @skipline lbl[]
2440
 * @until };
2441
 * @skipline for
2442
 * @skipline elm_list_item_append
2443
 *
2444
 * After we just want to show the list. But first we need to start the widget.
2445
 * It was done this way to improve widget's performance. So, always remember
2446
 * that:
2447
 * @warning Call elm_list_go before showing the object
2448
 * @skipline elm_list_go
2449
 * @skipline show
2450
 *
2451
 * See the full @ref list_example_01.c "list_example_01.c"
2452
 * code, whose window should look like this picture:
2453
 *
2454
 * @image html screenshots/list_example_01.png
2455
 * @image latex screenshots/list_example_01.eps width=\textwidth
2456
 *
2457
 * @example list_example_01.c
2458
 */
2459

2460
/**
2461
 * @page list_example_02 List widget example
2462
 *
2463
 * This code places a single Elementary list widgets on a window,
2464
 * exemplifying a part of the widget's API.
2465
 *
2466
 * First, we will just create a simple list, as done on @ref list_example_01 :
2467
 * @dontinclude list_example_02.c
2468
 * @skipline lbl
2469
 * @until }
2470
 * @skipline elm_list_add
2471
 * @until elm_list_item_append
2472
 *
2473
 * Now, let's customize this list a bit. First we will display items
2474
 * horizontally:
2475
 * @skipline horizontal_set
2476
 *
2477
 * Then we will choose another list mode. There are four of them, and
2478
 * the default #Elm_List_Mode is #ELM_LIST_SCROLL. Let's set compress mode:
2479
 * @skipline mode_set
2480
 *
2481
 * To enable multiple items selection, we need to enable it, since only one
2482
 * selected item is allowed by default:
2483
 * @skipline elm_list_multi_select_set
2484
 *
2485
 * We are not adding items with callback functions here,
2486
 * since we'll explain it better on  @ref list_example_03. But if the callback
2487
 * need to be called everytime user clicks an item, even if already selected,
2488
 * it's required to enable this behavior:
2489
 * @skipline elm_list_select_mode_set
2490
 *
2491
 * Finally, if a bounce effect is required, or you would like to see
2492
 * scrollbars, it is possible. But, for default theme, list
2493
 * scrollbars will be invisible anyway.
2494
 * @skipline bounce_set
2495
 * @until SCROLLER_POLICY_ON
2496
 *
2497
 * See the full @ref list_example_02.c "list_example_02.c"
2498
 * code, whose window should look like this picture:
2499
 *
2500
 * @image html screenshots/list_example_02.png
2501
 * @image latex screenshots/list_example_02.eps width=\textwidth
2502
 *
2503
 * @example list_example_02.c
2504
 */
2505

2506
/**
2507
 * @page list_example_03 List - Items management
2508
 *
2509
 * This code places an Elementary list widgets on a window,
2510
 * along with some buttons trigerring actions on it (though its API).
2511
 * It covers most of elm_list_item functions.
2512
 *
2513
 * On our @c main function, we are adding a default list with
2514
 * 3 items. We are only setting their labels (second parameter of function
2515
 * elm_list_item_append):
2516
 * @dontinclude list_example_03.c
2517
 * @skipline elm_list_add
2518
 * @until Item 2
2519
 *
2520
 * Next we are adding lots of buttons, each one for a callback function
2521
 * that will realize a task covering part of list items API.
2522
 * Lets check the first one:
2523
 * @skipline elm_button_add
2524
 * @until evas_object_show
2525
 *
2526
 * We are labeling the button with a task description with
2527
 * elm_object_text_set() and setting a callback
2528
 * function evas_object_smart_callback_add().
2529
 * Each callback function will have the signature:
2530
 * <tt> static void _task_cb(void *data, Evas_Object *obj,
2531
 * void *event_info)</tt> with the function name varying for each task.
2532
 *
2533
 * Now let's cover all of them.
2534
 *
2535
 * <b> Prepending an item: </b>
2536
 * @dontinclude list_example_03.c
2537
 * @skipline _prepend_cb
2538
 * @until }
2539
 *
2540
 * The item will be placed on the beginning of the list,
2541
 * i.e. it will be the first one.
2542
 *
2543
 * The first parameter of elm_list_item_prepend() is the list
2544
 * object, that we are receiving as data on our callback function.
2545
 * The second one is a label, the string that will be placed in the center
2546
 * of our item. As we don't want icons or callback functions, we can
2547
 * send NULL as third, fourth, fifth and sixth parameters.
2548
 *
2549
 * <b> Appending an item: </b>
2550
 * @dontinclude list_example_03.c
2551
 * @skipline _add_cb
2552
 * @until }
2553
 *
2554
 * Items included with append will be inserted inserted after the last one.
2555
 *
2556
 * <b> Appending an item with icon: </b>
2557
 * @dontinclude list_example_03.c
2558
 * @skipline _add_ic_cb
2559
 * @until }
2560
 *
2561
 * If an icon is required, you can pass it as third parameter on our
2562
 * elm_list_item_append() function. It will be place on the
2563
 * left side of item's label. If an icon is wanted on the right side,
2564
 * it should be passed as fourth parameter.
2565
 *
2566
 * For more details about how to create icons, look for elm_icon examples
2567
 * @ref tutorial_icon.
2568
 *
2569
 * <b> Appending an item with callback function for selected: </b>
2570
 * @dontinclude list_example_03.c
2571
 * @skipline _sel_cb
2572
 * @until }
2573
 * @until }
2574
 *
2575
 * To set a callback function that will be called every time an item is
2576
 * selected, i.e., everytime the list stops with this item in
2577
 * center position, just pass the function as fifth parameter.
2578
 *
2579
 * <b> Appending an item with callback function for selected with data: </b>
2580
 * @dontinclude list_example_03.c
2581
 * @skipline _sel_data_cb
2582
 * @until }
2583
 * @until }
2584
 * @until }
2585
 * @until }
2586
 *
2587
 * If the callback function request an extra data, it can be attached to our
2588
 * item passing a pointer for data as sixth parameter.
2589
 * Our function _sel_data_cb will receive it as <tt> void *data </tt>.
2590
 *
2591
 * If you want to free this data, or handle that the way you need when the
2592
 * item is deleted, set a callback function for that, with
2593
 * elm_object_item_del_cb_set().
2594
 *
2595
 * As you can see we check if @c it is not @c NULL after appending it.
2596
 * If an error happens, we won't try to set a function for it.
2597
 *
2598
 * <b> Deleting an item: </b>
2599
 * @dontinclude list_example_03.c
2600
 * @skipline _del_cb(
2601
 * @until }
2602
 *
2603
 * To delete an item we simple need to call elm_object_item_del() with
2604
 * a pointer for such item.
2605
 *
2606
 * If you need, you can get selected item with
2607
 * elm_list_selected_item_get(), that will return a pointer for it.
2608
 *
2609
 * <b> Unselecting an item: </b>
2610
 * @dontinclude list_example_03.c
2611
 * @skipline _unselect_cb
2612
 * @until }
2613
 *
2614
 * To select an item, you should call elm_list_item_selected_set()
2615
 * passing @c EINA_TRUE, and to unselect it, @c EINA_FALSE.
2616
 *
2617
 * <b> Printing all items: </b>
2618
 * @dontinclude list_example_03.c
2619
 * @skipline _print_cb
2620
 * @until }
2621
 *
2622
 * <b> Clearing the list: </b>
2623
 * @dontinclude list_example_03.c
2624
 * @skipline _clear_cb
2625
 * @until }
2626
 *
2627
 * <b> Selecting the next item: </b>
2628
 * @dontinclude list_example_03.c
2629
 * @skipline _select_next_cb
2630
 * @until }
2631
 *
2632
 * <b> Inserting after an item: </b>
2633
 * @dontinclude list_example_03.c
2634
 * @skipline _insert_after_cb
2635
 * @until }
2636
 *
2637
 * <b> Selecting the previous item: </b>
2638
 * @dontinclude list_example_03.c
2639
 * @skipline _select_prev_cb
2640
 * @until }
2641
 *
2642
 * <b> Inserting before an item: </b>
2643
 * @dontinclude list_example_03.c
2644
 * @skipline _insert_before_cb
2645
 * @until }
2646
 *
2647
 * If a separator is required, just set an item as such:
2648
 * @dontinclude list_example_03.c
2649
 * @skipline _set_separator_cb
2650
 * @until }
2651
 *
2652
 * Also an item can be disabled, and the user won't be allowed to (un)select it:
2653
 * @dontinclude list_example_03.c
2654
 * @skipline _disable_cb
2655
 * @until }
2656
 *
2657
 * See the full @ref list_example_03.c "list_example_03.c"
2658
 * code, whose window should look like this picture:
2659
 *
2660
 * @image html screenshots/list_example_03.png
2661
 * @image latex screenshots/list_example_03.eps width=\textwidth
2662
 *
2663
 * @example list_example_03.c
2664
 */
2665

2666
/**
2667
 * @page toolbar_example_01 Toolbar Example - Simple Items
2668
 *
2669
 * This code places an Elementary toolbar widget on a window,
2670
 * to exemplify part of the widget's API.
2671
 *
2672
 * Let's start adding a button to our window, that will have its text
2673
 * modified depending on which item is selected. It's used just to exemplify
2674
 * how to change a window content from the toolbar.
2675
 * @dontinclude toolbar_example_01.c
2676
 * @skipline elm_button_add
2677
 * @until evas_object_show
2678
 *
2679
 * Also, we'll need a toolbar widget, obviously:
2680
 * @skipline elm_toolbar_add
2681
 * @until evas_object_show
2682
 *
2683
 * When appending an item is possible to set an icon, label, and a callback
2684
 * function that will receive passed data.
2685
 * @skipline _item_append
2686
 * @until Folder
2687
 *
2688
 * It's possible to disable items, so the user can't select then. We will
2689
 * disable the third item:
2690
 * @skipline _item_append
2691
 * @until disable
2692
 *
2693
 * Our callbacks will just set button's label:
2694
 * @dontinclude toolbar_example_01.c
2695
 * @skip static
2696
 * @skip }
2697
 * @skipline static
2698
 * @until }
2699
 * @until }
2700
 * @until }
2701
 *
2702
 * By default, toolbars would display items homogeneously, so item with
2703
 * long labels, like the third, will make all of them occupy a lot of space.
2704
 * To avoid that, we can disable it:
2705
 * @dontinclude toolbar_example_01.c
2706
 * @skipline homogeneous
2707
 *
2708
 * Another default behavior, is to add an menu item if we have more items
2709
 * that would fit on toolbar size. To simply enable scroll, without menus,
2710
 * it's required to change toolbar's shrink mode:
2711
 * @dontinclude toolbar_example_01.c
2712
 * @skipline shrink
2713
 *
2714
 * See @ref toolbar_example_01.c "toolbar_example_01.c", whose window should
2715
 * look like this picture:
2716
 *
2717
 * @image html screenshots/toolbar_example_01.png
2718
 * @image latex screenshots/toolbar_example_01.eps width=\textwidth
2719
 *
2720
 * @example toolbar_example_01.c
2721
 */
2722

2723
/**
2724
 * @page toolbar_example_02 Toolbar Example - Items with States
2725
 *
2726
 * This code places an Elementary toolbar widget on a window,
2727
 * to exemplify part of the widget's API.
2728
 *
2729
 * Toolbar widgets has support to items with states. Each state
2730
 * can have it's own label, icon, and callback function.
2731
 *
2732
 * Let's start populating a toolbar with some regular items.
2733
 * If you don't know how to do that, see
2734
 * @ref toolbar_example_01 "Toolbar Example 1".
2735
 * @dontinclude toolbar_example_02.c
2736
 * @skipline elm_toolbar_add
2737
 * @until Update
2738
 *
2739
 * The only difference here is that we set shrink mode to #ELM_TOOLBAR_SHRINK_HIDE,
2740
 * that won't display items that doesn't fit to the window.
2741
 *
2742
 * Now, let's add an item with states. First, add the item just as any other.
2743
 * @skipline elm_toolbar_item_append
2744
 * @until _item_pressed
2745
 *
2746
 * After that states can be added to this item:
2747
 * @skipline state_add
2748
 * @until Full
2749
 * @until _item_pressed
2750
 *
2751
 * The both states and the item are using the same callback function,
2752
 * that will cycle between states and unselect the item. Unseleting
2753
 * is required because it won't call the callback if a user clicks
2754
 * over an item already selected:
2755
 * @dontinclude toolbar_example_02.c
2756
 * @skip static
2757
 * @skip }
2758
 * @skipline static
2759
 * @until }
2760
 *
2761
 * On our example, some items are hidden
2762
 * because we set the window to be small. But if an item should be displayed
2763
 * anyway, is needed to set its priority to be higher than others.
2764
 * Any positive value will be enough in our case. Let's force the item
2765
 * with multiple states to be displayed.
2766
 * @skipline priority
2767
 *
2768
 * See @ref toolbar_example_02.c "toolbar_example_02.c", whose window should
2769
 * look like this picture:
2770
 *
2771
 * @image html screenshots/toolbar_example_02.png
2772
 * @image latex screenshots/toolbar_example_02.eps width=\textwidth
2773
 *
2774
 * @example toolbar_example_02.c
2775
 */
2776

2777
/**
2778
 * @page toolbar_example_03 Toolbar Example - Items with Menus
2779
 *
2780
 * Toolbar widgets have support to items with menus. This kind
2781
 * of item will display a menu when selected by the user.
2782
 *
2783
 * Let's start populating a toolbar with some regular items, the same
2784
 * way we started @ref toolbar_example_02 "Toolbar Example 2".
2785
 * @dontinclude toolbar_example_03.c
2786
 * @skipline elm_toolbar_add
2787
 * @until Update
2788
 *
2789
 * The only difference is that we'll keep the default shrink mode, that
2790
 * adds an item with a menu of hidden items.
2791
 *
2792
 * So, a important thing to do is to set a parent for toolbar menus, or they
2793
 * will use the toolbar as parent, and its size will be restricted to that.
2794
 * @skipline parent_set
2795
 *
2796
 * Not only items' menus will respect this parent, but also the own toolbar
2797
 * menu, used to show hidden items.
2798
 *
2799
 * Next, let's add an item set to display a menu:
2800
 * @skipline elm_toolbar_item_append
2801
 * @until _menu_set
2802
 *
2803
 * Now, to add two options to this item, we can get the menu object and use
2804
 * it as a regular elm_menu. See @ref tutorial_menu "Menu example" for more
2805
 * about menu widget.
2806
 * @skipline _menu_get
2807
 * @until Full
2808
 *
2809
 * See @ref toolbar_example_03.c "toolbar_example_03.c", whose window should
2810
 * look like this picture:
2811
 *
2812
 * @image html screenshots/toolbar_example_03.png
2813
 * @image latex screenshots/toolbar_example_03.eps width=\textwidth
2814
 *
2815
 * @example toolbar_example_03.c
2816
 */
2817

2818
/**
2819
 * @page segment_control_example Segment Control Example
2820
 *
2821
 * This code places an Elementary segment control widgets on a window,
2822
 * to exemplify part of the widget's API.
2823
 *
2824
 * Let's start adding a segment control to our window:
2825
 * @dontinclude segment_control_example.c
2826
 * @skipline elm_segment_control_add
2827
 * @until evas_object_show
2828
 *
2829
 * Now will add an item only with label:
2830
 * @skipline item_add
2831
 *
2832
 * Really simple. To add an item with only an icon, the icon needs to be created
2833
 * first, them added with this same function:
2834
 * @skipline icon_add
2835
 * @until item_add
2836
 *
2837
 * If an item with label and icon is required, it can be done as well. In this
2838
 * case, instead of a label (or icon) centered, the item will display an icon
2839
 * at left and the label at right:
2840
 * @skipline icon_add
2841
 * @until item_add
2842
 *
2843
 * But, if you need to add some items that can have or not a label, but
2844
 * want that all of them looks the same way, with icon at left, just add
2845
 * an empty string label. It's done on our example to illustrate that:
2846
 * @skipline icon_add
2847
 * @until item_add
2848
 *
2849
 * So far, all the item were added to the last position of the widget,
2850
 * but if something different is required, it can be done using another
2851
 * insertion function. Let's suppose we want to put an item just before
2852
 * the last item:
2853
 * @skipline count
2854
 * @until insert_at
2855
 *
2856
 * There are two ways to delete items. Using the item handle, like:
2857
 * @skipline insert_at
2858
 * @until del
2859
 *
2860
 * Or using item's index:
2861
 * @skipline insert_at
2862
 * @until del_at
2863
 *
2864
 * To set properties of an item already added to the widget, you just need
2865
 * to get the item and set icon or label, as the following code shows:
2866
 * @skipline item_get
2867
 * @until label_set
2868
 *
2869
 * Finally, it's possible to select an item from the code, and also get
2870
 * the selected item. We will select the item at the center of the widget
2871
 * and print its position.
2872
 * @skipline count_get
2873
 * @until printf
2874
 *
2875
 * See the full @ref segment_control_example.c "example", whose window should
2876
 * look like this picture:
2877
 *
2878
 * @image html screenshots/segment_control_example.png
2879
 * @image latex screenshots/segment_control_example.eps width=\textwidth
2880
 *
2881
 * @example segment_control_example.c
2882
 */
2883

2884
/**
2885
 * @page flipselector_example Flip selector widget example
2886
 *
2887
 * This code places an Elementary flip selector widget on a window,
2888
 * along with two buttons trigerring actions on it (though its API).
2889
 *
2890
 * The selector is being populated with the following items:
2891
 * @dontinclude flipselector_example.c
2892
 * @skip lbl[]
2893
 * @until ;
2894
 *
2895
 * Next, we create it, populating it with those items and registering
2896
 * two (smart) callbacks on it:
2897
 * @dontinclude flipselector_example.c
2898
 * @skip fp = elm_flipselector_add
2899
 * @until object_show
2900
 *
2901
 * Those two callbacks will take place whenever one of those smart
2902
 * events occur, and they will just print something to @c stdout:
2903
 * @dontinclude flipselector_example.c
2904
 * @skip underflow callback
2905
 * @until }
2906
 * @until }
2907
 * Flip the sheets on the widget while looking at the items list, in
2908
 * the source code, and you'll get the idea of those events.
2909
 *
2910
 * The two buttons below the flip selector will take the actions
2911
 * described in their labels:
2912
 * @dontinclude flipselector_example.c
2913
 * @skip bt = elm_button_add
2914
 * @until callback_add(win
2915
 *
2916
 * @dontinclude flipselector_example.c
2917
 * @skip unselect the item
2918
 * @until }
2919
 * @until }
2920
 *
2921
 * Click on them to exercise those flip selector API calls. To
2922
 * interact with the other parts of this API, there's a command line
2923
 * interface, whose help string can be asked for with the 'h' key:
2924
 * @dontinclude flipselector_example.c
2925
 * @skip commands
2926
 * @until ;
2927
 *
2928
 * The 'n' and 'p' keys will exemplify elm_flipselector_flip_next()
2929
 * and elm_flipselector_flip_prev(), respectively. 'f' and 'l' account
2930
 * for elm_flipselector_first_item_get() and
2931
 * elm_flipselector_last_item_get(), respectively. Finally, 's' will
2932
 * issue elm_flipselector_selected_item_get() on our example flip
2933
 * selector widget.
2934
 *
2935
 * See the full @ref flipselector_example.c "example", whose window should
2936
 * look like this picture:
2937
 *
2938
 * @image html screenshots/flipselector_example.png
2939
 * @image latex screenshots/flipselector_example.eps width=\textwidth
2940
 *
2941
 * See the full @ref flipselector_example_c "source code" for this example.
2942
 *
2943
 */
2944

2945
/**
2946
 * @page fileselector_example File selector widget example
2947
 *
2948
 * This code places two Elementary file selector widgets on a window.
2949
 * The one on the left is layouting file system items in a @b list,
2950
 * while the the other is layouting them in a @b grid.
2951
 *
2952
 * The one having the majority of hooks of interest is on the left,
2953
 * which we create as follows:
2954
 * @dontinclude fileselector_example.c
2955
 * @skip first file selector
2956
 * @until object_show
2957
 *
2958
 * Note that we enable custom edition of file/directory selection, via
2959
 * the text entry it has on its bottom, via
2960
 * elm_fileselector_is_save_set(). It starts with the list view, which
2961
 * is the default, and we make it not expandable in place
2962
 * (elm_fileselector_expandable_set()), so that it replaces its view's
2963
 * contents with the current directory's entries each time one
2964
 * navigates to a different folder.  For both of file selectors we are
2965
 * starting to list the contents found in the @c "/tmp" directory
2966
 * (elm_fileselector_path_set()).
2967
 *
2968
 * Note the code setting it to "grid mode" and observe the differences
2969
 * in the file selector's views, in the example. We also hide the
2970
 * second file selector's Ok/Cancel buttons -- since it's there just
2971
 * to show the grid view (and navigation) -- via
2972
 * elm_fileselector_buttons_ok_cancel_set().
2973
 *
2974
 * The @c "done" event, which triggers the callback below
2975
 * @dontinclude fileselector_example.c
2976
 * @skip 'done' cb
2977
 * @until }
2978
 * will be called at the time one clicks the "Ok"/"Cancel" buttons of
2979
 * the file selector (on the left). Note that it will print the path
2980
 * to the current selection, if any.
2981
 *
2982
 * The @c "selected" event, which triggers the callback below
2983
 * @dontinclude fileselector_example.c
2984
 * @skip bt = 'selected' cb
2985
 * @until }
2986
 * takes place when one selects a file (if the file selector is @b not
2987
 * under folders-only mode) or when one selects a folder (when in
2988
 * folders-only mode). Experiment it by selecting different file
2989
 * system entries.
2990
 *
2991
 * What comes next is the code creating the three check boxes and two
2992
 * buttons below the file selector in the right. They will exercise a
2993
 * bunch of functions on the file selector's API, for the instance on
2994
 * the left. Experiment with them, specially the buttons, to get the
2995
 * difference between elm_fileselector_path_get() and
2996
 * elm_fileselector_selected_get().
2997
 *
2998
 * Finally, there's the code adding the second file selector, on the
2999
 * right:
3000
 * @dontinclude fileselector_example.c
3001
 * @skip second file selector
3002
 * @until object_show
3003
 *
3004
 * Pay attention to the code setting it to "grid mode" and observe the
3005
 * differences in the file selector's views, in the example. We also
3006
 * hide the second file selector's Ok/Cancel buttons -- since it's
3007
 * there just to show the grid view (and navigation) -- via
3008
 * elm_fileselector_buttons_ok_cancel_set().
3009
 *
3010
 * See the full @ref fileselector_example.c "example", whose window
3011
 * should look like this picture:
3012
 *
3013
 * @image html screenshots/fileselector_example.png
3014
 * @image latex screenshots/fileselector_example.eps width=\textwidth
3015
 *
3016
 * See the full @ref fileselector_example_c "source code" for this example.
3017
 *
3018
 */
3019

3020
/**
3021
 * @page fileselector_button_example File selector button widget example
3022
 *
3023
 * This code places an Elementary file selector button widget on a
3024
 * window, along with some other checkboxes and a text entry. Those
3025
 * are there just as knobs on the file selector button's state and to
3026
 * display information from it.
3027
 *
3028
 * Here's how we instantiate it:
3029
 * @dontinclude fileselector_button_example.c
3030
 * @skip ic = elm_icon_add
3031
 * @until evas_object_show
3032
 *
3033
 * Note that we set on it both icon and label decorations. It's set to
3034
 * list the contents of the @c "/tmp" directory, too, with
3035
 * elm_fileselector_button_path_set(). What follows are checkboxes to
3036
 * exercise some of its API functions:
3037
 * @dontinclude fileselector_button_example.c
3038
 * @skip ck = elm_check_add
3039
 * @until evas_object_show(en)
3040
 *
3041
 * The checkboxes will toggle whether the file selector button's
3042
 * internal file selector:
3043
 * - must have an editable text entry for file names (thus, be in
3044
 *   "save dialog mode")
3045
 * - is to be raised as an "inner window" (note it's the default
3046
 *   behavior) or as a dedicated window
3047
 * - is to populate its view with folders only
3048
 * - is to expand its folders, in its view, <b>in place</b>, and not
3049
 *   repainting it entirely just with the contents of a sole
3050
 *   directory.
3051
 *
3052
 * The entry labeled @c "Last selection" will exercise the @c
3053
 * "file,chosen" smart event coming from the file selector button:
3054
 * @dontinclude fileselector_button_example.c
3055
 * @skip hook on the
3056
 * @until toggle inwin
3057
 *
3058
 * Whenever you dismiss or acknowledges the file selector, after it's
3059
 * raised, the @c event_info string will contain the last selection on
3060
 * it (if any was made).
3061
 *
3062
 * This is how the example, just after called, should look like:
3063
 *
3064
 * @image html screenshots/fileselector_button_example_00.png
3065
 * @image latex screenshots/fileselector_button_example_00.eps width=\textwidth
3066
 *
3067
 * Click on the file selector button to raise its internal file
3068
 * selector, which will be contained on an <b>"inner window"</b>:
3069
 *
3070
 * @image html screenshots/fileselector_button_example_01.png
3071
 * @image latex screenshots/fileselector_button_example_01.eps width=\textwidth
3072
 *
3073
 * Toggle the "inwin mode" switch off and, if you click on the file
3074
 * selector button again, you'll get @b two windows, the original one
3075
 * (note the last selection there!)
3076
 *
3077
 * @image html screenshots/fileselector_button_example_02.png
3078
 * @image latex screenshots/fileselector_button_example_02.eps width=\textwidth
3079
 *
3080
 * and the file selector's new one
3081
 *
3082
 * @image html screenshots/fileselector_button_example_03.png
3083
 * @image latex screenshots/fileselector_button_example_03.eps width=\textwidth
3084
 *
3085
 * Play with the checkboxes to get the behavior changes on the file
3086
 * selector button. The respective API calls on the widget coming from
3087
 * those knobs where shown in the code already.
3088
 *
3089
 * See the full @ref fileselector_button_example_c "source code" for
3090
 * this example.
3091
 *
3092
 */
3093

3094
/**
3095
 * @page fileselector_entry_example File selector entry widget example
3096
 *
3097
 * This code places an Elementary file selector entry widget on a
3098
 * window, along with some other checkboxes. Those are there just as
3099
 * knobs on the file selector entry's state.
3100
 *
3101
 * Here's how we instantiate it:
3102
 * @dontinclude fileselector_entry_example.c
3103
 * @skip ic = elm_icon_add
3104
 * @until evas_object_show
3105
 *
3106
 * Note that we set on it's button both icon and label
3107
 * decorations. It's set to exhibit the path of (and list the contents
3108
 * of, when internal file selector is launched) the @c "/tmp"
3109
 * directory, also, with elm_fileselector_entry_path_set(). What
3110
 * follows are checkboxes to exercise some of its API functions:
3111
 * @dontinclude fileselector_entry_example.c
3112
 * @skip ck = elm_check_add
3113
 * @until callback_add(fs_entry
3114
 *
3115
 * The checkboxes will toggle whether the file selector entry's
3116
 * internal file selector:
3117
 * - must have an editable text entry for file names (thus, be in
3118
 *   "save dialog mode")
3119
 * - is to be raised as an "inner window" (note it's the default
3120
 *   behavior) or as a dedicated window
3121
 * - is to populate its view with folders only
3122
 * - is to expand its folders, in its view, <b>in place</b>, and not
3123
 *   repainting it entirely just with the contents of a sole
3124
 *   directory.
3125
 *
3126
 * Observe how the entry's text will match the string coming from the
3127
 * @c "file,chosen" smart event:
3128
 * @dontinclude fileselector_entry_example.c
3129
 * @skip hook on the
3130
 * @until }
3131
 * Whenever you dismiss or acknowledges the file selector, after it's
3132
 * raised, the @c event_info string will contain the last selection on
3133
 * it (if any was made).
3134
 *
3135
 * Try, also, to type in a valid system path and, then, open the file
3136
 * selector's window: it will start the file browsing there, for you.
3137
 *
3138
 * This is how the example, just after called, should look like:
3139
 *
3140
 * @image html screenshots/fileselector_entry_example_00.png
3141
 * @image latex screenshots/fileselector_entry_example_00.eps width=\textwidth
3142
 *
3143
 * Click on the file selector entry to raise its internal file
3144
 * selector, which will be contained on an <b>"inner window"</b>:
3145
 *
3146
 * @image html screenshots/fileselector_entry_example_01.png
3147
 * @image latex screenshots/fileselector_entry_example_01.eps width=\textwidth
3148
 *
3149
 * Toggle the "inwin mode" switch off and, if you click on the file
3150
 * selector entry again, you'll get @b two windows, the original one
3151
 * (note the last selection there!)
3152
 *
3153
 * @image html screenshots/fileselector_entry_example_02.png
3154
 * @image latex screenshots/fileselector_entry_example_02.eps width=\textwidth
3155
 *
3156
 * and the file selector's new one
3157
 *
3158
 * @image html screenshots/fileselector_entry_example_03.png
3159
 * @image latex screenshots/fileselector_entry_example_03.eps width=\textwidth
3160
 *
3161
 * Play with the checkboxes to get the behavior changes on the file
3162
 * selector entry. The respective API calls on the widget coming from
3163
 * those knobs where shown in the code already.
3164
 *
3165
 * See the full @ref fileselector_entry_example_c "source code" for
3166
 * this example.
3167
 *
3168
 */
3169

3170
/**
3171
 * @page layout_example_01 Layout - Content, Table and Box
3172
 *
3173
 * This example shows how one can use the @ref Elm_Layout widget to create a
3174
 * customized distribution of widgets on the screen, controlled by an Edje theme.
3175
 * The full source code for this example can be found at @ref
3176
 * layout_example_01_c.
3177
 *
3178
 * Our custom layout is defined by a file, @ref layout_example_edc, which is an
3179
 * Edje theme file. Look for the Edje documentation to understand it. For now,
3180
 * it's enough to know that we describe some specific parts on this layout
3181
 * theme:
3182
 * @li a title text field;
3183
 * @li a box container;
3184
 * @li a table container;
3185
 * @li and a content container.
3186
 *
3187
 * Going straight to the code, the following snippet instantiates the layout
3188
 * widget:
3189
 *
3190
 * @dontinclude layout_example_01.c
3191
 * @skip elm_layout_add
3192
 * @until evas_object_show(layout)
3193
 *
3194
 * As any other widget, we set some properties for the size calculation. But
3195
 * notice on this piece of code the call to the function elm_layout_file_set().
3196
 * Here is where the theme file is loaded, and particularly the specific group
3197
 * from this theme file. Also notice that the theme file here is referenced as
3198
 * an .edj, which is a .edc theme file compiled to its binary form. Again, look
3199
 * for the Edje documentation for more information about theme files.
3200
 *
3201
 * Next, we fetch from our theme a data string referenced by the key "title".
3202
 * This data was defined in the theme, and can be used as parameters which the
3203
 * program get from the specific theme that it is using. In this case, we store
3204
 * the title of this window and program in the theme, as a "data" entry, just
3205
 * for demonstration purposes:
3206
 *
3207
 * @until }
3208
 *
3209
 * This call elm_layout_data_get() is used to fetch the string based on the key,
3210
 * and elm_object_part_text_set() will set the part defined in the theme as
3211
 * "example/title" to contain this string. This key "example/title" has nothing
3212
 * special. It's just an arbitrary convention that we are using in this example.
3213
 * Every string in this example referencing a part of this theme will be of the
3214
 * form "example/<something>".
3215
 *
3216
 * Now let's start using our layout to distribute things on the window space.
3217
 * Since the layout was added as a resize object to the elementary window, it
3218
 * will always occupy the entire space available for this window.
3219
 *
3220
 * The theme already has a title, and it also defines a table element which is
3221
 * positioned approximately between 50% and 70% of the height of this window,
3222
 * and has 100% of the width. We create some widgets (two icons, a clock and a
3223
 * button) and pack them inside the table, in a distribution similar to a HTML
3224
 * table:
3225
 *
3226
 * @until evas_object_show(bt)
3227
 *
3228
 * Notice that we just set size hints for every object, and call the function
3229
 * elm_layout_table_pack(), which does all the work. It will place the elements
3230
 * in the specified row/column, with row and column span if required, and then
3231
 * the object's size and position will be controlled by the layout widget. It
3232
 * will also respect size hints, alignments and weight properties set to these
3233
 * widgets. The resulting distribution on the screen depends on the table
3234
 * properties (described in the theme), the size hints set on each widget, and
3235
 * on the cells of the table that are being used.
3236
 *
3237
 * For instance, we add the two icons and the clock on the first, second and
3238
 * third cells of the first row, and add the button the second row, making it
3239
 * span for 3 columns (thus having the size of the entire table width). This
3240
 * will result in a table that has 2 rows and 3 columns.
3241
 *
3242
 * Now let's add some widgets to the box area of our layout. This box is around
3243
 * 20% and 50% of the vertical size of the layout, and 100% of its width. The
3244
 * theme defines that it will use an "horizontal flow" distribution to its
3245
 * elements. Unlike the table, a box will distribute elements without knowing
3246
 * about rows and columns, and the distribution function selected will take care
3247
 * of putting them in row, column, both, or any other available layout. This is
3248
 * also described in the Edje documentation.
3249
 *
3250
 * This box area is similar to the @ref Elm_Box widget of elementary, with the
3251
 * difference that its position and properties are controlled by the theme of the
3252
 * layout. It also contains more than one API to add items to it, since the
3253
 * items position now is defined in terms of a list of items, not a matrix.
3254
 * There's the first position (can have items added to it with
3255
 * elm_layout_box_prepend()), the last position (elm_layout_box_append()), the
3256
 * nth position (elm_layout_box_insert_at()) and the position right before an
3257
 * element (elm_layout_box_insert_before()). We use insert_at and prepend
3258
 * functions to add the first two buttons to this box, and insert_before on the
3259
 * callback of each button. The callback code will be shown later, but it
3260
 * basically adds a button just before the clicked button using the
3261
 * elm_layout_box_insert_before() function. Here's the code for adding the first
3262
 * 2 buttons:
3263
 *
3264
 * @until evas_object_show(item)
3265
 * @until evas_object_show(item)
3266
 *
3267
 * Finally, we have an area in this layout theme, in the bottom part of it,
3268
 * reserved for adding an specific widget. Differently from the 2 parts
3269
 * described until now, this one can only receive one widget with the call
3270
 * elm_object_part_content_set() for the layout. If there was already an item on this specific part,
3271
 * it will be deleted (one can use elm_object_part_content_unset() in order to remove
3272
 * it without deleting). An example of removing it without deleting, but
3273
 * manually deleting this widget just after that, can be seen on the callback
3274
 * for this button. Actually, the callback defined for this button will clean
3275
 * the two other parts (deleting all of their elements) and then remove and
3276
 * delete this button.
3277
 *
3278
 * @until _swallow_btn_cb
3279
 *
3280
 * Also notice that, for this last added button, we don't have to call
3281
 * evas_object_show() on it. This is a particularity of the theme for layouts,
3282
 * that will have total control over the properties like size, position,
3283
 * visibility and clipping of a widget added with elm_object_part_content_set().
3284
 * Again, read the Edje documentation to understand this better.
3285
 *
3286
 * Now we just put the code for the different callbacks specified for each kind
3287
 * of button and make simple comments about them:
3288
 *
3289
 * @dontinclude layout_example_01.c
3290
 * @skip static void
3291
 * @until evas_object_del(item)
3292
 * @until }
3293
 *
3294
 * The first callback is used for the button in the table, and will just remove
3295
 * itself from the table with elm_layout_table_unpack(), which remove items
3296
 * without deleting them, and then calling evas_object_del() on itself.
3297
 *
3298
 * The second callback is for buttons added to the box. When clicked, these
3299
 * buttons will create a new button, and add them to the same box, in the
3300
 * position just before the clicked button.
3301
 *
3302
 * And the last callback is for the button added to the "content" area. It will
3303
 * clear both the table and the box, passing @c EINA_TRUE to their respective @c
3304
 * clear parameters, which will imply on the items of these containers being
3305
 * deleted.
3306
 *
3307
 * A screenshot of this example can be seen on:
3308
 *
3309
 * @image html screenshots/layout_example_01.png
3310
 * @image latex screenshots/layout_example_01.eps width=\textwidth
3311
 *
3312
 */
3313

3314
/**
3315
 * @page layout_example_02 Layout - Predefined Layout
3316
 *
3317
 * This example shows how one can use the @ref Elm_Layout with a predefined theme
3318
 * layout to add a back and next button to a simple window. The full source code
3319
 * for this example can be found at @ref layout_example_02_c.
3320
 *
3321
 * After setting up the window and background, we add the layout widget to the
3322
 * window. But instead of using elm_layout_file_set() to load its theme from a
3323
 * custom theme file, we can use elm_layout_theme_set() to load one of the
3324
 * predefined layouts that come with elementary. Particularly on this example,
3325
 * we load the them of class "layout", group "application" and style
3326
 * "content-back-next" (since we want the back and next buttons).
3327
 *
3328
 * @dontinclude layout_example_02.c
3329
 * @skip elm_layout_add
3330
 * @until evas_object_show(layout)
3331
 *
3332
 * This default theme contains only a "content" area named
3333
 * "elm.swallow.content", where we can add any widget (it can be even a
3334
 * container widget, like a box, frame, list, or even another layout). Since we
3335
 * just want to show the resulting layout, we add a simple icon to it:
3336
 *
3337
 * @until layout_content_set
3338
 *
3339
 * This default layout also provides some signals when the next and prev buttons
3340
 * are clicked. We can register callbacks to them with the
3341
 * elm_object_signal_callback_add() function:
3342
 *
3343
 * @until elm,action,next
3344
 *
3345
 * In the @ref layout_example_03 you can see how to send signals to the layout with
3346
 * elm_object_signal_emit().
3347
 *
3348
 * Now our callback just changes the picture being displayed when one of the
3349
 * buttons are clicked:
3350
 *
3351
 * @dontinclude layout_example_02.c
3352
 * @skip images
3353
 * @until standard_set
3354
 * @until }
3355
 *
3356
 * It's possible to see that it gets the name of the image being shown from the
3357
 * array of image names, going forward on this array when "next" is clicked and
3358
 * backward when "back" is clicked.
3359
 *
3360
 * A screenshot of this example can be seen on:
3361
 *
3362
 * @image html screenshots/layout_example_02.png
3363
 * @image latex screenshots/layout_example_02.eps width=\textwidth
3364
 */
3365

3366
/**
3367
 * @page layout_example_03 Layout - Signals and Size Changed
3368
 *
3369
 * This example shows how one can send and receive signals to/from the layout,
3370
 * and what to do when the layout theme has its size changed. The full source
3371
 * code for this example can be found at @ref layout_example_03_c.
3372
 *
3373
 * In this example we will use another group from the same layout theme file
3374
 * used in @ref layout_example_01. Its instantiation and loading happens in the
3375
 * following lines:
3376
 *
3377
 * @dontinclude layout_example_03.c
3378
 * @skip elm_layout_add
3379
 * @until evas_object_show
3380
 *
3381
 * This time we register a callback to be called whenever we receive a signal
3382
 * after the end of the animation that happens in this layout:
3383
 *
3384
 * @until signal_callback_add
3385
 *
3386
 * We also add a button that will send signals to the layout:
3387
 *
3388
 * @until callback_add
3389
 *
3390
 * The callback for this button will check what type of signal it should send,
3391
 * and then emit it. The code for this callback follows:
3392
 *
3393
 * @dontinclude layout_example_03.c
3394
 * @skip static Eina_Bool
3395
 * @until Enlarge
3396
 * @until }
3397
 * @until }
3398
 *
3399
 * As we said before, we are receiving a signal whenever the animation started
3400
 * by the button click ends. This is the callback for that signal:
3401
 *
3402
 * @until }
3403
 *
3404
 * Notice from this callback that the elm_layout_sizing_eval() function must be
3405
 * called if we want our widget to update its size after the layout theme having
3406
 * changed its minimum size. This happens because the animation specified in the
3407
 * theme increases the size of the content area to a value higher than the
3408
 * widget size, thus requiring more space. But the elementary layout widget
3409
 * has no way to know this, thus needing the elm_layout_sizing_eval() to
3410
 * be called on the layout, informing that this size has changed.
3411
 *
3412
 * A screenshot of this example can be seen on:
3413
 *
3414
 * @image html screenshots/layout_example_03.png
3415
 * @image latex screenshots/layout_example_03.eps width=\textwidth
3416
 */
3417

3418
/**
3419
 * @page tutorial_hover Hover example
3420
 * @dontinclude hover_example_01.c
3421
 *
3422
 * On this example we are going to have a button that when clicked will show our
3423
 * hover widget, this hover will have content set on it's left, top, right and
3424
 * middle positions. In the middle position we are placing a button that when
3425
 * clicked will hide the hover. We are also going to use a non-default theme
3426
 * for our hover. We won't explain the functioning of button for that see @ref
3427
 * Elm_Button.
3428
 *
3429
 * We start our example with a couple of callbacks that show and hide the data
3430
 * they're given(which we'll see later on is the hover widget):
3431
 * @skip static
3432
 * @until }
3433
 * @until }
3434
 *
3435
 * In our main function we'll do some initialization and then create 3
3436
 * rectangles, one red, one green and one blue to use in our hover. We'll also
3437
 * create the 2 buttons that will show and hide the hover:
3438
 * @until show(bt2)
3439
 *
3440
 * With all of that squared away we can now get to the heart of the matter,
3441
 * creating our hover widget, which is easy as pie:
3442
 * @until hover
3443
 *
3444
 * Having created our hover we now need to set the parent and target. Which if
3445
 * you recall from the function documentations are going to tell the hover which
3446
 * area it should cover and where it should be centered:
3447
 * @until bt
3448
 *
3449
 * Now we set the theme for our hover. We're using the popout theme which gives
3450
 * our contents a white background and causes their appearance to be animated:
3451
 * @until popout
3452
 *
3453
 * And finally we set the content for our positions:
3454
 * @until bt2
3455
 *
3456
 * So far so good? Great 'cause that's all there is too it, what is left now is
3457
 * just connecting our buttons to the callbacks we defined at the beginning of
3458
 * the example and run the main loop:
3459
 * @until ELM_MAIN
3460
 *
3461
 * Our example will initially look like this:
3462
 *
3463
 * @image html screenshots/hover_example_01.png
3464
 * @image latex screenshots/hover_example_01.eps width=\textwidth
3465
 *
3466
 * And after you click the "Show hover" button it will look like this:
3467
 *
3468
 * @image html screenshots/hover_example_01_a.png
3469
 * @image latex screenshots/hover_example_01_a.eps width=\textwidth
3470
 *
3471
 * @example hover_example_01.c
3472
 */
3473

3474
/**
3475
  * @page tutorial_flip Flip example
3476
  * @dontinclude flip_example_01.c
3477
  *
3478
  * This example will show a flip with two rectangles on it(one blue, one
3479
  * green). Our example will allow the user to choose the animation the flip
3480
  * uses and to interact with it. To allow the user to choose the interaction
3481
  * mode we use radio buttons, we will however not explain them, if you would
3482
  * like to know more about radio buttons see @ref Elm_Radio.
3483
  *
3484
  * We start our example with the usual setup and then create the 2 rectangles
3485
  * we will use in our flip:
3486
  * @until show(rect2)
3487
  *
3488
  * The next thing to do is to create our flip and set it's front and back
3489
  * content:
3490
  * @until show
3491
  *
3492
  * The next thing we do is set the interaction mode(which the user can later
3493
  * change) to the page animation:
3494
  * @until PAGE
3495
  *
3496
  * Setting a interaction mode however is not sufficient, we also need to
3497
  * choose which directions we allow interaction from, for this example we
3498
  * will use all of them:
3499
  * @until RIGHT
3500
  *
3501
  * We are also going to set the hintsize to the entire flip(in all directions)
3502
  * to make our flip very easy to interact with:
3503
  * @until RIGHT
3504
  *
3505
  * After that we create our radio buttons and start the main loop:
3506
  * @until ELM_MAIN()
3507
  *
3508
  * When the user clicks a radio button a function that changes the
3509
  * interaction mode and animates the flip is called:
3510
  * @until }
3511
  * @note The elm_flip_go() call here serves no purpose other than to
3512
  * illustrate that it's possible to animate the flip programmatically.
3513
  *
3514
  * Our example will look like this:
3515
  *
3516
  * @image html screenshots/flip_example_01.png
3517
  * @image latex screenshots/flip_example_01.eps width=\textwidth
3518
  *
3519
  * @note Since this is an animated example the screenshot doesn't do it
3520
  * justice, it is a good idea to compile it and see the animations.
3521
  *
3522
  * @example flip_example_01.c
3523
  */
3524

3525
 /**
3526
  * @page tutorial_label Label example
3527
  * @dontinclude label_example_01.c
3528
  *
3529
  * In this example we are going to create 6 labels, set some properties on
3530
  * them and see what changes in appearance those properties cause.
3531
  *
3532
  * We start with the setup code that by now you should be familiar with:
3533
  * @until elm_win_autodel_set
3534
  *
3535
  * For our first label we have a moderately long text(that doesn't fit in the
3536
  * label's width) so we will make it a sliding label. Since the text isn't
3537
  * too long we don't need the animation to be very long, 3 seconds should
3538
  * give us a nice speed:
3539
  * @until show(label
3540
  *
3541
  * For our second label we have the same text, but this time we aren't going
3542
  * to have it slide, we're going to ellipsize it. Because we ask our label
3543
  * widget to ellipsize the text it will first diminsh the fontsize so that it
3544
  * can show as much of the text as possible:
3545
  * @until show(label
3546
  *
3547
  * For the third label we are going to ellipsize the text again, however this
3548
  * time to make sure the fontsize isn't diminshed we will set a line wrap.
3549
  * The wrap won't actually cause a line break because we set the label to
3550
  * ellipsize:
3551
  * @until show(label
3552
  *
3553
  * For our fourth label we will set line wrapping but won't set ellipsis, so
3554
  * that our text will indeed be wrapped instead of ellipsized. For this label
3555
  * we choose character wrap:
3556
  * @until show(label
3557
  *
3558
  * Just two more, for our fifth label we do the same as for the fourth
3559
  * except we set the wrap to word:
3560
  * @until show(label
3561
  *
3562
  * And last but not least for our sixth label we set the style to "marker" and
3563
  * the color to red (the default color is white which would be hard to see on
3564
  * our white background):
3565
  * @until show(label
3566
  *
3567
  * Our example will look like this:
3568
  *
3569
  * @image html screenshots/label_example_01.png
3570
  * @image latex screenshots/label_example_01.eps width=\textwidth
3571
  *
3572
  * @example label_example_01.c
3573
  */
3574

3575
 /**
3576
  * @page tutorial_image Image example
3577
  * @dontinclude image_example_01.c
3578
  *
3579
  * This example is as simple as possible. An image object will be added to the
3580
  * window over a white background, and set to be resizable together with the
3581
  * window. All the options set through the example will affect the behavior of
3582
  * this image.
3583
  *
3584
  * We start with the code for creating a window and its background, and also
3585
  * add the code to write the path to the image that will be loaded:
3586
  *
3587
  * @skip int
3588
  * @until snprintf
3589
  *
3590
  * Now we create the image object, and set that file to be loaded:
3591
  *
3592
  * @until }
3593
  *
3594
  * We can now go setting our options.
3595
  *
3596
  * elm_image_no_scale_set() is used just to set this value to true (we
3597
  * don't want to scale our image anyway, just resize it).
3598
  *
3599
  * elm_image_resizable_set() is used to allow the image to be resized to a size
3600
  * smaller than the original one, but not to a size bigger than it.
3601
  *
3602
  * elm_image_smooth_set() will disable the smooth scaling, so the scale
3603
  * algorithm used to scale the image to the new object size is going to be
3604
  * faster, but with a lower quality.
3605
  *
3606
  * elm_image_orient_set() is used to flip the image around the (1, 0) (0, 1)
3607
  * diagonal.
3608
  *
3609
  * elm_image_aspect_fixed_set() is used to keep the original aspect
3610
  * ratio of the image, even when the window is resized to another aspect ratio.
3611
  *
3612
  * elm_image_fill_outside_set() is used to ensure that the image will fill the
3613
  * entire area available to it, even if keeping the aspect ratio. The image
3614
  * will overflow its width or height (any of them that is necessary) to the
3615
  * object area, instead of resizing the image down until it can fit entirely in
3616
  * this area.
3617
  *
3618
  * elm_image_editable_set() is used just to cover the API, but won't affect
3619
  * this example since we are not using any copy & paste property.
3620
  *
3621
  * This is the code for setting these options:
3622
  *
3623
  * @until editable
3624
  *
3625
  * Now some last touches in our object size hints, window and background, to
3626
  * display this image properly:
3627
  *
3628
  * @until ELM_MAIN
3629
  *
3630
  * This example will look like this:
3631
  *
3632
  * @image html screenshots/image_example_01.png
3633
  * @image latex screenshots/image_example_01.eps width=\textwidth
3634
  *
3635
  * @example image_example_01.c
3636
  */
3637

3638
 /**
3639
  * @page tutorial_icon Icon example
3640
  * @dontinclude icon_example_01.c
3641
  *
3642
  * This example is as simple as possible. An icon object will be added to the
3643
  * window over a white background, and set to be resizable together with the
3644
  * window. All the options set through the example will affect the behavior of
3645
  * this icon.
3646
  *
3647
  * We start with the code for creating a window:
3648
  *
3649
  * @skip int
3650
  * @until elm_win_autodel_set
3651
  *
3652
  * Now we create the icon object, and set lookup order of the icon, and choose
3653
  * the "home" icon:
3654
  *
3655
  * @until elm_icon_standard_set
3656
  *
3657
  * An interesting thing is that after setting this, it's possible to check where
3658
  * in the filesystem is the theme used by this icon, and the name of the group
3659
  * used:
3660
  *
3661
  * @until printf
3662
  *
3663
  * We can now go setting our options.
3664
  *
3665
  * elm_image_no_scale_set() is used just to set this value to true (we
3666
  * don't want to scale our icon anyway, just resize it).
3667
  *
3668
  * elm_image_resizable_set() is used to allow the icon to be resized to a size
3669
  * smaller than the original one, but not to a size bigger than it.
3670
  *
3671
  * elm_image_smooth_set() will disable the smooth scaling, so the scale
3672
  * algorithm used to scale the icon to the new object size is going to be
3673
  * faster, but with a lower quality.
3674
  *
3675
  * elm_image_fill_outside_set() is used to ensure that the icon will fill the
3676
  * entire area available to it, even if keeping the aspect ratio. The icon
3677
  * will overflow its width or height (any of them that is necessary) to the
3678
  * object area, instead of resizing the icon down until it can fit entirely in
3679
  * this area.
3680
  *
3681
  * This is the code for setting these options:
3682
  *
3683
  * @until fill_outside
3684
  *
3685
  * However, if you try this example you may notice that this image is not being
3686
  * affected by all of these options. This happens because the used icon will be
3687
  * from elementary theme, and thus it has its own set of options like smooth
3688
  * scaling and fill_outside options. You can change the "home" icon to use some
3689
  * image (from your system) and see that then those options will be respected.
3690
  *
3691
  * Now some last touches in our object size hints, window and background, to
3692
  * display this icon properly:
3693
  *
3694
  * @until ELM_MAIN
3695
  *
3696
  * This example will look like this:
3697
  *
3698
  * @image html screenshots/icon_example_01.png
3699
  * @image latex screenshots/icon_example_01.eps width=\textwidth
3700
  *
3701
  * @example icon_example_01.c
3702
  */
3703

3704
/**
3705
 * @page tutorial_hoversel Hoversel example
3706
 * @dontinclude hoversel_example_01.c
3707
 *
3708
 * In this example we will create a hoversel with 3 items, one with a label but
3709
 * no icon and two with both a label and an icon. Every item that is clicked
3710
 * will be deleted, but everytime the hoversel is activated we will also add an
3711
 * item. In addition our first item will print all items when clicked and our
3712
 * third item will clear all items in the hoversel.
3713
 *
3714
 * We will start with the normal creation of window stuff:
3715
 * @until show(bg)
3716
 *
3717
 * Next we will create a red rectangle to use as the icon of our hoversel:
3718
 * @until show
3719
 *
3720
 * And now we create our hoversel and set some of it's properties. We set @p win
3721
 * as its parent, ask it to not be horizontal(be vertical) and give it a label
3722
 * and icon:
3723
 * @until "icon", rect)
3724
 *
3725
 * Next we will add our three items, setting a callback to be called for the
3726
 * first and third:
3727
 * @until _rm_items
3728
 *
3729
 * We also set a pair of callbacks to be called whenever any item is selected or
3730
 * when the hoversel is activated:
3731
 * @until clicked
3732
 *
3733
 * And then ask that our hoversel be shown and run the main loop:
3734
 * @until ELM_MAIN
3735
 *
3736
 * We now have the callback for our first item which prints all items in the
3737
 * hoversel:
3738
 * @until }
3739
 *
3740
 * Next we have the callback for our third item which removes all items from the
3741
 * hoversel:
3742
 * @until }
3743
 *
3744
 * Next we have the callback that is called whenever an item is clicked and
3745
 * deletes that item:
3746
 * @until }
3747
 *
3748
 * And the callback that is called when the hoversel is activated and adds an
3749
 * item to the hoversel. Note that since we allocate memory for the item we need
3750
 * to know when the item dies so we can free that memory:
3751
 * @until }
3752
 *
3753
 * And finally the callback that frees the memory we allocated for items created
3754
 * in the @p _add_item callback:
3755
 * @until }
3756
 *
3757
 * Our example will initially look like this:
3758
 *
3759
 * @image html screenshots/hoversel_example_01.png
3760
 * @image latex screenshots/hoversel_example_01.eps width=\textwidth
3761
 *
3762
 * And when the hoversel is clicked it will look like this:
3763
 *
3764
 * @image html screenshots/hoversel_example_01_a.png
3765
 * @image latex screenshots/hoversel_example_01_a.eps width=\textwidth
3766
 *
3767
 * @example hoversel_example_01.c
3768
 */
3769

3770
/**
3771
 * @page conformant_example Conformant Example.
3772
 *
3773
 * In this example we'll explain how to create applications to work
3774
 * with illume, considering space required for virtual keyboards, indicator
3775
 * and softkeys.
3776
 *
3777
 * Illume is a module for Enlightenment that modifies the user interface
3778
 * to work cleanly and nicely on a mobile device. It has support for
3779
 * virtual keyboard, among other nice features.
3780
 *
3781
 * Let's start creating a very simple window with a vertical box
3782
 * with multi-line entry between two buttons.
3783
 * This entry will expand filling all space on window not used by buttons.
3784
 *
3785
 * @dontinclude conformant_example_01.c
3786
 * @skipline elm_main
3787
 * @until }
3788
 *
3789
 * For information about how to create windows, boxes, buttons or entries,
3790
 * look for documentation for these widgets.
3791
 *
3792
 * It will looks fine when you don't need a virtual keyboard, as you
3793
 * can see on the following image:
3794
 *
3795
 * @image html screenshots/conformant_example_01.png
3796
 * @image latex screenshots/conformant_example_01.eps width=\textwidth
3797
 *
3798
 * But if you call a virtual keyboard, the window will resize, changing
3799
 * widgets size and position. All the content will shrink.
3800
 *
3801
 * If you don't want such behaviour, you
3802
 * will need a conformant to account for space taken up by the indicator,
3803
 * virtual keyboard and softkey.
3804
 *
3805
 * In this case, using the conformant in a proper way, you will have
3806
 * a window like the following:
3807
 *
3808
 * @image html screenshots/conformant_example_02.png
3809
 * @image latex screenshots/conformant_example_02.eps width=\textwidth
3810
 *
3811
 * As you can see, it guess the space that will be required by the keyboard,
3812
 * indicator and softkey bars.
3813
 *
3814
 * So, let's study each step required to transform our initial example on
3815
 * the second one.
3816
 *
3817
 * First of all, we need to set the window as an illume conformant window:
3818
 * @dontinclude conformant_example_02.c
3819
 * @skipline elm_win_conformant_set
3820
 *
3821
 * Next, we'll add a conformant widget, and set it to resize with the window,
3822
 * instead of the box.
3823
 * @skipline conform
3824
 * @until evas_object_show
3825
 *
3826
 * Finally, we'll set the box as conformant's content, just like this:
3827
 * @skipline elm_object_content_set
3828
 *
3829
 * Compare both examples code:
3830
 * @ref conformant_example_01.c "conformant_example_01.c"
3831
 * @ref conformant_example_02.c "conformant_example_02.c"
3832
 *
3833
 * @example conformant_example_01.c
3834
 * @example conformant_example_02.c
3835
 */
3836

3837
/**
3838
 * @page index_example_01 Index widget example 1
3839
 *
3840
 * This code places an Elementary index widget on a window, which also
3841
 * has a very long list of arbitrary strings on it.  The list is
3842
 * sorted alphabetically and the index will be used to index the first
3843
 * items of each set of strings beginning with an alphabet letter.
3844
 *
3845
 * Below the list are some buttons, which are there just to exercise
3846
 * some index widget's API.
3847
 *
3848
 * Here's how we instantiate it:
3849
 * @dontinclude index_example_01.c
3850
 * @skip elm_list_add
3851
 * @until evas_object_show(d.index)
3852
 * where we're showing also the list being created. Note that we issue
3853
 * elm_win_resize_object_add() on the index, so that it's set to have
3854
 * the whole window as its container. Then, we have to populate both
3855
 * list and index widgets:
3856
 * @dontinclude index_example_01.c
3857
 * @skip for (i = 0; i < (sizeof(dict) / sizeof(dict[0])); i++)
3858
 * @until }
3859
 * @until }
3860
 *
3861
 * The strings populating the list come from a file
3862
 * @dontinclude index_example_01.c
3863
 * @skip static const char *dict
3864
 * @until }
3865
 *
3866
 * We use the @c curr char variable to hold the last initial letter
3867
 * seen on that ordered list of strings, so that we're able to have an
3868
 * index item pointing to each list item starting a new letter
3869
 * "section". Note that our index item data pointers will be the list
3870
 * item handles. We are also setting a callback function to index
3871
 * items deletion events:
3872
 * @dontinclude index_example_01.c
3873
 * @skip static void
3874
 * @until }
3875
 *
3876
 * There, we show you that the @c event_info pointer will contain the
3877
 * item in question's data, i.e., a given list item's pointer. Because
3878
 * item data is also returned in the @c data argument on
3879
 * @c Evas_Smart_Cb functions, those two pointers must have the same
3880
 * values. On this deletion callback, we're deleting the referred list
3881
 * item too, just to exemplify that anything could be done there.
3882
 *
3883
 * Next, we hook to two smart events of the index object:
3884
 * @dontinclude index_example_01.c
3885
 * @skip smart_callback_add(d.index
3886
 * @until _index_selected
3887
 * @dontinclude index_example_01.c
3888
 * @skip "delay,changed" hook
3889
 * @until }
3890
 * @until }
3891
 *
3892
 * Check that, whenever one holds the mouse pressed over a given index
3893
 * letter for some time, the list beneath it will roll down to the
3894
 * item pointed to by that index item. When one releases the mouse
3895
 * button, the second callback takes place. There, we check that the
3896
 * reported item data, on @c event_info, is the same reported by
3897
 * elm_index_selected_item_get(), which gives the last selection's
3898
 * data on the index widget.
3899
 *
3900
 * The first of the three buttons that follow will call
3901
 * elm_index_autohide_disabled_set(), thus showing the index automatically for
3902
 * you, if it's not already visible, what is checked with
3903
 * elm_index_autohide_disabled_get(). The second button will exercise @b deletion
3904
 * of index item objects, by the following code:
3905
 * @dontinclude index_example_01.c
3906
 * @skip delete an index item
3907
 * @until }
3908
 *
3909
 * It will get the last index item selected's data and find the
3910
 * respective index item handle(#Elm_Object_Item) with elm_index_item_find().
3911
 * We need the latter to query the indexing letter string from, with
3912
 * elm_index_item_letter_get(). Next, comes the deletion itself,
3913
 * which will also trigger the @c _index_item_del callback function,
3914
 * as said above.
3915
 *
3916
 * The third button, finally, will exercise elm_index_item_clear(),
3917
 * which will delete @b all of the index's items.
3918
 *
3919
 * This is how the example program's window looks like with the index
3920
 * widget hidden:
3921
 * @image html screenshots/index_example_00.png
3922
 * @image latex screenshots/index_example_00.eps
3923
 *
3924
 * When it's shown, it's like the following figure:
3925
 * @image html screenshots/index_example_01.png
3926
 * @image latex screenshots/index_example_01.eps
3927
 *
3928
 * See the full @ref index_example_01_c "source code" for
3929
 * this example.
3930
 *
3931
 */
3932

3933
/**
3934
 * @page index_example_02 Index widget example 2
3935
 *
3936
 * This code places an Elementary index widget on a window, indexing
3937
 * grid items. The items are placed so that their labels @b don't
3938
 * follow any order, but the index itself is ordered (through
3939
 * elm_index_item_sorted_insert()). This is a complement to to @ref
3940
 * index_example_01 "the first example on indexes".
3941
 *
3942
 * Here's the list of item labels to be used on the grid (in that
3943
 * order):
3944
 * @dontinclude index_example_02.c
3945
 * @skip static const char *items
3946
 * @until };
3947
 *
3948
 * In the interesting part of the code, here, we first instantiate the
3949
 * grid (more on grids on their examples) and, after creating our
3950
 * index, for each grid item we also create an index one to reference
3951
 * it:
3952
 * @dontinclude index_example_02.c
3953
 * @skip grid = elm_gengrid_add
3954
 * @until }
3955
 * @until smart_callback_add
3956
 *
3957
 * The order in which they'll appear in the index, though, is @b
3958
 * alphabetical, becase of elm_index_item_sorted_insert() usage
3959
 * together with the comparing function, where we take the letters of
3960
 * each index item to base our ordering on. The parameters on
3961
 * @c _index_cmp have to be declared as void pointers because of the
3962
 * @c Eina_Compare_Cb prototype requisition, but in this case we know
3963
 * they'll be index item(#Elm_Object_Item)'s:
3964
 * @dontinclude index_example_02.c
3965
 * @skip ordering alphabetically
3966
 * @until }
3967
 *
3968
 * The last interesting bit is the callback in the @c "delay,changed"
3969
 * smart event, which will bring the given grid item to the grid's
3970
 * visible area:
3971
 * @dontinclude index_example_02.c
3972
 * @skip static void
3973
 * @until }
3974
 *
3975
 * Note how the grid will move kind of randomly while you move your
3976
 * mouse pointer held over the index from top to bottom -- that's
3977
 * because of the the random order the items have in the grid itself.
3978
 *
3979
 * This is how the example program's window looks like:
3980
 * @image html screenshots/index_example_03.png
3981
 * @image latex screenshots/index_example_03.eps
3982
 *
3983
 * See the full @ref index_example_02.c "source code" for
3984
 * this example.
3985
 *
3986
 */
3987

3988
/**
3989
 * @page tutorial_ctxpopup Ctxpopup example
3990
 * @dontinclude ctxpopup_example_01.c
3991
 *
3992
 * In this example we have a list with two items, when either item is clicked
3993
 * a ctxpopup for it will be shown. Our two ctxpopups are quite different, the
3994
 * one for the first item is a vertical and it's items contain both labels and
3995
 * icons, the one for the second item is horizontal and it's items have icons
3996
 * but not labels.
3997
 *
3998
 * We will begin examining our example code by looking at the callback we'll use
3999
 * when items in the ctxpopup are clicked. It's very simple, all it does is
4000
 * print the label present in the ctxpopup item:
4001
 * @until }
4002
 *
4003
 * Next we examine a function that creates ctxpopup items, it was created to
4004
 * avoid repeating the same code whenever we needed to add an item to our
4005
 * ctxpopup. Our function creates an icon from the standard set of icons, and
4006
 * then creates the item, with the label received as an argument. We also set
4007
 * the callback to be called when the item is clicked:
4008
 * @until }
4009
 *
4010
 * Finally we have the function that will create the ctxpopup for the first item
4011
 * in our list. This one is somewhat more complex though, so let's go through it
4012
 * in parts. First we declare our variable and add the ctxpopup:
4013
 * @until ctxpopup_add
4014
 *
4015
 * Next we create a bunch of items for our ctxpopup, marking two of them as
4016
 * disabled just so we can see what that will look like:
4017
 * @until disabled_set
4018
 * @until disabled_set
4019
 *
4020
 * Then we ask evas where the mouse pointer was so that we can have our ctxpopup
4021
 * appear in the right place, set a maximum size for the ctxpopup, move it and
4022
 * show it:
4023
 * @until show
4024
 *
4025
 * And last we mark the list item as not selected:
4026
 * @until }
4027
 *
4028
 * Our next function is the callback that will create the ctxpopup for the
4029
 * second list item, it is very similar to the previous function. A couple of
4030
 * interesting things to note is that we ask our ctxpopup to be horizontal, and
4031
 * that we pass NULL as the label for every item:
4032
 * @until }
4033
 *
4034
 * And with all of that in place we can now get to our main function where we
4035
 * create the window, the list, the list items and run the main loop:
4036
 * @until ELM_MAIN()
4037
 *
4038
 * The example will initially look like this:
4039
 *
4040
 * @image html screenshots/ctxpopup_example_01.png
4041
 * @image latex screenshots/ctxpopup_example_01.eps width=\textwidth
4042
 *
4043
 * @note This doesn't show the ctxpopup tough, since it will only appear when
4044
 * we click one of the list items.
4045
 *
4046
 * Here is what our first ctxpopup will look like:
4047
 *
4048
 * @image html screenshots/ctxpopup_example_01_a.png
4049
 * @image latex screenshots/ctxpopup_example_01_a.eps width=\textwidth
4050
 *
4051
 * And here the second ctxpopup:
4052
 *
4053
 * @image html screenshots/ctxpopup_example_01_b.png
4054
 * @image latex screenshots/ctxpopup_example_01_b.eps width=\textwidth
4055
 *
4056
 * @example ctxpopup_example_01.c
4057
 */
4058

4059
/**
4060
 * @page tutorial_separator Separator example
4061
 * @dontinclude separator_example_01.c
4062
 *
4063
 * In this example we are going to pack two rectangles in a box, and have a
4064
 * separator in the middle.
4065
 *
4066
 * So we start we the window, background, box and rectangle creation, all pretty
4067
 * normal stuff:
4068
 * @until pack_end
4069
 *
4070
 * Once we have our first rectangle in the box we create and add our separator:
4071
 * @until pack_end
4072
 * @note Since our box is in horizontal mode it's a good idea to set the
4073
 * separator to be horizontal too.
4074
 *
4075
 * And now we add our second rectangle and run the main loop:
4076
 * @until ELM_MAIN
4077
 *
4078
 * This example will look like this:
4079
 *
4080
 * @image html screenshots/separator_example_01.png
4081
 * @image latex screenshots/separator_example_01.eps width=\textwidth
4082
 *
4083
 * @example separator_example_01.c
4084
 */
4085

4086
/**
4087
 * @page tutorial_radio Radio example
4088
 * @dontinclude radio_example_01.c
4089
 *
4090
 * In this example we will create 4 radio buttons, three of them in a group and
4091
 * another one not in the group. We will also have the radios in the group
4092
 * change the value of a variable directly and have then print it when the value
4093
 * changes. The fourth button is in the example just to make clear that radios
4094
 * outside the group don't affect the group.
4095
 *
4096
 * We'll start with the usual includes:
4097
 * @skipline #include
4098
 *
4099
 * And move right to declaring a static variable(the one whose value the radios
4100
 * will change):
4101
 * @until static
4102
 *
4103
 * We now need to have a window and all that good stuff to be able to place our
4104
 * radios in:
4105
 * @until show(bx)
4106
 *
4107
 * And now we create a radio button, since this is the first button in our group
4108
 * we set the group to be the radio(so we can set the other radios in the same
4109
 * group). We also set the state value of this radio to 1 and the value pointer
4110
 * to @p val, since val is @p 1 this has the additional effect of setting the
4111
 * radio value to @p 1. For this radio we choose the default home icon:
4112
 * @until show
4113
 *
4114
 * To check that our radio buttons are working we'll add a callback to the
4115
 * "changed" signal of the radio:
4116
 * @until smart_callback
4117
 *
4118
 * The creation of our second radio button is almost identical, the 2
4119
 * differences worth noting are, the value of this radio 2 and that we add this
4120
 * radio to the group of the first radio:
4121
 * @until smart_callback
4122
 *
4123
 * For our third callback we'll omit the icon and set the value to 3, we'll also
4124
 * add it to the group of the first radio:
4125
 * @until smart_callback
4126
 *
4127
 * Our fourth callback has a value of 4, no icon and most relevantly is not a
4128
 * member of the same group as the other radios:
4129
 * @until show
4130
 *
4131
 * We finally run the main loop:
4132
 * @until ELM_MAIN
4133
 *
4134
 * And the last detail in our example is the callback that prints @p val so that
4135
 * we can see that the radios are indeed changing its value:
4136
 * @until }
4137
 *
4138
 * The example will look like this:
4139
 *
4140
 * @image html screenshots/radio_example_01.png
4141
 * @image latex screenshots/radio_example_01.eps width=\textwidth
4142
 *
4143
 * @example radio_example_01.c
4144
 */
4145

4146
/**
4147
 * @page tutorial_panel Panel example
4148
 * @dontinclude panel_example_01.c
4149
 *
4150
 * In this example will have 3 panels, one for each possible orientation. Two of
4151
 * our panels will start out hidden, the third will start out expanded. For each
4152
 * of the panels we will use a label as the content, it's however possible to
4153
 * have any widget(including containers) as the content of panels.
4154
 *
4155
 * We start by doing some setup, code you should be familiar with from other
4156
 * examples:
4157
 * @until show(bx)
4158
 *
4159
 * And move right to creating our first panel, for this panel we are going to
4160
 * choose the orientation as TOP and toggle it(tell it to hide itself):
4161
 * @until pack_end
4162
 *
4163
 * For the second panel we choose the RIGHT orientation and explicitly set the
4164
 * state as hidden:
4165
 * @until pack_end
4166
 *
4167
 * For our third and last panel we won't set the orientation(which means it will
4168
 * use the default: LEFT):
4169
 * @until pack_end
4170
 *
4171
 * All that is left is running the main loop:
4172
 * @until ELM_MAIN
4173
 *
4174
 * This example will look like this;
4175
 *
4176
 * @image html screenshots/panel_example_01.png
4177
 * @image latex screenshots/panel_example_01.eps width=\textwidth
4178
 * @note The buttons with arrow allow the user to hide/show the panels.
4179
 *
4180
 * @example panel_example_01.c
4181
 */
4182

4183
/**
4184
 * @page gengrid_example Gengrid widget example
4185
 *
4186
 * This application is a thorough exercise on the gengrid widget's
4187
 * API. We place an Elementary gengrid widget on a window, with
4188
 * various knobs below its viewport, each one acting on it somehow.
4189
 *
4190
 * The code's relevant part begins at the grid's creation. After
4191
 * instantiating it, we set its items sizes, so that we don't end with
4192
 * items one finger size wide, only. We're setting them to fat, 150
4193
 * pixel wide ones, for this example. We give it some size hints, not
4194
 * to be discussed in this context and, than, we register a callback
4195
 * on one of its smart events -- the one coming each time an item gets
4196
 * doubly clicked. There, we just print the item handle's value.
4197
 * @dontinclude gengrid_example.c
4198
 * @skip grid = elm_gengrid_add
4199
 * @until evas_object_sho
4200
 * @dontinclude gengrid_example.c
4201
 * @skip item double click callback
4202
 * @until }
4203
 *
4204
 * Before we actually start to deal with the items API, let's show
4205
 * some things items will be using throughout all the code. The first
4206
 * of them is a struct to be used as item data, for all of them:
4207
 * @dontinclude gengrid_example.c
4208
 * @skip typedef struct
4209
 * @until Item;
4210
 *
4211
 * That path will be used to index an image, to be swallowed into one
4212
 * of the item's icon spots. The images themselves are distributed
4213
 * with Elementary:
4214
 * @dontinclude gengrid_example.c
4215
 * @skip static const char *imgs
4216
 * @until ;
4217
 *
4218
 * We also have an (unique) gengrid item class we'll be using for
4219
 * items in the example:
4220
 * @dontinclude gengrid_example.c
4221
 * @skip static Elm_Gengrid_Item_Class
4222
 * @until static Elm_Gengrid_Item_Class
4223
 * @dontinclude gengrid_example.c
4224
 * @skip item_style =
4225
 * @until _grid_del
4226
 *
4227
 * As you see, our items will follow the default theme on gengrid
4228
 * items. For the label fetching code, we return a string composed of
4229
 * the item's image path:
4230
 * @dontinclude gengrid_example.c
4231
 * @skip label fetching callback
4232
 * @until }
4233
 *
4234
 * For item icons, we'll be populating the item default theme's two
4235
 * icon spots, @c "elm.swallow.icon" and @c "elm.swallow.end". The
4236
 * former will receive one of the images in our list (in the form of
4237
 * a @ref bg_02_example_page "background"), while the latter will be
4238
 * a check widget. Note that we prevent the check to propagate click
4239
 * events, so that the user can toggle its state without messing with
4240
 * the respective item's selection in the grid:
4241
 * @dontinclude gengrid_example.c
4242
 * @skip icon fetching callback
4243
 * @until return NULL
4244
 * @until }
4245
 *
4246
 * As the default gengrid item's theme does not have parts
4247
 * implementing item states, we'll be just returning false for every
4248
 * item state:
4249
 * @dontinclude gengrid_example.c
4250
 * @skip state fetching callback
4251
 * @until }
4252
 *
4253
 * Finally, the deletion callback on gengrid items takes care of
4254
 * freeing the item's label string and its data struct:
4255
 * @dontinclude gengrid_example.c
4256
 * @skip deletion callback
4257
 * @until }
4258
 *
4259
 * Let's move to item insertion/deletion knobs, them. They are four
4260
 * buttons, above the grid's viewport, namely
4261
 * - "Append" (to append an item to the grid),
4262
 * - "Prepend" (to prepend an item to the grid),
4263
 * - "Insert before" (to insert an item before the selection, on the
4264
 *   grid),
4265
 * - "Insert after" (to insert an item after the selection, on the
4266
 *   grid),
4267
 * - "Clear" (to delete all items in the grid),
4268
 * - "Bring in 1st" (to make the 1st item visible, by scrolling),
4269
 * - "Show last" (to directly show the last item),
4270
 * .
4271
 * which are displaced and declared in that order. We're not dealing
4272
 * with the buttons' creation code (see @ref button_example_01
4273
 * "a button example", for more details on it), but with their @c
4274
 * "clicked" registered callbacks.  For all of them, the grid's handle
4275
 * is passed as @c data. The ones creating new items use a common
4276
 * code, which just gives a new @c Example_Item struct, with @c path
4277
 * filled with a random image in our images list:
4278
 * @dontinclude gengrid_example.c
4279
 * @skip new item with random path
4280
 * @until }
4281
 *
4282
 * Moreover, that ones will set a common function to be issued on the
4283
 * selection of the items. There, we print the item handle's value,
4284
 * along with the callback function data. The latter will be @c NULL,
4285
 * always, because it's what we pass when adding all icons. By using
4286
 * elm_object_item_data_get(), we can have the item data back and,
4287
 * with that, we're priting the item's path string. Finally, we
4288
 * exemplify elm_gengrid_item_pos_get(), printing the item's position
4289
 * in the grid:
4290
 * @dontinclude gengrid_example.c
4291
 * @skip item selection callback
4292
 * @until }
4293
 *
4294
 * The appending button will exercise elm_gengrid_item_append(), simply:
4295
 * @dontinclude gengrid_example.c
4296
 * @skip append an item
4297
 * @until }
4298
 *
4299
 * The prepending, naturally, is analogous, but exercising
4300
 * elm_gengrid_item_prepend(), on its turn. The "Insert before" one
4301
 * will expect an item to be selected in the grid, so that it will
4302
 * insert a new item just before it:
4303
 * @dontinclude gengrid_example.c
4304
 * @skip "insert before" callback
4305
 * @until }
4306
 *
4307
 * The "Insert after" is analogous, just using
4308
 * elm_gengrid_item_insert_after(), instead. The "Clear" button will,
4309
 * as expected, just issue elm_gengrid_clear():
4310
 * @dontinclude gengrid_example.c
4311
 * @skip delete items
4312
 * @until }
4313
 *
4314
 * The "Bring in 1st" button is there exercise two gengrid functions
4315
 * -- elm_gengrid_first_item_get() and elm_gengrid_item_bring_in().
4316
 * With the former, we get a handle to the first item and, with the
4317
 * latter, you'll see that the widget animatedly scrolls its view
4318
 * until we can see that item:
4319
 * @dontinclude gengrid_example.c
4320
 * @skip bring in 1st item
4321
 * @until }
4322
 *
4323
 * The "Show last", in its turn, will use elm_gengrid_last_item_get()
4324
 * and elm_gengrid_item_show(). The latter differs from
4325
 * elm_gengrid_item_bring_in() in that it immediately replaces the
4326
 * contents of the grid's viewport with the region containing the item
4327
 * in question:
4328
 * @dontinclude gengrid_example.c
4329
 * @skip show last item
4330
 * @until }
4331
 *
4332
 * To change the grid's cell (items) size, we've placed a spinner,
4333
 * which has the following @c "changed" smart callback:
4334
 * @dontinclude gengrid_example.c
4335
 * @skip change items' size
4336
 * @until }
4337
 *
4338
 * Experiment with it and see how the items are affected. The "Disable
4339
 * item" button will, as the name says, disable the currently selected
4340
 * item:
4341
 * @dontinclude gengrid_example.c
4342
 * @skip disable selected item
4343
 * @until }
4344
 * Note that we also make use of elm_gengrid_item_selected_set(),
4345
 * there, thus making the item unselected before we actually disable
4346
 * it.
4347
 *
4348
 * To toggle between horizontal and vertical layouting modes on the
4349
 * grid, use the "Horizontal mode" check, which will call the
4350
 * respective API function on the grid:
4351
 * @dontinclude gengrid_example.c
4352
 * @skip change layouting mode
4353
 * @until }
4354
 *
4355
 * If you toggle the check right after that one, "Always select",
4356
 * you'll notice all subsequent clicks on the @b same grid item will
4357
 * still issue the selection callback on it, what is different from
4358
 * when it's not checked. This is the
4359
 * elm_gengrid_select_mode_set() behavior:
4360
 * @dontinclude gengrid_example.c
4361
 * @skip "always select" callback
4362
 * @until }
4363
 *
4364
 * One more check follows, "Bouncing", which will turn on/off the
4365
 * bouncing animations on the grid, when one scrolls past its
4366
 * borders. Experiment with scrolling the grid to get the idea, having
4367
 * it turned on and off:
4368
 * @dontinclude gengrid_example.c
4369
 * @skip "bouncing mode" callback
4370
 * @until }
4371
 *
4372
 * The next two checks will affect items selection on the grid. The
4373
 * first, "Multi-selection", will make it possible to select more the
4374
 * one item on the grid. Because it wouldn't make sense to fetch for
4375
 * an unique selected item on this case, we also disable two of the
4376
 * buttons, which insert items relatively, if multi-selection is on:
4377
 * @dontinclude gengrid_example.c
4378
 * @skip multi-selection callback
4379
 * @until }
4380
 *
4381
 * Note that we also @b unselect all items in the grid, when returning
4382
 * from multi-selection mode, making use of
4383
 * elm_gengrid_item_selected_set().
4384
 *
4385
 * The second check acting on selection, "No selection", is just what
4386
 * its name depicts -- no selection will be allowed anymore, on the
4387
 * grid, while it's on. Check it out for yourself, interacting with
4388
 * the program:
4389
 * @dontinclude gengrid_example.c
4390
 * @skip no selection callback
4391
 * @until }
4392
 *
4393
 * We have, finally, one more line of knobs, now sliders, to change
4394
 * the grids behavior. The two first will change the horizontal @b
4395
 * alignment of the whole actual grid of items within the gengrid's
4396
 * viewport:
4397
 * @dontinclude gengrid_example.c
4398
 * @skip items grid horizontal alignment change
4399
 * @until }
4400
 *
4401
 * Naturally, the vertical counterpart just issues
4402
 * elm_gengrid_align_set() changing the second alignment component,
4403
 * instead.
4404
 *
4405
 * The last slider will change the grid's <b>page size</b>, relative
4406
 * to its own one. Try to change those values and, one manner of
4407
 * observing the paging behavior, is to scroll softly and release the
4408
 * mouse button, with different page sizes, at different grid
4409
 * positions, while having lots of items in it -- you'll see it
4410
 * snapping to page boundaries differenty, for each configuration:
4411
 * @dontinclude gengrid_example.c
4412
 * @skip page relative size change
4413
 * @until }
4414
 *
4415
 * This is how the example program's window looks like:
4416
 * @image html screenshots/gengrid_example.png
4417
 * @image latex screenshots/gengrid_example.eps width=\textwidth
4418
 *
4419
 * Note that it starts with three items which we included at will:
4420
 * @dontinclude gengrid_example.c
4421
 * @skip _clicked(grid,
4422
 * @until _clicked(grid,
4423
 * @until _clicked(grid,
4424
 * @until _clicked(grid,
4425
 *
4426
 * See the full @ref gengrid_example_c "source code" for
4427
 * this example.
4428
 *
4429
 */
4430
/**
4431
 * @page entry_example Entry - Example of simple editing
4432
 *
4433
 * As a general overview of @ref Elm_Entry we are going to write an, albeit simple,
4434
 * functional editor. Although intended to show how elm_entry works, this
4435
 * example also makes extensive use of several other widgets. The full code
4436
 * can be found in @ref entry_example.c "entry_example.c" and in the following
4437
 * lines we'll go through the parts especific to the @ref Elm_Entry widget.
4438
 *
4439
 * The program itself is a simple editor, with a file already set to it, that
4440
 * can be set to autosave or not and allows insertion of emoticons and some
4441
 * formatted text. As of this writing, the capabilities of format edition in
4442
 * the entry are very limited, so a lot of manual work is required to change
4443
 * the current text.
4444
 *
4445
 * In any case, the program allows some changes by using the buttons on the
4446
 * top of the window and returning focus back to the main entry afterwards.
4447
 *
4448
 * @image html screenshots/entry_example.png
4449
 * @image latex screenshots/entry_example.eps width=\textwidth
4450
 *
4451
 * We'll begin by showing a few structures used throught the program. First,
4452
 * the application owns data that holds the main window and the main entry
4453
 * where the editting happens. Then, an auxiliary structure we'll use later
4454
 * when inserting icons in our text.
4455
 * @dontinclude entry_example.c
4456
 * @skip typedef
4457
 * @until App_Inwin_Data
4458
 *
4459
 * A little convenience function will insert whatever text we need in the
4460
 * buffer at the current cursor's position and set focus back to this entry.
4461
 * This is done mostly because clicking on any button will make them steal
4462
 * focus, which makes writing text more cumbersome.
4463
 * @skip static void
4464
 * @until }
4465
 *
4466
 * One of the buttons on the top will trigger an @ref Elm_Inwin to open and show
4467
 * us several icons we can insert into the text. We'll jump over most of these
4468
 * functions, but when all the options are chosen, we insert the special
4469
 * markup text that will show the chosen icon in place.
4470
 * @skip edje_file_collection_list_free(emos)
4471
 * @skip static void
4472
 * @until evas_object_del
4473
 * @until }
4474
 *
4475
 * As can be seen in that function, the program lets us add icons to our entry
4476
 * using all the possible configurations for them. That should help to
4477
 * clarify how the different combinations work out by actually seeing them
4478
 * in action.
4479
 *
4480
 * The same popup window has a page to set the settings of the chosen icon,
4481
 * that is, the size and how the item will be placed within the line.
4482
 *
4483
 * The size is done with two entries, limitted to accept numbers and a fixed
4484
 * size of characters. Changing the value in this entries will update the icon
4485
 * size in our struct as seen in the next two callbacks.
4486
 * @skip static void
4487
 * @until }
4488
 * @until }
4489
 *
4490
 * The rest of the options are handled with radio buttons, since only one type
4491
 * of size can be used (@c size, @c absize or @c relsize) and for the vertical
4492
 * sizing it needs to choose between @c ascent and @c full. Depending on which
4493
 * is chosen, the @c item tag is formed accordingly as seen before.
4494
 * @skip static Evas_Object
4495
 * @until evas_object_show(rvascent)
4496
 *
4497
 * The first of our entries is here. There's something worth mentioning about
4498
 * the way we'll create this one. Normally, any entry regardless of whether is
4499
 * single line or not, will be set to scrollable, but in this case, since we
4500
 * are limitting how many characters can fit in them and we know we don't need
4501
 * scrolling, we are not setting this flag. This makes the entry have virtually
4502
 * no appearance on screen, other than its text. This is because an entry is
4503
 * just that, a box that holds text, and in order to have some frame around it
4504
 * or a background color, another widget needs to provide this. When an entry
4505
 * is scrollable, the same scroller used internally does this.
4506
 * We are using @ref Elm_Frame "frames" here to provide some decoration around,
4507
 * then creating our entries, set them to single line, add our two filters and
4508
 * the callback for when their value change.
4509
 * @until _height_changed_cb
4510
 *
4511
 * This function ends with the button that will finally call the item
4512
 * into our editting string.
4513
 * @until }
4514
 *
4515
 * Then we get to the format edition. Here we can add the @c bold and
4516
 * @c emphasis tags to parts of our text. There's a lot of manual work to
4517
 * know what to do here, since we are not implementing an entire state manager
4518
 * and the entry itself doesn't, yet, support all the needed capabilities to
4519
 * make this simpler. We begin by getting the format we are using in our
4520
 * function from the button pressed.
4521
 * @skip  _format_change_cb(void *data, Evas_Object *obj, void *event EINA_UNUSED))
4522
 * @until sizeof(fmt_close)
4523
 *
4524
 * Next we need to find out if we need to insert an opening or a closing tag.
4525
 * For this, we store the current cursor position and create a selection
4526
 * from this point until the beginning of our text, and then get the selected
4527
 * text to look for any existing format tags in it. This is currently the only
4528
 * way in which we can find out what formats is being used in the entry.
4529
 * @until }
4530
 * @until }
4531
 *
4532
 * Once we know what tag to insert, we need a second check in the case it was
4533
 * a closing tag. This is because any other closing tag that comes after would
4534
 * be left dangling alone, so we need to remove it to keep the text consistent.
4535
 * @until }
4536
 * @until }
4537
 * Finally, we clear our fake selections and return the cursor back to the
4538
 * position it had at first, since there is where we want to insert our format.
4539
 * @until cursor_pos_set
4540
 *
4541
 * And finish by calling our convenience function from before, to insert the
4542
 * text at the current cursor and give focus back to the entry.
4543
 * @until }
4544
 *
4545
 * A checkbox on the top of our program tells us if the text we are editing
4546
 * will autosave or not. In it's @c "changed" callback we get the value from
4547
 * the checkbox and call the elm_entry_autosave_set() function with it. If
4548
 * autosave is set, we also call elm_entry_file_save(). This is so the internal
4549
 * timer used to periodically store to disk our changes is started.
4550
 * @skip static void
4551
 * @until }
4552
 *
4553
 * Two more functions to show some cursor playing. Whenever we double click
4554
 * anywhere on our entry, we'll find what word is the cursor placed at and
4555
 * select it. Likewise, for triple clicking, we select the entire line.
4556
 * @skip static void
4557
 * @until _edit_tplclick_cb
4558
 * @until }
4559
 *
4560
 * And finally, the main window of the program contains the entry where we
4561
 * do all the edition and some helping widgets to change format, add icons
4562
 * or change the autosave flag.
4563
 * @skip elm_exit
4564
 * @skip int
4565
 * @until _image_insert_cb
4566
 *
4567
 * And the main entry of the program. Set to scroll, by default we disable
4568
 * autosave and we'll begin with a file set to it because no file selector
4569
 * is being used here. The file is loaded with #ELM_TEXT_FORMAT_MARKUP_UTF8
4570
 * so that any format contained in it is interpreted, otherwise the entry
4571
 * would load it as just text, escaping any tags found and no format or icons
4572
 * would be shown. Then we connect to the double and triple click signals
4573
 * and set focus on the entry so we can start typing right away.
4574
 * @until ELM_MAIN
4575
 *
4576
 * @example entry_example.c
4577
 */
4578

4579
/**
4580
 * @page genlist_example_01 Genlist - basic usage
4581
 *
4582
 * This example creates a simple genlist with a small number of items and
4583
 * a callback that is called whenever an item is selected. All the properties of
4584
 * this genlist are the default ones. The full code for this example can be seen
4585
 * at @ref genlist_example_01_c.
4586
 *
4587
 * For the simplest list that you plan to create, it's necessary to define some
4588
 * of the basic functions that are used for creating each list item, and
4589
 * associating them with the "item class" for that list. The item class is just
4590
 * an struct that contains pointers to the specific list item functions that are
4591
 * common to all the items of the list.
4592
 *
4593
 * Let's show it by example. Our item class is declared globally and static as
4594
 * it will be the only item class that we need (we are just creating one list):
4595
 *
4596
 * @dontinclude genlist_example_01.c
4597
 * @skip static Elm_Genlist
4598
 * @until static Elm_Genlist
4599
 *
4600
 * This item class will be used for every item that we create. The only
4601
 * functions that we are going to set are @c label_get and @c icon_get. As the
4602
 * name suggests, they are used by the genlist to generate the label for the
4603
 * respective item, and to generate icon(s) to it too. Both the label and icon
4604
 * get functions can be called more than once for each item, with different @c
4605
 * part parameters, which represent where in the theme of the item that label or
4606
 * icon is going to be set.
4607
 *
4608
 * The default theme for the genlist contains only one area for label, and two
4609
 * areas for icon ("elm.swallow.icon" and "elm.swallow.end"). Since we just want
4610
 * to set the first icon (that will be at the left side of the label), we
4611
 * compare the part name given with "elm.swallow.icon". Notice that the
4612
 * @c label_get function must return a strduped string, that will be freed later
4613
 * automatically by the list. Here's the code for @c label_get and @c icon_get:
4614
 *
4615
 * @until static void
4616
 *
4617
 * We will also provide a function that will be called whenever an item is
4618
 * selected in the genlist. However, this function is not part of the item
4619
 * class, it will be passed for each item being added to the genlist explicitly.
4620
 * Notice the similarity of the function signature with those used by @c
4621
 * evas_object_smart_callback_add:
4622
 *
4623
 * @until }
4624
 *
4625
 * Now let's show the code used for really creating the list. Skipping
4626
 * boilerplate code used for creating a window and background, the first piece
4627
 * of code specific to our genlist example is setting the pointer functions of
4628
 * the item class to our above defined functions:
4629
 *
4630
 * @skip _itc
4631
 * @until func.del
4632
 *
4633
 * Notice that we also choose to use the "default" style for our genlist items.
4634
 * Another interesting point is that @c state_get and @c del are set to @c NULL,
4635
 * since we don't need these functions now. @c del doesn't need to be used
4636
 * because we don't add any data that must be freed to our items, and @c
4637
 * state_get is also not used since all of our items are the same and don't need
4638
 * to have different states to be used for each item. Finally we create our
4639
 * list:
4640
 *
4641
 * @until genlist_add
4642
 *
4643
 * Now we append several items to the list, and for all of them we need to give
4644
 * the list pointer, a pointer to the item class, the data that will be used
4645
 * with that item, a pointer to the parent of this item if it is in a group type
4646
 * list (this is not the case so we pass @c NULL), possible flags for this item,
4647
 * the callback for when the item is selected, and the data pointer that will be
4648
 * given to the selected callback.
4649
 *
4650
 * @until }
4651
 *
4652
 * The rest of the code is also common to all the other examples, so it will be
4653
 * omitted here (look at the full source code link above if you need it).
4654
 *
4655
 * You can try to play with this example, and see the selected callback being
4656
 * called whenever an item is clicked. It also already has some features enabled
4657
 * by default, like vertical bounce animation when reaching the end of the list,
4658
 * automatically visible/invisible scrollbar, etc. Look at the @ref
4659
 * genlist_example_02 to see an example of setting these properties to the list.
4660
 *
4661
 * The current example will look like this when running:
4662
 *
4663
 * @image html screenshots/genlist_example_01.png
4664
 * @image latex screenshots/genlist_example_01.eps width=\textwidth
4665
 */
4666

4667
/**
4668
 * @page genlist_example_02 Genlist - list setup functions
4669
 *
4670
 * This example is very similar to the @ref genlist_example_01, but it fetch
4671
 * most of the properties of the genlist and displays them on startup (thus
4672
 * getting the default value for them) and then set them to some other values,
4673
 * to show how to use that API. The full source code is at @ref
4674
 * genlist_example_02_c.
4675
 *
4676
 * Considering that the base code for instantiating a genlist was already
4677
 * described in the previous example, we are going to focus on the new code.
4678
 *
4679
 * Just a small difference for the @c _item_label_get function, we are going to
4680
 * store the time that this function was called. This is the "realized" time,
4681
 * the time when the visual representation of this item was created. This is the
4682
 * code for the @c label_get function:
4683
 *
4684
 * @dontinclude genlist_example_02.c
4685
 * @skip static char
4686
 * @until return strdup
4687
 *
4688
 * Now let's go to the list creation and setup. First, just after creating the
4689
 * list, we get most of the default properties from it, and print them on the
4690
 * console:
4691
 *
4692
 * @skip genlist_add
4693
 * @until printf("\n")
4694
 *
4695
 * We are going to change some of the properties of our list.
4696
 *
4697
 * There's no need to call the selected callback at every click, just when the
4698
 * selected item changes, thus we call elm_genlist_select_mode_set() with
4699
 * ELM_OBJECT_SELECT_MODE_ALWAYS.
4700
 *
4701
 * For this list we don't want bounce animations at all, so we set both the
4702
 * horizontal bounce and the vertical bounce to false with
4703
 * elm_genlist_bounce_set().
4704
 *
4705
 * We also want our list to compress items if they are wider than the list
4706
 * width (thus we call elm_genlist_mode_set(obj, ELM_LIST_COMPRESS).
4707
 *
4708
 * The items have different width, so they are not homogeneous:
4709
 * elm_genlist_homogeneous_set() is set to false.
4710
 *
4711
 * Since the compress mode is active, the call to
4712
 * elm_genlist_mode_set() doesn't make difference, but the current
4713
 * option would make the list to have at least the width of the largest item.
4714
 *
4715
 * This list will support multiple selection, so we call
4716
 * elm_genlist_multi_select_set() on it.
4717
 *
4718
 * The option elm_genlist_mode_set() would allow text block to
4719
 * wrap lines if the Edje part is configured with "text.min: 0 1", for example.
4720
 * But since we are compressing the elements to the width of the list, this
4721
 * option wouldn't take any effect.
4722
 *
4723
 * We want the vertical scrollbar to be always displayed, and the orizontal one
4724
 * to never be displayed, and set this with elm_genlist_scroller_policy_set().
4725
 *
4726
 * The timeout to consider a longpress is set to half of a second with
4727
 * elm_genlist_longpress_timeout_set().
4728
 *
4729
 * We also change the block count to a smaller value, but that should have not
4730
 * impact on performance since the number of visible items is too small. We just
4731
 * increase the granularity of the block count (setting it to have at most 4
4732
 * items).
4733
 *
4734
 * @until block_count_set
4735
 *
4736
 * Now let's add elements to the list:
4737
 *
4738
 * @until item_append
4739
 * @until }
4740
 *
4741
 * It's exactly the same as the previous example. The difference is on the
4742
 * behavior of the list, if you try to scroll, select items and so.
4743
 *
4744
 * In this example we also need two buttons. One of them, when clicked, will
4745
 * display several status info about the current selection, the "realized"
4746
 * items, the item in the middle of the screen, and the current mode and active
4747
 * item of that mode for the genlist.
4748
 *
4749
 * The other button will ask the genlist to "realize" again the items already
4750
 * "realized", so their respective label_get and icon_get functions will be
4751
 * called again.
4752
 *
4753
 * These are the callbacks for both of these buttons:
4754
 *
4755
 * @dontinclude genlist_example_02.c
4756
 * @skip item_sel_cb
4757
 * @skip static
4758
 * @until }
4759
 * @until }
4760
 *
4761
 * Try to scroll, select some items and click on the "Show status" button.
4762
 * You'll notice that not all items of the list are "realized", thus consuming
4763
 * just a small amount of memory. The selected items are listed in the order
4764
 * that they were selected, and the current selected item printed using
4765
 * elm_genlist_selected_item_get() is the first selected item of the multiple
4766
 * selection.
4767
 *
4768
 * Now resize the window so that you can see the "realized time" of some items.
4769
 * This is the time of when the label_get function was called. If you click on
4770
 * the "Realize" button, all the already realized items will be rebuilt, so the
4771
 * time will be updated for all of them.
4772
 *
4773
 * The current example will look like this when running:
4774
 *
4775
 * @image html screenshots/genlist_example_02.png
4776
 * @image latex screenshots/genlist_example_02.eps width=\textwidth
4777
 */
4778

4779
/**
4780
 * @page genlist_example_03 Genlist - different width options
4781
 *
4782
 * This example doesn't present any other feature that is not already present in
4783
 * the other examples, but visually shows the difference between using the
4784
 * default list options (first list of the example), setting the horizontal mode
4785
 * to #ELM_LIST_LIMIT (second list), enabling compress mode (third list) and
4786
 * using height_for_width option (fourth list).
4787
 *
4788
 * The full code for this example is listed below:
4789
 *
4790
 * @include genlist_example_03.c
4791
 *
4792
 * And the screenshot of the running example:
4793
 *
4794
 * @image html screenshots/genlist_example_03.png
4795
 * @image latex screenshots/genlist_example_03.eps width=\textwidth
4796
 *
4797
 * @example genlist_example_03.c
4798
 */
4799

4800
/**
4801
 * @page genlist_example_04 Genlist - items manipulation
4802
 *
4803
 * This example is also similar ot the @ref genlist_example_01, but it
4804
 * demonstrates most of the item manipulation functions. See the full source
4805
 * code at @ref genlist_example_04_c.
4806
 *
4807
 * In this example, we also will use the concept of creating groups of items in
4808
 * the genlist. Each group of items is composed by a parent item (which will be
4809
 * the index of the group) and several children of this item. Thus, for the
4810
 * children, we declare a normal item class. But we also are going to declare a
4811
 * different item class for the group index (which in practice is another type
4812
 * of item in the genlist):
4813
 *
4814
 * @dontinclude genlist_example_04.c
4815
 * @skip _item_sel_cb
4816
 * @skip static
4817
 * @until }
4818
 * @until }
4819
 *
4820
 * We will add buttons to the window, where each button provides one
4821
 * functionality of the genlist item API. Each button will have a callback
4822
 * attached, that will really execute this functionality. An example of these
4823
 * callbacks is the next one, for the elm_genlist_item_insert_after() function:
4824
 *
4825
 * @skip insert_before_cb
4826
 * @skip static
4827
 * @until }
4828
 *
4829
 * If you want ot see the other button functions, look at the full source code
4830
 * link above.
4831
 *
4832
 * Each button will be created with a function that already creates the button,
4833
 * add it to an elementary box, and attach the specified callback. This is the
4834
 * function that does it:
4835
 *
4836
 * @skip genlist_item_update
4837
 * @skip static
4838
 * @until }
4839
 *
4840
 * In our @c elm_main function, besides the code for setting up the window, box
4841
 * and background, we also initialize our two item classes:
4842
 *
4843
 * @skip _itc.item_style
4844
 * @until _itc_group.func.del
4845
 *
4846
 * This example uses a different style for the items, the @a double_label, which
4847
 * provides a text field for the item text, and another text field for a subtext.
4848
 *
4849
 * For the group index we use the @a group_index style, which provides a
4850
 * different appearance, helping to identify the end of a group and beginning of
4851
 * another one.
4852
 *
4853
 * Now, after the code for creating the list, setting up the box and other
4854
 * stuff, let's add the buttons with their respective callbacks:
4855
 *
4856
 * @skip _button_add
4857
 * @until bt_top_show
4858
 *
4859
 * The main code for adding items to the list is a bit more complex than the one
4860
 * from the previous examples. We check if each item is multiple of 7, and if
4861
 * so, they are group indexes (thus each group has 6 elements by default, in
4862
 * this example):
4863
 *
4864
 * @skip for
4865
 * @until }
4866
 * @until }
4867
 *
4868
 * Then we also check for specific items, and add callbacks to them on the
4869
 * respective buttons, so we can show, bring in, etc.:
4870
 *
4871
 * @until }
4872
 * @until }
4873
 *
4874
 * Once you understand the code from the @ref genlist_example_01, it should be
4875
 * easy to understand this one too. Look at the full code, and also try to play
4876
 * a bit with the buttons, adding items, bringing them to the viewport, and so.
4877
 *
4878
 * The example will look like this when running:
4879
 *
4880
 * @image html screenshots/genlist_example_04.png
4881
 * @image latex screenshots/genlist_example_04.eps width=\textwidth
4882
 */
4883

4884
/**
4885
 * @page genlist_example_05 Genlist - working with subitems
4886
 *
4887
 * This is probably the most complex example of elementary @ref Elm_Genlist. We
4888
 * create a tree of items, using the subitems properties of the items, and keep
4889
 * it in memory to be able to expand/hide subitems of an item. The full source
4890
 * code can be found at @ref genlist_example_05_c
4891
 *
4892
 * The main point is the way that Genlist manages subitems. Clicking on an
4893
 * item's button to expand it won't really show its children. It will only
4894
 * generate the "expand,request" signal, and the expansion must be done
4895
 * manually.
4896
 *
4897
 * In this example we want to be able to add items as subitems of another item.
4898
 * If an item has any child, it must be displayed using a parent class,
4899
 * otherwise it will use the normal item class.
4900
 *
4901
 * It will be possible to delete items too. Once a tree is constructed (with
4902
 * subitems of subitems), and the user clicks on the first parent (root of the
4903
 * tree), the entire subtree must be hidden. However, just calling
4904
 * elm_genlist_item_expanded_set(item, EINA_FALSE) won't hide them. The only
4905
 * thing that happens is that the parent item will change its appearance to
4906
 * represent that it's contracted. And the signal "contracted" will be emitted
4907
 * from the genlist. Thus, we must call elm_genlist_item_subitems_clear() to
4908
 * delete all its subitems, but still keep a way to recreate them when expanding
4909
 * the parent again. That's why we are going to keep a node struct for each
4910
 * item, that will be the data of the item, with the following information:
4911
 *
4912
 * @dontinclude genlist_example_05.c
4913
 * @skip typedef
4914
 * @until }
4915
 *
4916
 * This @c Node_Data contains the value for the item, a number indicating its
4917
 * level under the tree, a list of children (to be able to expand it later) and
4918
 * a boolean indicating if it's a favorite item or not.
4919
 *
4920
 * We use 3 different item classes in this example:
4921
 *
4922
 * One for items that don't have children:
4923
 *
4924
 * @skip nitems
4925
 * @skip static
4926
 * @until }
4927
 * @until }
4928
 *
4929
 * One for items that have children:
4930
 *
4931
 * @skip item_sel
4932
 * @skip static
4933
 * @until }
4934
 * @until }
4935
 *
4936
 * And one for items that were favorited:
4937
 *
4938
 * @skip static
4939
 * @until }
4940
 * @until }
4941
 *
4942
 * The favorite item class is there just to demonstrate the
4943
 * elm_genlist_item_item_class_update() function in action. It would be much
4944
 * simpler to implement the favorite behavior by just changing the icon inside
4945
 * the icon_get functions when the @c favorite boolean is activated.
4946
 *
4947
 * Now we are going to declare the callbacks for the buttons that add, delete
4948
 * and change items.
4949
 *
4950
 * First, a button for appending items to the list:
4951
 *
4952
 * @until item_append
4953
 * @until }
4954
 *
4955
 * If an item is selected, a new item will be appended to the same level of that
4956
 * item, but using the selected item's parent as its parent too. If no item is
4957
 * selected, the new item will be appended to the root of the tree.
4958
 *
4959
 * Then the callback for marking an item as favorite:
4960
 *
4961
 * @until elm_genlist_item_update
4962
 * @until }
4963
 *
4964
 * This callback is very simple, it just changes the item class of the selected
4965
 * item for the "favorite" one, or go back to the "item" or "parent" class
4966
 * depending on that item having children or not.
4967
 *
4968
 * Now, the most complex operation (adding a child to an item):
4969
 *
4970
 * @until elm_genlist_item_update
4971
 * @until }
4972
 *
4973
 * This function gets the data of the selected item, create a new data (for the
4974
 * item being added), and appends it to the children list of the selected item.
4975
 *
4976
 * Then we must check if the selected item (let's call it @c item1 now) to which
4977
 * the new item (called @c item2 from now on) was already a parent item too
4978
 * (using the parent item class) or just a normal item (using the default item
4979
 * class). In the first case, we just have to append the item to the end of the
4980
 * @c item1 children list.
4981
 *
4982
 * However, if the @c item1 didn't have any child previously, we have to change
4983
 * it to a parent item now. It would be easy to just change its item class to
4984
 * the parent type, but there's no way to change the item flags and make it be
4985
 * of the type #ELM_GENLIST_ITEM_TREE. Thus, we have to delete it and create
4986
 * a new item, and add this new item to the same position that the deleted one
4987
 * was. That's the reason of the checks inside the bigger @c if.
4988
 *
4989
 * After adding the item to the newly converted parent, we set it to not
4990
 * expanded (since we don't want to show the added item immediately) and select
4991
 * it again, since the original item was deleted and no item is selected at the
4992
 * moment.
4993
 *
4994
 * Finally, let's show the callback for deleting items:
4995
 *
4996
 * @until elm_genlist_item_update
4997
 * @until }
4998
 *
4999
 * Since we have an iternal list representing each element of our tree, once we
5000
 * delete an item we have to go deleting each child of that item, in our
5001
 * internal list. That's why we have the function @c _clear_list, which
5002
 * recursively goes freeing all the item data.
5003
 *
5004
 * This is necessary because only when we really want to delete the item is when
5005
 * we need to delete the item data. When we are just contracting the item, we
5006
 * need to hide the children by deleting them, but keeping the item data.
5007
 *
5008
 * Now there are two callbacks that will be called whenever the user clicks on
5009
 * the expand/contract icon of the item. They will just request to items to be
5010
 * contracted or expanded:
5011
 *
5012
 * @until elm_genlist_item_expanded_set(
5013
 * @until elm_genlist_item_expanded_set(
5014
 * @until }
5015
 *
5016
 * When the elm_genlist_item_expanded_set() function is called with @c
5017
 * EINA_TRUE, the @c _expanded_cb will be called. And when this happens, the
5018
 * subtree of that item must be recreated again. This is done using the internal
5019
 * list stored as item data for each item. The function code follows:
5020
 *
5021
 * @until }
5022
 *
5023
 * Each appended item is set to contracted, so we don't have to deal with
5024
 * checking if the item was contracted or expanded before its parent being
5025
 * contracted. It could be easily implemented, though, by adding a flag expanded
5026
 * inside the item data.
5027
 *
5028
 * Now, the @c _contracted_cb, which is much simpler:
5029
 *
5030
 * @until }
5031
 *
5032
 * We just have to call elm_genlist_item_subitems_clear(), that will take care
5033
 * of deleting every item, and keep the item data still stored (since we don't
5034
 * have any del function set on any of our item classes).
5035
 *
5036
 * Finally, the code inside @c elm_main is very similar to the other examples:
5037
 *
5038
 * @skip elm_main
5039
 * @until ELM_MAIN
5040
 *
5041
 * The example will look like this when running:
5042
 *
5043
 * @image html screenshots/genlist_example_05.png
5044
 * @image latex screenshots/genlist_example_05.eps width=\textwidth
5045
 */
5046

5047
/**
5048
 * @page thumb_example_01 Thumb - generating thumbnails.
5049
 *
5050
 * This example shows how to create a simple thumbnail object with Elementary.
5051
 * The full source code can be found at @ref thumb_example_01_c
5052
 *
5053
 * Everything is very simple. First we need to tell elementary that we need
5054
 * Ethumb to generate the thumbnails:
5055
 *
5056
 * @dontinclude thumb_example_01.c
5057
 * @skipline elm_need_ethumb
5058
 *
5059
 * Then, after creating the window and background, we setup our client to
5060
 * generate images of 160x160:
5061
 *
5062
 * @skip client_get
5063
 * @until size_set
5064
 *
5065
 * After that, we can start creating thumbnail objects. They are very similar to
5066
 * image or icon objects:
5067
 *
5068
 * @until thumb_reload
5069
 *
5070
 * As you can see, the main different function here is elm_thumb_reload(), which
5071
 * will check if the options of the Ethumb client have changed. If so, it will
5072
 * re-generate the thumbnail, and show the new one.
5073
 *
5074
 * Notice in this example that the thumbnail object is displayed on the size of
5075
 * the window (320x320 pixels), but the thumbnail generated and stored has size
5076
 * 160x160 pixels. That's why the picture seems upscaled.
5077
 *
5078
 * Ideally, you will be generating thumbnails with the size that you will be
5079
 * using them.
5080
 *
5081
 * The example will look like this when running:
5082
 *
5083
 * @image html screenshots/thumb_example_01.png
5084
 * @image latex screenshots/thumb_example_01.eps width=\textwidth
5085
 */
5086

5087
/**
5088
 * @page progressbar_example Progress bar widget example
5089
 *
5090
 * This application is a thorough example of the progress bar widget,
5091
 * consisting of a window with various progress bars, each with a given
5092
 * look/style one can give to those widgets. With two auxiliary
5093
 * buttons, one can start or stop a timer which will fill in the bars
5094
 * in synchrony, simulating an underlying task being completed.
5095
 *
5096
 * We create @b seven progress bars, being three of them horizontal,
5097
 * three vertical and a final one under the "wheel" alternate style.
5098
 *
5099
 * For the first one, we add a progress bar on total pristine state,
5100
 * with no other call than the elm_progressbar_add() one:
5101
 * @dontinclude progressbar_example.c
5102
 * @skip pb with no label
5103
 * @until pb1
5104
 * See, than, that the defaults of a progress bar are:
5105
 * - no primary label shown,
5106
 * - unit label set to @c "%.0f %%",
5107
 * - no icon set
5108
 *
5109
 * The second progress bar is given a primary label, <c>"Infinite
5110
 * bounce"</c>, and, besides, it's set to @b pulse. See how, after one
5111
 * starts the progress timer, with the "Start" button, it animates
5112
 * differently than the previous one. It won't account for the
5113
 * progress, itself, and just dumbly animate a small bar within its
5114
 * bar region.
5115
 * @dontinclude progressbar_example.c
5116
 * @skip pb with label
5117
 * @until pb2
5118
 *
5119
 * Next, comes a progress bar with an @b icon, a primary label and a
5120
 * unit label @b function set. It's also made to grow its bar in an
5121
 * @b inverted manner, so check that out during the timer's progression:
5122
 * @dontinclude progressbar_example.c
5123
 * @skip ic1 =
5124
 * @until pb3
5125
 * Another important thing in this one is the call to
5126
 * elm_progressbar_span_size_set() -- this is how we forcefully set a
5127
 * minimum horizontal size to our whole window! We're not resizing it
5128
 * manually, as you can see in the @ref progressbar_example_c
5129
 * "complete code".
5130
 *
5131
 * The format callback is a simple function that gets passed the progress value
5132
 * and returns a string. A free function should be provided as well, if the
5133
 * format callback allocates memory.
5134
 * @dontinclude progressbar_example.c
5135
 * @skip Format callback
5136
 * @until }
5137
 * @until }
5138
 *
5139
 * The last horizontal progress bar has a callback that gets called when its
5140
 * value is @b changed. This callback updates a label to provide an estimate
5141
 * when the operation finishes.
5142
 * @dontinclude progressbar_example.c
5143
 * @skip pb3
5144
 * @skip changed trigger
5145
 * @until pb4
5146
 *
5147
 * The "changed" signal is emitted every time the progressbar value is updated
5148
 * through @ref elm_progressbar_value_set(). This callback calculates and
5149
 * displays the ETA based on the progress and time that has passed.
5150
 * @dontinclude progressbar_example.c
5151
 * @skip Callback for "changed" signal
5152
 * @until }
5153
 * @until }
5154
 * @until }
5155
 *
5156
 * The next three progress bars are just variants on the ones already
5157
 * shown, but now all being @b vertical. Another time we use one of
5158
 * than to give the window a minimum vertical size, with
5159
 * elm_progressbar_span_size_set().  To demonstrate this trick once
5160
 * more, the fifth one, which is also set to pulse, has a smaller
5161
 * hardcoded span size:
5162
 * @dontinclude progressbar_example.c
5163
 * @skip vertical pb, with pulse
5164
 * @until pb6
5165
 *
5166
 * We end the widget demonstration by showing a progress bar with the
5167
 * special @b "wheel" progress bar style. One does @b not need to set
5168
 * it to pulse, with elm_progressbar_pulse_set(), explicitly, because
5169
 * its theme does not take it in account:
5170
 * @dontinclude progressbar_example.c
5171
 * @skip "wheel"
5172
 * @until pb8
5173
 *
5174
 * The two buttons exercising the bars, the facto, follow:
5175
 * @dontinclude progressbar_example.c
5176
 * @skip elm_button_add
5177
 * @until evas_object_show(bt)
5178
 * @until evas_object_show(bt)
5179
 *
5180
 * The first of the callbacks will, for the progress bars set to
5181
 * pulse, start the pulsing animation at that time. For the others, a
5182
 * timer callback will take care of updating the values:
5183
 * @dontinclude progressbar_example.c
5184
 * @skip static Eina_Bool
5185
 * @until }
5186
 * @until }
5187
 * @until }
5188
 *
5189
 * Finally, the callback to stop the progress timer will stop the
5190
 * pulsing on the pulsing progress bars and, for the others, to delete
5191
 * the timer which was acting on their values:
5192
 * @dontinclude progressbar_example.c
5193
 * @skip end of show
5194
 * @until }
5195
 * @until }
5196
 *
5197
 * This is how the example program's window looks like:
5198
 * @image html screenshots/progressbar_example.png
5199
 * @image latex screenshots/progressbar_example.eps width=\textwidth
5200
 *
5201
 * See the full @ref progressbar_example_c "source code" for
5202
 * this example.
5203
 *
5204
 */
5205

5206
/**
5207
 * @page tutorial_notify Notify example
5208
 * @dontinclude notify_example_01.c
5209
 *
5210
 * In this example we will have 3 notifies in 3 different positions. The first
5211
 * will dissappear after 5 seconds or when a outside clickking occurs, the
5212
 * second and third will not disappear and differ from each other only in
5213
 * position.
5214
 *
5215
 * We start our example with the usual stuff you've seen in other examples:
5216
 * @until show(bx)
5217
 *
5218
 * We now create a label to use as the content of our first notify:
5219
 * @until show
5220
 *
5221
 * Having the label we move to creating our notify, telling it to block events,
5222
 * setting its timeout(to autohide it):
5223
 * @until pack_end
5224
 *
5225
 * To have the notify dissappear when a click outside its area occur we have to
5226
 * listen to its "block,clicked" signal:
5227
 * @until smart_callback
5228
 *
5229
 * Our callback will look like this:
5230
 * @skip static
5231
 * @until }
5232
 * @dontinclude notify_example_01.c
5233
 *
5234
 * Next we create another label and another notify. Note, however, that this
5235
 * time we don't set a timeout and don't have it block events. What we do is set
5236
 * the orient so that this notify will appear in the bottom of its parent:
5237
 * @skip smart_callback
5238
 * @skip content
5239
 * @until pack_end
5240
 *
5241
 * For our third notify the only change is the orient which is now center:
5242
 * @until pack_end
5243
 *
5244
 * Now we tell the main loop to run:
5245
 * @until ELM_MAIN
5246
 *
5247
 * Our example will initially look like this:
5248
 *
5249
 * @image html screenshots/notify_example_01.png
5250
 * @image latex screenshots/notify_example_01.eps width=\textwidth
5251
 *
5252
 * Once the first notify is hidden:
5253
 *
5254
 * @image html screenshots/notify_example_01_a.png
5255
 * @image latex screenshots/notify_example_01_a.eps width=\textwidth
5256
 *
5257
 * @example notify_example_01.c
5258
 */
5259

5260
/**
5261
 * @page popup_example_01_c popup_example_01.c
5262
 * @include popup_example_01.c
5263
 *
5264
 * This example will initially look like this:
5265
 *
5266
 * @image html screenshots/popup_example_01.png
5267
 * @image latex screenshots/popup_example_01.eps width=\textwidth
5268
 *
5269
 * Once the popup is hidden after timeout:
5270
 *
5271
 * @image html screenshots/popup_example_01_a.png
5272
 * @image latex screenshots/popup_example_01_a.eps width=\textwidth
5273
 *
5274
 * @example popup_example_01.c
5275
 */
5276

5277
 /** @page popup_example_02_c popup_example_02.c
5278
 * @include popup_example_02.c
5279
 *
5280
 * This example will look like this:
5281
 *
5282
 * @image html screenshots/popup_example_02.png
5283
 * @image latex screenshots/popup_example_02.eps width=\textwidth
5284
 *
5285
 * @example popup_example_02.c
5286
 */
5287

5288
/**
5289
 * @page popup_example_03_c popup_example_03.c
5290
 * @include popup_example_03.c
5291
 *
5292
 * This example will look like this:
5293
 *
5294
 * @image html screenshots/popup_example_03.png
5295
 * @image latex screenshots/popup_example_03.eps width=\textwidth
5296
 *
5297
 * @example popup_example_03.c
5298
 */
5299

5300
/**
5301
 * @page tutorial_frame Frame example
5302
 * @dontinclude frame_example_01.c
5303
 *
5304
 * In this example we are going to create 4 Frames with different styles and
5305
 * add a rectangle of different color in each.
5306
 *
5307
 * We start we the usual setup code:
5308
 * @until show(bg)
5309
 *
5310
 * And then create one rectangle:
5311
 * @until show
5312
 *
5313
 * To add it in our first frame, which since it doesn't have it's style
5314
 * specifically set uses the default style:
5315
 * @until show
5316
 *
5317
 * And then create another rectangle:
5318
 * @until show
5319
 *
5320
 * To add it in our second frame, which uses the "pad_small" style, note that
5321
 * even tough we are setting a text for this frame it won't be show, only the
5322
 * default style shows the Frame's title:
5323
 * @until show
5324
 * @note The "pad_small", "pad_medium", "pad_large" and "pad_huge" styles are
5325
 * very similar, their only difference is the size of the empty area around
5326
 * the content of the frame.
5327
 *
5328
 * And then create yet another rectangle:
5329
 * @until show
5330
 *
5331
 * To add it in our third frame, which uses the "outdent_top" style, note
5332
 * that even tough we are setting a text for this frame it won't be show,
5333
 * only the default style shows the Frame's title:
5334
 * @until show
5335
 *
5336
 * And then create one last rectangle:
5337
 * @until show
5338
 *
5339
 * To add it in our fourth and final frame, which uses the "outdent_bottom"
5340
 * style, note that even tough we are setting a text for this frame it won't
5341
 * be show, only the default style shows the Frame's title:
5342
 * @until show
5343
 *
5344
 * And now we are left with just some more setup code:
5345
 * @until ELM_MAIN()
5346
 *
5347
 * Our example will look like this:
5348
 *
5349
 * @image html screenshots/frame_example_01.png
5350
 * @image latex screenshots/frame_example_01.eps width=\textwidth
5351
 *
5352
 * @example frame_example_01.c
5353
 */
5354

5355
/**
5356
 * @page tutorial_check Check example
5357
 * @dontinclude check_example_01.c
5358
 *
5359
 * This example will show 2 checkboxes, one with just a label and the second
5360
 * one with both a label and an icon. This example also illustrates how to
5361
 * have the checkbox change the value of a variable and how to react to those
5362
 * changes.
5363
 *
5364
 * We will start with the usual setup code:
5365
 * @skip EAPI_MAIN
5366
 * @until elm_win_autodel_set
5367
 *
5368
 * And now we create our first checkbox, set its label, tell it to change
5369
 * the value of @p value when the checkbox stats is changed and ask to be
5370
 * notified of state changes:
5371
 * @until show
5372
 *
5373
 * For our second checkbox we are going to set an icon so we need to create
5374
 * and icon:
5375
 * @until show
5376
 * @note For simplicity we are using a rectangle as icon, but any evas object
5377
 * can be used.
5378
 *
5379
 * And for our second checkbox we set the label, icon and state to true:
5380
 * @until show
5381
 *
5382
 * We now do some more setup:
5383
 * @until ELM_MAIN
5384
 *
5385
 * And finally implement the callback that will be called when the first
5386
 * checkbox's state changes. This callback will use @p data to print a
5387
 * message:
5388
 * @dontinclude check_example_01.c
5389
 * @skip static
5390
 * @until }
5391
 * @note This work because @p data is @p value(from the main function) and @p
5392
 * value is changed when the checkbox is changed.
5393
 *
5394
 * Our example will look like this:
5395
 *
5396
 * @image html screenshots/check_example_01.png
5397
 * @image latex screenshots/check_example_01.eps width=\textwidth
5398
 *
5399
 * @example check_example_01.c
5400
 */
5401

5402
/**
5403
 * @page tutorial_colorselector Color selector example
5404
 * @dontinclude colorselector_example_01.c
5405
 *
5406
 * This example shows how to change the color of a rectangle using a color
5407
 * selector. We aren't going to explain a lot of the code since it's the
5408
 * usual setup code:
5409
 * @until show(rect)
5410
 *
5411
 * Now that we have a window with background and a rectangle we can create
5412
 * our color_selector
5413
 * @until elm_colorselector_add
5414
 *
5415
 * Now colors can be loaded to color selector's palette by setting the palette name
5416
 * @until show(cs)
5417
 *
5418
 * Next we ask to be notified whenever the color changes on selector:
5419
 * @until changed
5420
 *
5421
 * Next we ask to be notified whenever the color item is selected and longpressed:
5422
 * @until color,item,longpressed
5423
 *
5424
 * We add some more code to the usual setup code:
5425
 * @until ELM_MAIN()
5426
 *
5427
 * now get to the "changed" callback that sets the color of the rectangle:
5428
 * @until }
5429
 *
5430
 * And now get to the "color,item,selected" callback that sets the color of the rectangle:
5431
 * @until }
5432
 *
5433
 * And now get to the "color,item,longpressed" callback that gets and displays
5434
 * the color of the rectangle:
5435
 * @until }
5436
 *
5437
 * This example will look like this:
5438
 *
5439
 * @image html screenshots/colorselector_example_01.png
5440
 * @image latex screenshots/colorselector_example_01.eps width=\textwidth
5441
 *
5442
 * @example colorselector_example_01.c
5443
 */
5444

5445
/**
5446
 * @page slideshow_example Slideshow widget example
5447
 *
5448
 * This application is aimed to exemplify the slideshow widget. It
5449
 * consists of a window with a slideshow widget set as "resize
5450
 * object", along with a control bar, in the form of a notify. Those
5451
 * controls will exercise most of the slideshow's API functions.
5452
 *
5453
 * We create the slideshow, itself, first, making it @b loop on its
5454
 * image items, when in slideshow mode:
5455
 * @dontinclude slideshow_example.c
5456
 * @skip slideshow = elm_slideshow_add
5457
 * @until evas_object_show
5458
 *
5459
 * Next, we define the <b>item class</b> for our slideshow
5460
 * items. Slideshow images are going to be Elementary @ref Elm_Photo "photo"
5461
 * widgets, here, as pointed by our @c get class
5462
 * function. We'll let the Elementary infrastructure to delete those
5463
 * objects for us, and, as there's no additional data attached to our
5464
 * slideshow items, the @c del class function can be left undefined:
5465
 * @dontinclude slideshow_example.c
5466
 * @skip itc
5467
 * @until ;
5468
 * @dontinclude slideshow_example.c
5469
 * @skip itc.func
5470
 * @until = NULL
5471
 * @dontinclude slideshow_example.c
5472
 * @skip get our images to make slideshow items
5473
 * @until }
5474
 *
5475
 * We now get to populate the slideshow widget with items. Our images
5476
 * are going to be some randomly chosen from the Elementary package,
5477
 * nine of them. For the first eight, we insert them ordered in the
5478
 * widget, by using elm_slideshow_item_sorted_insert(). The comparing
5479
 * function will use the image names to sort items. The last item is
5480
 * inserted at the end of the slideshow's items list, with
5481
 * elm_slideshow_item_add(). We check out how that list ends with
5482
 * elm_slideshow_items_get(), than:
5483
 * @dontinclude slideshow_example.c
5484
 * @skip static const char *img
5485
 * @until _2
5486
 * @dontinclude slideshow_example.c
5487
 * @skip first =
5488
 * @until data_get
5489
 *
5490
 * Note that we save the pointers to the first and last items in the
5491
 * slideshow, for future use.
5492
 *
5493
 * What follows is the code creating a notify, to be shown over the
5494
 * slideshow's viewport, with knobs to act on it. We're not showing
5495
 * that boilerplate code, but only the callbacks attached to the
5496
 * interesting smart events of those knobs. The first four are
5497
 * buttons, which will:
5498
 * - Select the @b next item in the slideshow
5499
 * - Select the @b previous item in the slideshow
5500
 * - Select the @b first item in the slideshow
5501
 * - Select the @b last item in the slideshow
5502
 *
5503
 * Check out the code for those four actions, being the two last @c
5504
 * data pointers the same @c first and @c last pointers we save
5505
 * before, respectively:
5506
 * @dontinclude slideshow_example.c
5507
 * @skip jump to next
5508
 * @until }
5509
 * @until }
5510
 * @until }
5511
 * @until }
5512
 *
5513
 * What follow are two hoversels, meant for one to change the
5514
 * slideshow's @b transition and @b layout styles, respectively. We
5515
 * fetch all the available transition and layout names to populate
5516
 * those widgets and, when one selects any of them, we apply the
5517
 * corresponding setters on the slideshow:
5518
 * @dontinclude slideshow_example.c
5519
 * @skip hv = elm_hoversel_add
5520
 * @until show(hv)
5521
 * @until show(hv)
5522
 * @dontinclude slideshow_example.c
5523
 * @skip transition changed
5524
 * @until }
5525
 * @until }
5526
 *
5527
 * For one to change the transition @b time on the slideshow widget,
5528
 * we use a spinner widget. We set it to the initial value of 3
5529
 * (seconds), which will be probed by the next knob -- a button
5530
 * starting the slideshow, de facto. Note that changing the transition
5531
 * time while a slideshow is already happening will adjust its
5532
 * transition time:
5533
 * @dontinclude slideshow_example.c
5534
 * @skip spin = elm_spinner_add
5535
 * @until evas_object_show
5536
 * @dontinclude slideshow_example.c
5537
 * @skip slideshow transition time has
5538
 * @until }
5539
 *
5540
 * Finally, we have two buttons which will, respectively, start and
5541
 * stop the slideshow on our widget. Here are their "clicked"
5542
 * callbacks:
5543
 * @dontinclude slideshow_example.c
5544
 * @skip start the show
5545
 * @until }
5546
 * @until }
5547
 *
5548
 * This is how the example program's window looks like:
5549
 * @image html screenshots/slideshow_example.png
5550
 * @image latex screenshots/slideshow_example.eps width=\textwidth
5551
 *
5552
 * See the full @ref slideshow_example_c "source code" for
5553
 * this example.
5554
 *
5555
 */
5556

5557
/**
5558
 * @page tutorial_photocam Photocam example
5559
 * @dontinclude photocam_example_01.c
5560
 *
5561
 * In this example we will have a photocam and a couple of buttons and slider to
5562
 * control the photocam. To avoid cluttering we'll only show the parts of the
5563
 * example that relate to the photocam, the full source code can be seen @ref
5564
 * photocam_example_01.c "here".
5565
 *
5566
 * Creating a photocam is as easy as creating any other widget:
5567
 * @skipline elm_photocam_add
5568
 *
5569
 * A photocam is only useful if we have a image on it, so lets set a file for it
5570
 * to work with:
5571
 * @until file_set
5572
 *
5573
 * We now set the photocam to not bounce horizontally:
5574
 * @until bounce_set
5575
 *
5576
 * And we want to know when the photocam has finished loading the image so:
5577
 * @until smart_callback
5578
 *
5579
 * The reason to know when the image is loaded is so that we can bring the
5580
 * center of the image into view:
5581
 * @skip static
5582
 * @until }
5583
 *
5584
 * As mentioned we have 2 buttons in this example, the "Fit" one will cause
5585
 * the photocam to go in to a zoom mode that makes the image fit inside the
5586
 * photocam. Tough this has no effect on the image we also print what region was
5587
 * being viewed before setting the zoom mode:
5588
 * @skip static
5589
 * @until }
5590
 * @note When in fit mode our slider(explained below) won't work.
5591
 *
5592
 * The second button("Unfit") will bring the photocam back into manual zoom
5593
 * mode:
5594
 * @skip static
5595
 * @until }
5596
 *
5597
 * Our slider controls the level of zoom of the photocam:
5598
 * @skip static
5599
 * @until }
5600
 * @note It is important to note that this only works when in manual zoom mode.
5601
 *
5602
 * Our example will initially look like this:
5603
 *
5604
 * @image html screenshots/photocam_example_01.png
5605
 * @image latex screenshots/photocam_example_01.eps width=\textwidth
5606
 *
5607
 * @example photocam_example_01.c
5608
 */
5609

5610
/**
5611
 * @page inwin_example_01 Inwin - General overview
5612
 *
5613
 * Inwin is a very simple widget to show, so this example will be a very simple
5614
 * one, just using all of the available API.
5615
 *
5616
 * The program is nothing but a window with a lonely button, as shown here.
5617
 *
5618
 * @image html screenshots/inwin_example.png
5619
 * @image latex screenshots/inwin_example.eps width=\textwidth
5620
 *
5621
 * And pressing the button makes an inwin appear.
5622
 *
5623
 * @image html screenshots/inwin_example_a.png
5624
 * @image latex screenshots/inwin_example_a.eps width=\textwidth
5625
 *
5626
 * And the code is just as simple. We being with some global variables to keep
5627
 * track of our Inwin.
5628
 * @dontinclude inwin_example.c
5629
 * @skip static
5630
 * @until current_style
5631
 *
5632
 * And two callbacks used by the buttons the above screenshot showed. In these,
5633
 * we check if @c inwin exists and execute the proper action on it. If it's not
5634
 * there anymore, then we were abandoned to our luck, so we disabled ourselves.
5635
 * @until _inwin_destroy
5636
 * @until }
5637
 * @until }
5638
 *
5639
 * The lonely button from the beginning, when clicked, will call the following
5640
 * function, which begins by checking if an inwin exists, and if it's there,
5641
 * we bring it back to the front and exit from our function without any further
5642
 * ado.
5643
 * @until }
5644
 *
5645
 * But if no inwin is there to show, we need to create one. First we need the
5646
 * top-most window for the program, as no inwin can be created using other
5647
 * objects as parents. Then we create our popup, set the next style in the list
5648
 * and show it.
5649
 * @until current_style =
5650
 *
5651
 * As for the content of our inwin, it's just a box with a label and some
5652
 * buttons inside.
5653
 * @until _inwin_destroy
5654
 * @until }
5655
 *
5656
 * Now, all the code above shows how every object must always be set as content
5657
 * for some other object, be it by setting the full content, packing it in a
5658
 * box or table or working as icon for some other widget. But we didn't do
5659
 * anything like that for the inwin, this one is just created and shown and
5660
 * everything works. Other widgets can be used this way, but they would need
5661
 * to be placed and resized manually or nothing would be shown correctly. The
5662
 * inwin, however, sets itself as a children of the top-level window and will
5663
 * be resized as the parent window changes too.
5664
 *
5665
 * Another characteristic of Inwin is that when it's shown above everyone else,
5666
 * it will work kind of like a modal window, blocking any other widget from
5667
 * receiving events until the window is manually dismissed by pressing some
5668
 * button to close it or having blocking task signalling its completion so
5669
 * normal operations can be resumed. This is unlike the @ref Elm_Hover widget,
5670
 * that would show its content on top of the designated target, but clicking
5671
 * anywhere else would dismiss it automatically.
5672
 *
5673
 * To illustrate that last point, when we close the main window and an inwin
5674
 * is still there, we'll take out the content from the inwin and place it in
5675
 * a hover.
5676
 * @until }
5677
 * @until }
5678
 *
5679
 * And the rest of the program doesn't have anything else related to inwin,
5680
 * so it won't be shown here, but you can find it in
5681
 * @ref inwin_example.c "inwin_example.c".
5682
 *
5683
 * @example inwin_example.c
5684
 */
5685

5686
/**
5687
 * @page tutorial_scroller Scroller example
5688
 * @dontinclude scroller_example_01.c
5689
 *
5690
 * This example is very short and will illustrate one way to use a scroller.
5691
 * We'll omit the declaration of the @p text variable because it's a very long
5692
 * @htmlonly<a href="http://lipsum.com/">@endhtmlonly ipsum lorem
5693
 * @htmlonly</a>@endhtmlonly. If you really want to see the full code, it's @ref
5694
 * scroller_example_01.c "scroller_example_01.c".
5695
 *
5696
 * We start our example by creating our window and background:
5697
 * @skip EAPI
5698
 * @until show(bg)
5699
 *
5700
 * Next we create a label and set it's text to @p text(very long ipsum lorem):
5701
 * @until show(label)
5702
 *
5703
 * We then create our scroller, ask that it have the same size as the window and
5704
 * set its content:
5705
 * @until content_set
5706
 *
5707
 * We are now going to set a number of properties in our scroller:
5708
 * @li We make it bounce horizontally but not vertically.
5709
 * @li We make both scrollbars always be visible.
5710
 * @li We have the events be propagated from the content to the scroller.
5711
 * @li We enforce a page policy vertically(having a page be the size of the
5712
 * viewport) and leave horizontal scrolling free.
5713
 * @li And finally we ask the scroller to show us a region starting at 50,50 and
5714
 * having a width and height of 200px.
5715
 * @until region_show
5716
 * @note Observant reader will note that the elm_scroller_region_show() didn't
5717
 * scroll the view vertically, this is because we told the scroller to only
5718
 * accept vertical scrolling in pages.
5719
 *
5720
 * And now we're done:
5721
 * @until ELM_MAIN
5722
 *
5723
 * Our example will look like this:
5724
 *
5725
 * @image html screenshots/scroller_example_01.png
5726
 * @image latex screenshots/scroller_example_01.eps width=\textwidth
5727
 *
5728
 * @example scroller_example_01.c
5729
 */
5730

5731
/**
5732
 * @page tutorial_table_01
5733
 *
5734
 * In this example we add four labels to a homogeneous table that has a padding
5735
 * of 5px between cells.
5736
 *
5737
 * The interesting bits from this example are:
5738
 * @li Where we set the table as homogeneous and the padding:
5739
 * @dontinclude table_example_01.c
5740
 * @skip padding_set
5741
 * @until homogeneous_set
5742
 * @li Where we add each label to the table:
5743
 * @skipline elm_table_pack
5744
 * @skipline elm_table_pack
5745
 * @skipline elm_table_pack
5746
 * @skipline elm_table_pack
5747
 *
5748
 * Here you can see the full source:
5749
 * @include table_example_01.c
5750
 *
5751
 * Our example will look like this:
5752
 *
5753
 * @image html screenshots/table_example_01.png
5754
 * @image latex screenshots/table_example_01.eps width=\textwidth
5755
 *
5756
 * @example table_example_01.c
5757
 */
5758

5759
/**
5760
 * @page tutorial_table_02
5761
 *
5762
 * For our second example we'll create a table with 4 rectangles in it. Since
5763
 * our rectangles are of different sizes our table won't be homogeneous.
5764
 *
5765
 * The interesting bits from this example are:
5766
 * @li Where we set the table as not homogeneous:
5767
 * @dontinclude table_example_02.c
5768
 * @skipline homogeneous_set
5769
 * @li Where we add each rectangle to the table:
5770
 * @skipline elm_table_pack
5771
 * @skipline elm_table_pack
5772
 * @skipline elm_table_pack
5773
 * @skipline elm_table_pack
5774
 *
5775
 * Here you can see the full source:
5776
 * @include table_example_02.c
5777
 *
5778
 * Our example will look like this:
5779
 *
5780
 * @image html screenshots/table_example_02.png
5781
 * @image latex screenshots/table_example_02.eps width=\textwidth
5782
 *
5783
 * @example table_example_02.c
5784
 */
5785

5786
/**
5787
 * @page tutorial_menu Menu Example
5788
 * @dontinclude menu_example_01.c
5789
 *
5790
 * This example shows how to create a menu with regular items, object items,
5791
 * submenus and how to delete items from a menu. The full source for this
5792
 * example is @ref menu_example_01.c "menu_example_01.c".
5793
 *
5794
 * We'll start looking at the menu creation and how to create a very simple
5795
 * item:
5796
 * @skip menu_add
5797
 * @until item_add
5798
 *
5799
 * For our next item we are going to add an icon:
5800
 * @until item_add
5801
 *
5802
 * Now we are going to add more items, but these icons are going to have a
5803
 * parent, which will put them in a sub-menu. First just another item with an
5804
 * icon:
5805
 * @until item_add
5806
 *
5807
 * Next we are going to add a button to our menu(any elm widget can be added to
5808
 * a menu):
5809
 * @until item_add
5810
 *
5811
 * We are also going to have the button delete the first item of our
5812
 * sub-menu when clicked:
5813
 * @until smart_callback
5814
 * @dontinclude menu_example_01.c
5815
 * @skip static
5816
 * @until }
5817
 *
5818
 * We now add a separator and three more regular items:
5819
 * @until item_add
5820
 * @until item_add
5821
 * @until item_add
5822
 *
5823
 * We now add another item, however this time it won't go the sub-menu and it'll
5824
 * be disabled:
5825
 * @until disabled_set
5826
 *
5827
 * To make sure that our menu is shown whenever the window is clicked(and where
5828
 * clicked) we use the following callback:
5829
 * @dontinclude menu_example_01.c
5830
 * @skip static
5831
 * @skipline static
5832
 * @until }
5833
 *
5834
 * Our example will look like this:
5835
 *
5836
 * @image html screenshots/menu_example_01.png
5837
 * @image latex screenshots/menu_example_01.eps width=\textwidth
5838
 *
5839
 * @example menu_example_01.c
5840
 */
5841

5842
/**
5843
 * @page win_example_01 Win - General API overview
5844
 *
5845
 * For most users of the Elementary API, the @ref Elm_Win widget has a lot more
5846
 * functions than what they need.
5847
 *
5848
 * In general, a developer will create a window, set some content on it and
5849
 * forget about it for the rest of its program's life, letting whatever
5850
 * Window Manager is there to handle the window. Here, however, we are going
5851
 * to show how to generally manage a window.
5852
 *
5853
 * We'll have a bit more than the usual includes here, since part of the
5854
 * example requires some low level fiddling.
5855
 * @dontinclude win_example.c
5856
 * @skip ifdef
5857
 * @until Elementary.h
5858
 *
5859
 * The program then, consists of one window with two lists of buttons, each
5860
 * of which operates on another two windows. One of them is a normal window,
5861
 * the other has the @c override flag set so the Window Manager ignores it.
5862
 *
5863
 * Pressing each button will call the corresponding function to act on the
5864
 * corresponding window. These are pretty self explanatory, so we'll show
5865
 * them in one batch.
5866
 * @skip static void
5867
 * @until elm_win_sticky_set
5868
 * @until }
5869
 *
5870
 * Next, we handle the main window closing. We have a @c "delete,request"
5871
 * callback set to ask if really want to quit. If so, we end the main loop,
5872
 * otherwise just delete the popup message and continue running normally.
5873
 * @until _no_quit_cb
5874
 * @until _no_quit_cb
5875
 * @until }
5876
 *
5877
 * The non-managed window, being completely ignored by the Window Manager,
5878
 * is likely to never receive keyboard focus, even if we click on its entry
5879
 * to write something. So we have a button on it that will forcefully focus
5880
 * it by using some lower level functions to act directly on the X window.
5881
 * Then, each time one of the window is focused, we print some message on a
5882
 * console to show this more clearly.
5883
 * @until _win_focused_cb
5884
 * @until }
5885
 *
5886
 * And to finalize, the main function creates a window to hold all the action
5887
 * buttons and another two to show how (and what) works on each of them.
5888
 *
5889
 * First, the main window will be a normal window, we'll enable the focus
5890
 * highlight regardless of how it is configured so it's easier to navigate
5891
 * the window with the keyboard. Then we hook our focus and delete callbacks
5892
 * and set up the rest of the window's content.
5893
 * @until evas_object_show(box)
5894
 *
5895
 * The first of our sub-windows is the managed one. We'll create it as a
5896
 * dialog, which should make the Window Manager treat it as a non-resizable
5897
 * window. We are also setting the window to be auto-deleted when the close
5898
 * button in the titlebar is pressed.
5899
 * @until evas_object_show(o)
5900
 *
5901
 * Now, we added an icon to the window as a resize object. We also set this
5902
 * icon to not scale, and no weight size hints have been set for it. This way,
5903
 * even if we hadn't created the window as a dialog, it would still not be
5904
 * resizable. The window size is defined by its content, so it would never be
5905
 * smaller than the smallest of its resize objects, and for it to be resizable,
5906
 * all of those objects have to allow it.
5907
 *
5908
 * Next, we add the buttons with the actions to perform on this window. Using
5909
 * a macro saves us typing and makes the world a happier place.
5910
 * @until WIN_ACTION(sticky)
5911
 *
5912
 * The maximize one is likely to not work, because the Window Manager will
5913
 * probably not enforce it upon a window that states its maximum size, much
5914
 * less a dialog. But that can be changed by editting the example to use
5915
 * #ELM_WIN_BASIC when creating the window and adding the following line to
5916
 * the icon set as content
5917
 * @code
5918
 * evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
5919
 * @endcode
5920
 *
5921
 * Lastly, the second sub-window will have it's override flag set. In it we
5922
 * have a label with some text, and entry and a button. The entry can be
5923
 * clicked normally to set focus on it, but whether it actually gets keyboard
5924
 * input will also depend on the window getting focus, and since the window
5925
 * is an override one, it will probably not gain it by normal means. The
5926
 * button is there to force the focus at the X level to go to our window.
5927
 * And to finish, another list of buttons with actions to perform on this
5928
 * last window. Remember that most of them are requests or hints for the
5929
 * Window Manager, so they are likely to do nothing on this window.
5930
 * Similarly, there won't be any way to move it or resize it, because we
5931
 * haven't implemented that kind of control on this example and that's
5932
 * something controlled by Window Managers on windows they are tracking, which
5933
 * is not the case with this one.
5934
 * @until ELM_MAIN
5935
 *
5936
 * The full code listing of this example can be found at
5937
 * @ref win_example.c "win_example.c".
5938
 *
5939
 * @example win_example.c
5940
 */
5941

5942
/**
5943
 * @page web_example_02 Web - Simple example
5944
 *
5945
 * WebKit-EFL is independent of any particular toolkit, such as Elementary,
5946
 * so using it on applications requires that the programmer writes a lot of
5947
 * boiler plate code to manage to manage the web object.
5948
 *
5949
 * For a full featured browser this may make sense, as the programmer will
5950
 * want to have full control of every aspect of the web object, since it's the
5951
 * main component of the application. But other programs with simpler
5952
 * requirements, having to write so much code is undesired.
5953
 *
5954
 * This is where elm_web comes in. Its purpose is to provide a simple way
5955
 * for developers to embed a simple web object in their programs, simplifying
5956
 * the common use cases.
5957
 *
5958
 * This is not to say that a browser can't be made out of it, as this example
5959
 * shows.
5960
 *
5961
 * We'll be making a simple browser, consisting of one window with an URL bar,
5962
 * a toolbar to be used for the tabs and a pager to show one page at a time.
5963
 *
5964
 * When all tabs are closed, we'll be showing a default view with some custom
5965
 * content, for which we need to get the internal @c ewk_view object and use
5966
 * some WebKit functions on it, thus we need to include the necessary headers
5967
 * first.
5968
 *
5969
 * @dontinclude web_example_02.c
5970
 * @skip include
5971
 * @until EWebKit
5972
 *
5973
 * A struct to keep track of the different widgets in use and the currently
5974
 * shown tab. There's also an @c exiting flag, used to work around the overly
5975
 * simplistic way in which this example is written, just to avoid some
5976
 * warnings when closing the program.
5977
 *
5978
 * @skip typedef
5979
 * @skip typedef
5980
 * @until App_Data
5981
 *
5982
 * Each tab has its own struct too, but there's not much to it.
5983
 * @until };
5984
 *
5985
 * Whenever the currently selected tab changes, we need to update some state
5986
 * on the application. The back and forward buttons need to be disabled
5987
 * accordingly and the URL bar needs to show the right address.
5988
 *
5989
 * @skip static void
5990
 * @until naviframe_item_simple_promote
5991
 * @until }
5992
 *
5993
 * Other updates happen based on events from the web object, like title change
5994
 * to update the name shown in the tab, and URL change which will update the
5995
 * URL bar if the event came from the currently selected tab.
5996
 *
5997
 * @skip tab_current_set
5998
 * @skip static void
5999
 * @until }
6000
 * @until }
6001
 *
6002
 * Adding a new tab is just a matter of creating a new web widget, its data
6003
 * and pushing it into the pager. A lot of the things that we should handle
6004
 * here, such as how to react to popups and JavaScript dialogs, are done
6005
 * already in the @c elm_web widget, so we can rely on their default
6006
 * implementations. For the JavaScript dialogs we are going to avoid having
6007
 * them open in a new window by setting the @c Inwin mode.
6008
 *
6009
 * There is no default implementation, however, for the requests to create a
6010
 * new window, so we have to handle them by setting a callback function that
6011
 * will ultimately call this very same function to add a new tab.
6012
 *
6013
 * @skip td->tab = NULL
6014
 * @skip Tab_Data
6015
 * @until }
6016
 *
6017
 * Entering an address in the URL bar will check if a tab exists, and if not,
6018
 * create one and set the URL for it. The address needs to conform to the URI
6019
 * format, so we check that it does and add the protocol if it's missing.
6020
 *
6021
 * @skip static char
6022
 * @until eina_stringshare_del
6023
 * @until }
6024
 *
6025
 * The navigation buttons are simple enough. As for the refresh, it normally
6026
 * reloads the page using anything that may exist in the caches if applicable,
6027
 * but we can press it while holding the @c Shift key to avoid the cache.
6028
 *
6029
 * @skip static void
6030
 * @until web_forward
6031
 * @until }
6032
 *
6033
 * The callback set for the new window request creates a new tab and returns
6034
 * the web widget associated with it. This is important, this function must
6035
 * return a valid web widget returned by elm_web_add().
6036
 *
6037
 * @skip static Evas_Object
6038
 * @until }
6039
 *
6040
 * Pressing @c Ctrl-F will bring up the search box. Nothing about the box
6041
 * itself is worth mentioning here, but it works as you would expect from any
6042
 * other browser. While typing on it, it will highlight all occurrences of the
6043
 * searched word. Pressing @c Enter will go to the next instance and the two
6044
 * buttons next to the entry will move forward and backwards through the found
6045
 * keywords.
6046
 *
6047
 * @skip win_del_request
6048
 * @skip static void
6049
 * @until win_search_trigger
6050
 * @until }
6051
 *
6052
 * Last, create the main window and put all of the things used above in it. It
6053
 * contains a default web widget that will be shown when no tabs exist. This
6054
 * web object is not browsable per se, so history is disabled in it, and we
6055
 * set the same callback to create new windows, on top of setting some custom
6056
 * content of our own on it, with some links that will open new tabs to start
6057
 * browsing quickly.
6058
 *
6059
 * @skip static void
6060
 * @until ELM_MAIN
6061
 *
6062
 * Some parts of the code were left out, as they are not relevant to the
6063
 * example, but the full listing can be found at @ref web_example_02.c
6064
 * "web_example_02.c".
6065
 *
6066
 * @example web_example_02.c
6067
 */
6068

6069
/**
6070
 * @page efl_thread_1 EFL Threading example 1
6071
 *
6072
 * You can use threads with Elementary (and EFL) but you need to be careful
6073
 * to only use eina or eet calls inside a thread. Other libraries are not
6074
 * totally threadsafe except for some specific ecore calls designed for
6075
 * working from threads like the ecore_pipe_write() and ecore_thread calls.
6076
 *
6077
 * Below is an example of how to use EFL calls from a native thread you have
6078
 * already created. You have to put the EFL calls inside the critical block
6079
 * between ecore_thread_main_loop_begin() and ecore_thread_main_loop_end()
6080
 * which ensure you gain a lock on the mainloop. Beware that this requires
6081
 * that the thread WAIT to synchronize with the mainloop at the beginning of
6082
 * the critical section. It is highly suggested you use as few of these
6083
 * in your thread as possible and probably put just a single
6084
 * ecore_thread_main_loop_begin() / ecore_thread_main_loop_end() section
6085
 * at the end of the threads calculation or work when it is done and
6086
 * would otherwise exit to sit idle.
6087
 *
6088
 * For a progression of examples that become more complex and show other
6089
 * ways to use threading with EFL, please see:
6090
 *
6091
 * @ref efl_thread_2
6092
 *
6093
 * @ref efl_thread_3
6094
 *
6095
 * @ref efl_thread_4
6096
 *
6097
 * @ref efl_thread_5
6098
 *
6099
 * @ref efl_thread_6
6100
 *
6101
 * @include efl_thread_1.c
6102
 */
6103

6104
/**
6105
 * @page efl_thread_2 EFL Threading example 2
6106
 *
6107
 * You can also use ecore_main_loop_thread_safe_call_sync() to call a
6108
 * specific function that needs to do EFL main loop operations. This call
6109
 * will block and wait to synchronise to the mainloop just like
6110
 * ecore_thread_main_loop_begin() / ecore_thread_main_loop_end() will,
6111
 * but instead you simply provide it the function callback to call instead
6112
 * of inlining your code.
6113
 *
6114
 * @ref efl_thread_3
6115
 *
6116
 * @ref efl_thread_4
6117
 *
6118
 * @ref efl_thread_5
6119
 *
6120
 * @ref efl_thread_6
6121
 *
6122
 * @include efl_thread_2.c
6123
 */
6124

6125
/**
6126
 * @page efl_thread_3 EFL Threading example 3
6127
 *
6128
 * Like with ecore_main_loop_thread_safe_call_sync() you can provide a
6129
 * callback to call inline in the mainloop, but this time with
6130
 * ecore_main_loop_thread_safe_call_async() the callback is queued and
6131
 * called asynchronously, without the thread blocking. The mainloop will
6132
 * call this function when it comes around to its synchronisation point. This
6133
 * acts as a "fire and forget" way of having the mainloop do some work
6134
 * for a thread that has finished processing some data and is read to hand it
6135
 * off to the mainloop and the thread wants to march on and do some more work
6136
 * while the main loop deals with "displaying" the results of the previous
6137
 * calculation.
6138
 *
6139
 * @ref efl_thread_4
6140
 *
6141
 * @ref efl_thread_5
6142
 *
6143
 * @ref efl_thread_6
6144
 *
6145
 * @include efl_thread_3.c
6146
 */
6147

6148
/**
6149
 * @page efl_thread_4 EFL Threading example 4
6150
 *
6151
 * Now when you want to have a thread do some work, send back results to
6152
 * the mainloop and continue running but the mainloop controls when the
6153
 * thread should stop working, you need some extra flags. This is an example
6154
 * of how you might use ecore_main_loop_thread_safe_call_async() and pthreads
6155
 * to do this.
6156
 *
6157
 * @ref efl_thread_5
6158
 *
6159
 * @ref efl_thread_6
6160
 *
6161
 * @include efl_thread_4.c
6162
 */
6163

6164
/**
6165
 * @page efl_thread_5 EFL Threading example 5
6166
 *
6167
 * This is the same as @ref efl_thread_4 but now uses the ecore_thread
6168
 * infrastructure to have a running worker thread that feeds results back
6169
 * to the mainloop and can easily be cancelled. This saves some code in the
6170
 * application and makes for fewer problem spots if you forget a mutex.
6171
 *
6172
 * @ref efl_thread_6
6173
 *
6174
 * @include efl_thread_5.c
6175
 */
6176

6177
/**
6178
 * @page efl_thread_6 EFL Threading example 6
6179
 *
6180
 * You can also use the ecore_thread infrastructure for compute tasks that
6181
 * don't send feedback as they go - they are one-shot compute jobs and when
6182
 * done they will trigger the end callback in the mainloop which is intended
6183
 * to pick up the results and "display them".
6184
 *
6185
 * @include efl_thread_6.c
6186
 */
6187

6188
/**
6189
 * @page prefs_example_01 Prefs Example 01
6190
 *
6191
 * This example shows how to create a simple prefs widget with Elementary,
6192
 * where the items values are "reset" on each timer tick. We do that
6193
 * <b>programmatically</b>, to demonstrate that by touching a given prefs
6194
 * widgets prefs data values, the changes reflect instantly on the UI.
6195
 *
6196
 * We'll create items on the .EPC file and after handle it on the .C file.
6197
 *
6198
 * @section prefs-epc-01 Creating items on EPC file
6199
 * @dontinclude prefs_example_01.epc
6200
 *
6201
 * First we'll create prefs items on .EPC file that we'll use later on
6202
 * the .C file. Note that the code is similar to .EDC (edje) files.
6203
 *
6204
 * @skip collection
6205
 * @until subtitle: "Example 01";
6206
 *
6207
 * Here we define a page item. Pages are group of items grouped together,
6208
 * on a given prefs widget.
6209
 *
6210
 * @skipline widget: "elm/vertical_box";
6211
 *
6212
 * In this part, we create a @c INT type item, that by default will
6213
 * become a spinner widget in the UI, and default, min and max
6214
 * parameters are optional as well as in @c FLOAT type.
6215
 *
6216
 * @skip items {
6217
 * @until max: 150;
6218
 * @skipline }
6219
 * @skipline }
6220
 *
6221
 * Other @c INT type widget implementations may exist, as is exemplified
6222
 * on the item that follows.
6223
 *
6224
 * @skip item {
6225
 * @until min: 0;
6226
 * @skipline }
6227
 * @skipline }
6228
 *
6229
 * Now we create a LABEL type item and by default will become a read-only
6230
 * label in UI.
6231
 *
6232
 * @skip item {
6233
 * @until }
6234
 *
6235
 * Now we create a TEXT type item and by default will become a single-line
6236
 * text entry in UI. Note that we use a Regular Expression to deny only
6237
 * entries with numbers.
6238
 *
6239
 * @skip item {
6240
 * @until }
6241
 * @skipline }
6242
 *
6243
 * In this part we create a DATE type item, by default will become a datetime
6244
 * in UI, and default, min and max parameters are optional.
6245
 *
6246
 * @skip item {
6247
 * @until }
6248
 *
6249
 * Here we create a SEPARATOR type item, it has no value bound,
6250
 * serves only to divide and organize prefs items.
6251
 *
6252
 * @skip item {
6253
 * @until }
6254
 *
6255
 * In this part, we create a SAVE type item that will get all the values
6256
 * bounded to items and save it on CFG file. Next time you execute the
6257
 * application, all the values that you saved before will be loaded.
6258
 *
6259
 * @skip item {
6260
 * @until }
6261
 *
6262
 * Here we create a RESET type item that will return all the values bounded
6263
 * to items as default declared on .EPC file.
6264
 *
6265
 * @skip item {
6266
 * @until }
6267
 *
6268
 * Pages and items have default implementation widgets, but, with the tag
6269
 * 'widget', you can use different widgets for prefs items. To a list of
6270
 * default widgets supported by each type, by default, refer to the Elementary
6271
 * Prefs Collection reference sheet. One can also register, at run time,
6272
 * custom item widget handlers too.
6273
 *
6274
 * @section prefs-c-01 Handling items on C File
6275
 * @dontinclude prefs_example_01.c
6276
 *
6277
 * Now we're handling the .C file and first we'll create a prefs widget.
6278
 *
6279
 * @skip prefs = elm_prefs_add(win);
6280
 * @until evas_object_show(prefs);
6281
 *
6282
 * Here we add some specific callbacks, for example "item,changed" that will
6283
 * be called when any item that we created on EPC file changes.
6284
 *
6285
 * @skip evas_object_smart_callback_add
6286
 * @until _item_changed_cb, win);
6287
 *
6288
 * Here we set the prefs to save its values back (on the user data file)
6289
 * automatically on every UI element changes.
6290
 *
6291
 * @skipline elm_prefs_autosave_set(prefs, EINA_TRUE);
6292
 *
6293
 * In this part we create the prefs data handle and set the .EPB file
6294
 * (.EPC compiled). This .EPB file contains all the default values from the
6295
 * items that we created, this file will be loaded when the program starts or
6296
 * when clicked on a RESET type item. There is another file created when
6297
 * the values from prefs items are saved, the .CFG file, that contains all the
6298
 * non-standard saved values from the prefs items, this file will be loaded
6299
 * when program starts as well.
6300
 *
6301
 * @dontinclude prefs_example_01.c
6302
 * @skipline Elm_Prefs_Data *prefs_data;
6303
 *
6304
 * @skip prefs_data = elm_prefs_data_new
6305
 * @until elm_prefs_data_set(prefs, prefs_data);
6306
 *
6307
 * Here we just create a notify widget to appear when the values are reset.
6308
 *
6309
 * @skip label = elm_label_add(win);
6310
 * @until evas_object_show(notify);
6311
 *
6312
 * Now we add a timer to reset the items values on each 5.0 seconds and
6313
 * show the notify.
6314
 *
6315
 * @skipline evas_object_data_set(notify
6316
 * @skipline timer = ecore_timer_add(5.0,
6317
 *
6318
 * @dontinclude prefs_example_01.c
6319
 * @skip _elm_prefs_data_change(void *data)
6320
 * @until return ECORE_CALLBACK_RENEW;
6321
 * @skipline }
6322
 *
6323
 * Here we finish the example. The full source code can be found on
6324
 * @ref prefs_example_01_c and
6325
 * @ref prefs_example_01_epc
6326
 *
6327
 */
6328

6329
/**
6330
 * @page prefs_example_02 Prefs Example 02
6331
 *
6332
 * This example shows how to create a simple prefs widget with Elementary,
6333
 * where some items properties are changed on each timer tick.
6334
 *
6335
 * We'll create items on the .EPC file and after handle it on the .C file.
6336
 *
6337
 * @section prefs-epc-02 Creating items on EPC file
6338
 * @dontinclude prefs_example_02.epc
6339
 *
6340
 * First we'll create prefs items on .EPC file that we'll use later on
6341
 * the .C file. Note that the code is similar to .EDC (edje) files.
6342
 *
6343
 * @skip collection
6344
 * @until widget: "elm/vertical_frame";
6345
 *
6346
 * In this part, we create a @c TEXTAREA item and, by default, it will
6347
 * become a multi-line text entry in the UI. Note that we use a
6348
 * regular expression to accept only characters and whitespaces in it.
6349
 *
6350
 * @skip items {
6351
 * @until }
6352
 * @skipline }
6353
 *
6354
 * Now we create a FLOAT type item, by default will become a spinner in UI,
6355
 * and default, min and max parameters are optional as well as in INT type.
6356
 *
6357
 * @skip item {
6358
 * @until }
6359
 * @skipline }
6360
 *
6361
 * Here we create a BOOL type item, by default will become a checkbox in UI.
6362
 *
6363
 * @skip item {
6364
 * @until }
6365
 * @skipline }
6366
 *
6367
 * Here we create two items, separator and save types, that we've already
6368
 * covered in
6369
 * @ref prefs_example_01
6370
 *
6371
 * @skip item {
6372
 * @until label: "Save";
6373
 * @skipline }
6374
 *
6375
 * In this part, we create a ACTION type item. when clicked, the
6376
 * action item will emit a signal to .C file and call a smart callback.
6377
 *
6378
 * @skip item {
6379
 * @until }
6380
 * @skipline }
6381
 * @skipline }
6382
 * @skipline }
6383
 *
6384
 * @section prefs-c-02 Handling items on C File
6385
 * @dontinclude prefs_example_02.c
6386
 *
6387
 * Now we're handling the .C file and first we'll create a prefs widget.
6388
 *
6389
 * @skip prefs = elm_prefs_add(win);
6390
 * @until evas_object_show(prefs);
6391
 *
6392
 * In this part we add the action smart callback, that will be called when
6393
 * the action item be clicked.
6394
 *
6395
 * @skipline evas_object_smart_callback_add
6396
 *
6397
 * Here we add a simple action item callback that sets a text to another item.
6398
 *
6399
 * @dontinclude prefs_example_02.c
6400
 * @skip _action_cb(void *data
6401
 * @until }
6402
 *
6403
 * Now we set the prefs to save its values back (on the user data file)
6404
 * automatically on every UI element changes.
6405
 *
6406
 * @skipline elm_prefs_autosave_set(prefs, EINA_TRUE);
6407
 *
6408
 * In this part we create the prefs data handle and set the .EPB file
6409
 * (.EPC compiled).
6410
 *
6411
 * @dontinclude prefs_example_02.c
6412
 * @skipline Elm_Prefs_Data *prefs_data;
6413
 *
6414
 * @skip prefs_data = elm_prefs_data_new
6415
 * @until elm_prefs_data_set(prefs, prefs_data);
6416
 *
6417
 * Here we just create a notify widget to appear when the items properties
6418
 * are changed.
6419
 *
6420
 * @skip label = elm_label_add(win);
6421
 * @until evas_object_show(notify);
6422
 *
6423
 * Now we add a timer to change text editable, spinners visibility and checkbox
6424
 * enable/disable properties on each 5.0 seconds and show the notify.
6425
 *
6426
 * @skip evas_object_data_set(notify
6427
 * @until _elm_prefs_items_change, notify);
6428
 *
6429
 * @dontinclude prefs_example_02.c
6430
 * @skip _elm_prefs_items_change(void *data)
6431
 * @until return ECORE_CALLBACK_RENEW;
6432
 * @skipline }
6433
 *
6434
 * Here we finish the example. The full source code can be found on
6435
 * @ref prefs_example_02_c and
6436
 * @ref prefs_example_02_epc
6437
 *
6438
 */
6439

6440
/**
6441
 * @page prefs_example_03 Prefs Example 03
6442
 *
6443
 * This example shows how to create a prefs widget with Elementary, where some
6444
 * prefs item values are changed, some actions take place on an object
6445
 * different than the prefs widget (an Edge object). With this new object,
6446
 * we're also exemplifying the prefs SWALLOW item type, as the Edje object is
6447
 * put inside the prefs widget's viewport.
6448
 *
6449
 * It also shows how subpages can be created using the prefs PAGE item type.
6450
 *
6451
 * Explain step by step the .EDC file is out of scope, the source code
6452
 * can be found at
6453
 * @ref prefs_example_03_edc
6454
 *
6455
 * @section prefs-epc-03 Creating items on EPC file
6456
 * @dontinclude prefs_example_03.epc
6457
 *
6458
 * First we'll create prefs items on .EPC file that we'll use later on
6459
 * the .C file.
6460
 *
6461
 * @skip collection
6462
 * @until widget: "elm/vertical_frame";
6463
 *
6464
 * In the following part, we create an item of the PAGE type, that will create a
6465
 * subpage inside the main page. The source parameter is used to set which page
6466
 * will be used to fill the subpage, in this example, the page named
6467
 * "configpage" will be used.
6468
 *
6469
 * @skip items {
6470
 * @until type: SEPARATOR;
6471
 * @skipline }
6472
 *
6473
 * Now we create a SWALLOW type item, that, as the name suggests, will
6474
 * swallow an Evas_Object.
6475
 *
6476
 * @skip item {
6477
 * @until }
6478
 *
6479
 * Now we create the page that will be used to fill the item "config" of the
6480
 * main page. It has another two subpages and a SEPARATOR item arranged
6481
 * horizontally so we could achieve the desired layout.
6482
 *
6483
 * @skip page
6484
 * @until source: "buttonspage";
6485
 * @skipline }
6486
 * @skipline }
6487
 * @skipline }
6488
 *
6489
 * Then we create the pages used by the "configpage" page, whose items
6490
 * were covered in @ref prefs_example_01 and @ref prefs_example_02.
6491
 *
6492
 * @skip page
6493
 * @until label: "Reset";
6494
 * @skipline }
6495
 * @skipline }
6496
 * @skipline }
6497
 *
6498
 * @section prefs-c-03 Handling items on C File
6499
 * @dontinclude prefs_example_03.c
6500
 *
6501
 * Now we're handling the .C file and first we'll create a layout setting the
6502
 * edje file to after a prefs item swallows it.
6503
 *
6504
 * @skip layout = elm_layout_add(win);
6505
 * @until "prefs_edje");
6506
 *
6507
 * Here we create the prefs widget, add smart callbacks and create the prefs
6508
 * data handle.
6509
 *
6510
 * @skip prefs = elm_prefs_add(win);
6511
 * @until elm_prefs_data_set(prefs, prefs_data);
6512
 *
6513
 * Now we "swallow" the layout into the SWALLOW item of the prefs widget.
6514
 *
6515
 * @skipline elm_prefs_item_swallow(prefs,
6516
 *
6517
 * Page loaded and item changed callbacks will call update functions.
6518
 *
6519
 * @dontinclude prefs_example_03.c
6520
 * @skip _page_loaded_cb(void *data,
6521
 * @until _update_animation(obj, layout);
6522
 * @skipline }
6523
 *
6524
 * These update functions will be called in order to get the new value from
6525
 * the items and pass it as signal to edje handle it and affects on animation.
6526
 *
6527
 * @dontinclude prefs_example_03.c
6528
 * @skip _update(Evas_Object *prefs,
6529
 * @until }
6530
 *
6531
 * In this function we'll get the checkbox (bool) value and start or stop
6532
 * the animation on edje.
6533
 *
6534
 * @dontinclude prefs_example_03.c
6535
 * @skip _update_animation(Evas_Object *prefs,
6536
 * @until }
6537
 *
6538
 * In this function we'll get the slider (float item) value and send it as
6539
 * animation time to edje.
6540
 *
6541
 * @skip _update_animation_time(Evas_Object *prefs,
6542
 * @until }
6543
 *
6544
 * Here we finish the example. The full source code can be found on
6545
 * @ref prefs_example_03_c,
6546
 * @ref prefs_example_03_epc and
6547
 * @ref prefs_example_03_edc
6548
 *
6549
 */
6550

6551
/**
6552
 * @page bg_example_01_c bg_example_01.c
6553
 * @include bg_example_01.c
6554
 * @example bg_example_01.c
6555
 */
6556

6557

6558
/**
6559
 * @page bg_example_02_c bg_example_02.c
6560
 * @include bg_example_02.c
6561
 * @example bg_example_02.c
6562
 */
6563

6564
/**
6565
 * @page bg_example_03_c bg_example_03.c
6566
 * @include bg_example_03.c
6567
 * @example bg_example_03.c
6568
 */
6569

6570
/**
6571
 * @page actionslider_example_01 Actionslider example
6572
 * @include actionslider_example_01.c
6573
 * @example actionslider_example_01.c
6574
 */
6575

6576
/**
6577
 * @page transit_example_01_c Transit example 1
6578
 * @include transit_example_01.c
6579
 * @example transit_example_01.c
6580
 */
6581

6582
/**
6583
 * @page transit_example_02_c Transit example 2
6584
 * @include transit_example_02.c
6585
 * @example transit_example_02.c
6586
 */
6587

6588
/**
6589
 * @page general_functions_example_c General (top-level) functions example
6590
 * @include general_funcs_example.c
6591
 * @example general_funcs_example.c
6592
 */
6593

6594
/**
6595
 * @page clock_example_c Clock example
6596
 * @include clock_example.c
6597
 * @example clock_example.c
6598
 */
6599

6600
 /**
6601
 * @page datetime_example_c Datetime example
6602
 * @include datetime_example.c
6603
 * @example datetime_example.c
6604
 */
6605

6606
/**
6607
 * @page dayselector_example_c Dayselector example
6608
 * @include dayselector_example.c
6609
 * @example dayselector_example.c
6610
 */
6611

6612
/**
6613
 * @page flipselector_example_c Flipselector example
6614
 * @include flipselector_example.c
6615
 * @example flipselector_example.c
6616
 */
6617

6618
/**
6619
 * @page fileselector_example_c Fileselector example
6620
 * @include fileselector_example.c
6621
 * @example fileselector_example.c
6622
 */
6623

6624
/**
6625
 * @page fileselector_button_example_c Fileselector button example
6626
 * @include fileselector_button_example.c
6627
 * @example fileselector_button_example.c
6628
 */
6629

6630
/**
6631
 * @page fileselector_entry_example_c Fileselector entry example
6632
 * @include fileselector_entry_example.c
6633
 * @example fileselector_entry_example.c
6634
 */
6635

6636
/**
6637
 * @page index_example_01_c Index example
6638
 * @include index_example_01.c
6639
 * @example index_example_01.c
6640
 */
6641

6642
/**
6643
 * @page index_example_02_c Index example
6644
 * @include index_example_02.c
6645
 * @example index_example_02.c
6646
 */
6647

6648
/**
6649
 * @page layout_example_01_c layout_example_01.c
6650
 * @include layout_example_01.c
6651
 * @example layout_example_01.c
6652
 */
6653

6654
/**
6655
 * @page layout_example_02_c layout_example_02.c
6656
 * @include layout_example_02.c
6657
 * @example layout_example_02.c
6658
 */
6659

6660
/**
6661
 * @page layout_example_03_c layout_example_03.c
6662
 * @include layout_example_03.c
6663
 * @example layout_example_03.c
6664
 */
6665

6666
/**
6667
 * @page layout_example_edc An example of layout theme file
6668
 *
6669
 * This theme file contains two groups. Each of them is a different theme, and
6670
 * can be used by an Elementary Layout widget. A theme can be used more than
6671
 * once by many different Elementary Layout widgets too.
6672
 *
6673
 * @include layout_example.edc
6674
 * @example layout_example.edc
6675
 */
6676

6677
/**
6678
 * @page gengrid_example_c Gengrid example
6679
 * @include gengrid_example.c
6680
 * @example gengrid_example.c
6681
 */
6682

6683
/**
6684
 * @page genlist_example_01_c genlist_example_01.c
6685
 * @include genlist_example_01.c
6686
 * @example genlist_example_01.c
6687
 */
6688

6689
/**
6690
 * @page genlist_example_02_c genlist_example_02.c
6691
 * @include genlist_example_02.c
6692
 * @example genlist_example_02.c
6693
 */
6694

6695
/**
6696
 * @page genlist_example_04_c genlist_example_04.c
6697
 * @include genlist_example_04.c
6698
 * @example genlist_example_04.c
6699
 */
6700

6701
/**
6702
 * @page genlist_example_05_c genlist_example_05.c
6703
 * @include genlist_example_05.c
6704
 * @example genlist_example_05.c
6705
 */
6706

6707
/**
6708
 * @page thumb_example_01_c thumb_example_01.c
6709
 * @include thumb_example_01.c
6710
 * @example thumb_example_01.c
6711
 */
6712

6713
/**
6714
 * @page progressbar_example_c Progress bar example
6715
 * @include progressbar_example.c
6716
 * @example progressbar_example.c
6717
 */
6718

6719
/**
6720
 * @page slideshow_example_c Slideshow example
6721
 * @include slideshow_example.c
6722
 * @example slideshow_example.c
6723
 */
6724

6725
/**
6726
 * @page efl_thread_1_c EFL Threading example 1
6727
 * @include efl_thread_1.c
6728
 * @example efl_thread_1.c
6729
 */
6730

6731
/**
6732
 * @page efl_thread_2_c EFL Threading example 2
6733
 * @include efl_thread_2.c
6734
 * @example efl_thread_2.c
6735
 */
6736

6737
/**
6738
 * @page efl_thread_3_c EFL Threading example 3
6739
 * @include efl_thread_3.c
6740
 * @example efl_thread_3.c
6741
 */
6742

6743
/**
6744
 * @page efl_thread_4_c EFL Threading example 4
6745
 * @include efl_thread_4.c
6746
 * @example efl_thread_4.c
6747
 */
6748

6749
/**
6750
 * @page efl_thread_5_c EFL Threading example 5
6751
 * @include efl_thread_5.c
6752
 * @example efl_thread_5.c
6753
 */
6754

6755
/**
6756
 * @page efl_thread_6_c EFL Threading example 6
6757
 * @include efl_thread_6.c
6758
 * @example efl_thread_6.c
6759
 */
6760

6761
/**
6762
 * @page prefs_example_01_c prefs_example_01.c
6763
 * @include prefs_example_01.c
6764
 * @example prefs_example_01.c
6765
 */
6766

6767
/**
6768
 * @page prefs_example_01_epc prefs_example_01.epc
6769
 * @include prefs_example_01.epc
6770
 * @example prefs_example_01.epc
6771
 */
6772

6773
/**
6774
 * @page prefs_example_02_c prefs_example_02.c
6775
 * @include prefs_example_02.c
6776
 * @example prefs_example_02.c
6777
 */
6778

6779
/**
6780
 * @page prefs_example_02_epc prefs_example_02.epc
6781
 * @include prefs_example_02.epc
6782
 * @example prefs_example_02.epc
6783
 */
6784

6785
/**
6786
 * @page prefs_example_03_c prefs_example_03.c
6787
 * @include prefs_example_03.c
6788
 * @example prefs_example_03.c
6789
 */
6790

6791
/**
6792
 * @page prefs_example_03_epc prefs_example_03.epc
6793
 * @include prefs_example_03.epc
6794
 * @example prefs_example_03.epc
6795
 */
6796

6797
/**
6798
 * @page prefs_example_03_edc prefs_example_03.edc
6799
 * @include prefs_example_03.edc
6800
 * @example prefs_example_03.edc
6801
 */
6802

6803
/**
6804
 * @example prefs_data_example.c
6805
 * @example glview_example_01.c
6806
 * @example track_example_01.c
6807
 * @example codegen_example.c
6808
 * @example efl_thread_win32_1.c
6809
 * @example efl_thread_win32_2.c
6810
 * @example efl_thread_win32_3.c
6811
 * @example efl_thread_win32_4.c
6812
 * @example naviframe_example.c
6813
 */
6814

6815
/**
6816
 * @page tutorial_combobox Combobox example
6817
 * @dontinclude combobox_example_01.c
6818
 *
6819
 * In this example we will create a combobox with 1000 items.
6820
 *
6821
 * We will start with the normal creation of window stuff:
6822
 * @until show(bg)
6823
 *
6824
 * Next we will create a box.
6825
 * @until show(bx)
6826
 *
6827
 * And now we create our combobox and set some of it's properties. We set @p win
6828
 * as its parent, set a text "A Simple List" (which acts as a placeholder).
6829
 * We pack the combobox in box.
6830
 * @until show(combobox)
6831
 *
6832
 * Next we create a new genlist item class and sets its properties:
6833
 * item_style as deafult , callback for text_get and set others as NULL.
6834
 * @until itc->func.del = NULL;
6835

6836
 * Next we will append 1000 items to the combobox, this is similar to appending
6837
 * items to the genlist
6838
 * @until ));
6839
 *
6840
 * We also set a pair of callbacks to be called whenever any item is selected or
6841
 * pressed.
6842
 * when the combobox is activated, dismissed, expanded :
6843
 * @until _combobox_item_pressed_cb, NULL);
6844
 *
6845
 * And then ask that our combobox be shown and run the main loop:
6846
 * @until ELM_MAIN
6847
 *
6848
 * We now have the callback for setting text in the each item of genlist:
6849
 * @until }
6850
 *
6851
 * Next we have the callback which is called when the combobox is clicked:
6852
 * @until }
6853
 *
6854
 * Next we have the callback that is called whenever an item is selected and
6855
 * text of that item is set on combobox:
6856
 * @until }
6857

6858
 * Next we have the callback that is called whenever an item is pressed and
6859
 * text of that item is set on combobox and the hover is closed:
6860
 * @until }
6861
 *
6862
 * Next we have the callback that is called whenever an item is double-clicked
6863
 * or pressing (enter|return|spacebar) on an item also the text(event_info) of that item is set on
6864
 * combobox and the hover is closed:
6865
 * @until }
6866

6867
 * And the callback that is called when the hover,genlist are closed.
6868
 * @until }
6869
 *
6870
 * And finally the callback is called when hover,genlist are shown.
6871
 * @until }
6872
 *
6873
 * Our example will initially look like this:
6874
 *
6875
 * @image html screenshots/combobox_example_01.png
6876
 * @image latex screenshots/combobox_example_01.eps width=\textwidth
6877
 *
6878
 * @example combobox_example_01.c
6879
 */
6880

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.