9ef5c237eae61cff74328a33b8e51f287726f4d1
[framework/uifw/elementary.git] / doc / examples.dox
1 /**
2  * @page Examples Examples
3  *
4  * Here is a page with 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 elm_animator_example_page_01
15  *
16  * @ref transit_example_01_explained
17  *
18  * @ref transit_example_02_explained
19  *
20  * @ref general_functions_example_page
21  *
22  * @ref clock_example
23  */
24
25 /**
26  * @page bg_01_example_page elm_bg - Plain color background.
27  * @dontinclude bg_example_01.c
28  *
29  * The full code for this example can be found at @ref bg_example_01_c,
30  * in the function @c test_bg_plain. It's part of the @c elementar_test
31  * suite, and thus has the code for the three examples referenced by this
32  * documentation.
33  *
34  * This first example just sets a default background with a plain color. The
35  * first part consists of creating an Elementary window. It's the common
36  * piece of code that you'll see everywhere in Elementary: @skip elm_main
37  * @until autodel_set
38  *
39  * Now we really create our background object, using the window object as
40  * its parent:
41  *
42  * @skipline bg_add
43  *
44  * Then we set the size hints of the background object so that it will use
45  * all space available for it, and then add it as a resize object to the
46  * window, making it visible in the end:
47  *
48  * @skip size_hint_weight_set
49  * @until resize_object_add
50  *
51  * See @ref evas_object_size_hint_weight_set and elm_win_resize_object_add()
52  * for more detailed info about these functions.
53  *
54  * The end of the example is quite simple, just setting the minimum and
55  * maximum size of the background, so the Elementary window knows that it
56  * has to have at least the minimum size. The background also won't scale to
57  * a size above its maximum. Then we resize the window and show it in the
58  * end:
59  *
60  * @skip set size hints
61  * @until }
62  *
63  * And here we finish our very simple background object usage example.
64  */
65
66 /**
67  * @page bg_02_example_page elm_bg - Image background.
68  * @dontinclude bg_example_02.c
69  *
70  * The full code for this example can be found at @ref bg_example_02_c,
71  * in the function @c test_bg_image. It's part of the @c elementar_test
72  * suite, and thus has the code for the three examples referenced by this
73  * documentation.
74  *
75  * This is the second example, and shows how to use the Elementary
76  * background object to set an image as background of your application.
77  *
78  * We start this example exactly in the same way as the previous one, even
79  * when creating the background object:
80  *
81  * @skip elm_main
82  * @until bg_add
83  *
84  * Now it's the different part.
85  *
86  * Our background will have an image, that will be displayed over the
87  * background color. Before loading the image, we set the load size of the
88  * image. The load size is a hint about the size that we want the image
89  * displayed in the screen. It's not the exact size that the image will have,
90  * but usually a bit bigger. The background object can still be scaled to a
91  * size bigger than the one set here. Setting the image load size to
92  * something smaller than its real size will reduce the memory used to keep
93  * the pixmap representation of the image, and the time to load it. Here we
94  * set the load size to 20x20 pixels, but the image is loaded with a size
95  * bigger than that (since it's just a hint):
96  *
97  * @skipline load_size_set
98  *
99  * And set our background image to be centered, instead of stretched or
100  * scaled, so the effect of the elm_bg_load_size_set() can be easily
101  * understood:
102  *
103  * @skipline option_set
104  *
105  * We need a filename to set, so we get one from the previous installed
106  * images in the @c PACKAGE_DATA_DIR, and write its full path to a buffer.
107  * Then we use this buffer to set the filename in the background object:
108  *
109  * @skip snprintf
110  * @until bg_file_set
111  *
112  * Notice that the third argument of the elm_bg_file_set() function is @c
113  * NULL, since we are setting an image to this background. This function
114  * also supports setting an edje group as background, in which case the @c
115  * group parameter wouldn't be @c NULL, but be the name of the group
116  * instead.
117  *
118  * Finally, we can set the size hints, add the background as a resize
119  * object, and resize the window, exactly the same thing we do in the @ref
120  * bg_01_example_page example:
121  *
122  * @skip size_hint
123  * @until }
124  *
125  * And this is the end of this example.
126  *
127  * This example will look like this:
128  * @image html screenshots/bg_01.png
129  * @image latex screenshots/bg_01.eps
130  */
131
132 /**
133  * @page bg_03_example_page elm_bg - Background properties.
134  * @dontinclude bg_example_03.c
135  *
136  * The full code for this example can be found at @ref bg_example_03_c, in the
137  * function @c test_bg_options, with the callbacks @c _cb_overlay_changed, @c
138  * _cb_color_changed and @c _cb_radio_changed defined in the beginning of the
139  * file. It's part of the @c elementar_test suite, and thus has the code for
140  * the three examples referenced by this documentation.
141  *
142  * This example will show the properties available for the background object,
143  * and will use of some more widgets to set them.
144  *
145  * In order to do this, we will set some callbacks for these widgets. The
146  * first is for the radio buttons that will be used to choose the option
147  * passed as argument to elm_bg_option_set():
148  *
149  * @skip _cb_radio_changed
150  * @until }
151  *
152  * The next callback will be used when setting the overlay (using
153  * elm_bg_overlay_set()):
154  *
155  * @skip _cb_overlay_changed
156  * @until }
157  * @until }
158  *
159  * And the last one, used to set the color (with elm_bg_color_set()):
160  *
161  * @skip _cb_color_changed
162  * @until }
163  *
164  * We will get back to what these functions do soon. If you want to know more
165  * about how to set these callbacks and what these widgets are, look for:
166  * @li elm_radio_add()
167  * @li elm_check_add()
168  * @li elm_spinner_add()
169  *
170  * Now going to the main function, @c test_bg_options, we have the common
171  * code with the other examples:
172  *
173  * @skip bg-options
174  * @until autodel_set
175  *
176  * We add a plain background to this window, so it will have the default
177  * background color behind everything:
178  *
179  * @skip bg = elm_bg_add
180  * @until evas_object_show(bg)
181  *
182  * Then we add a vertical box (elm_box_add()) that will hold the background
183  * object that we are going to play with, as well as a horizontal box that
184  * will hold widgets:
185  *
186  * @skip elm_box_add
187  * @until evas_object_show
188  *
189  * Now we add the background object that is going to be of use for our
190  * example. It is an image background, as used in @ref bg_02_example_page ,
191  * so the code should be familiar:
192  *
193  * @skip elm_bg_add
194  * @until evas_object_show
195  *
196  * Notice the call to elm_box_pack_end(): it will pack the background object
197  * in the end of the Elementary box declared above. Just refer to that
198  * documentation for more info.
199  *
200  * Since this Elementary background is already an image background, we are
201  * going to play with its other properties. We will change its option
202  * (CENTER, SCALE, STRETCH, TILE), its color (RGB), and add an overlay to it.
203  * For all of these properties, we are going to add widgets that will
204  * configure them.
205  *
206  * First, lets add the horizontal box that will hold these widgets:
207  * @skip hbox
208  * @until align_set
209  *
210  * For now, just consider this @c hbox as a rectangle that will contain the
211  * widgets, and will distribute them horizontally inside its content. Then we
212  * add radio buttons that will allow us to choose the property to use with
213  * this background:
214  *
215  * @skip radio_add
216  * @until evas_object_show
217  *
218  * Again, I won't give details about the use of these widgets, just look for
219  * their documentation if necessary. It's enough to know for now that we are
220  * packing them in the @c hbox, setting a label for them, and the most
221  * important parts: setting its value to @c ELM_BG_OPTION_CENTER and its
222  * callback to @c _cb_radio_changed (the function defined in the beginning of
223  * this example). We do this for the next 3 radio buttons added after this
224  * one, each of them with a different value.
225  *
226  * Now taking a look at the code of the callback @c _cb_radio_changed again,
227  * it will call elm_bg_option_set() with the value set from the checked radio
228  * button, thus setting the option for this background. The background is
229  * passed as argument to the @p data parameter of this callback, and is
230  * referenced here as @c o_bg.
231  *
232  * Later we set the default value for this radio button:
233  *
234  * @skipline elm_radio_value_set
235  *
236  * Then we add a checkbox for the elm_bg_overlay_set() function:
237  *
238  * @skip check_add
239  * @until evas_object_show
240  *
241  * Now look at the code of the @c _cb_overlay_changed again. If the checkbox
242  * state is checked, an overlay will be added to the background. It's done by
243  * creating an Edje object, and setting it with elm_bg_overlay_set() to the
244  * background object. For information about what are and how to set Edje
245  * object, look at the Edje documentation.
246  *
247  * Finally we add a spinner object (elm_spinner_add()) to be used to select
248  * the color of our background. In its callback it's possible to see the call
249  * to elm_bg_color_set(), which will change the color of this background.
250  * This color is used by the background to fill areas where the image doesn't
251  * cover (in this case, where we have an image background). The spinner is
252  * also packed into the @c hbox :
253  *
254  * @skip elm_spinner_add
255  * @until evas_object_show
256  *
257  * Then we just have to pack the @c hbox inside the @c box, set some size
258  * hints, and show our window:
259  *
260  * @skip pack_end
261  * @until }
262  *
263  * Now to see this code in action, open elementary_test, and go to the "Bg
264  * Options" test. It should demonstrate what was implemented here.
265  */
266
267 /**
268  * @page actionslider_example_page Actionslider usage
269  * @dontinclude actionslider_example_01.c
270  *
271  * For this example we are going to assume knowledge of evas smart callbacks
272  * and some basic evas object functions. Elementary is not meant to be used
273  * without evas, if you're not yet familiar with evas it probably is worth
274  * checking that out.
275  *
276  * And now to the example, when using Elementary we start by including
277  * Elementary.h:
278  * @skipline #include
279  *
280  * Next we define some callbacks, they all share the same signature because
281  * they are all to be used with evas_object_smart_callback_add().
282  * The first one just prints the selected label(in two different ways):
283  * @until }
284  *
285  * This next callback is a little more interesting, it makes the selected
286  * label magnetic(except if it's the center label):
287  * @until }
288  *
289  * This callback enables or disables the magnetic propertty of the center
290  * label:
291  * @until }
292  *
293  * And finally a callback to stop the main loop when the window is closed:
294  * @until }
295  *
296  * To be able to create our actionsliders we need to do some setup, but this
297  * isn't really relevant here, so if you want to know about that go @ref
298  * Win "here".
299  *
300  * With all that boring stuff out of the way we can proceed to creating some
301  * actionsliders.@n
302  * All actionsliders are created the same way:
303  * @skipline actionslider_add
304  * Next we must choose where the indicator starts, and for this one we choose
305  * the right, and set the right as magnetic:
306  * @skipline indicator_pos_set
307  * @until magnet_pos_set
308  *
309  * We then set the labels for the left and right, passing NULL as an argument
310  * to any of the labels makes that position have no label.
311  * @until Stop
312  *
313  * Furthermore we mark both left and right as enabled positions, if we didn't
314  * do this all three positions would be enabled:
315  * @until RIGHT
316  *
317  * Having the the enabled positions we now add a smart callback to change
318  * which position is magnetic, so that only the last selected position is
319  * magnetic:
320  * @until NULL
321  *
322  * And finally we set our printing callback and show the actionslider:
323  * @until object_show
324  * @skip pack_end
325  *
326  * For our next actionslider we are going to do much as we did for the
327  * previous except we are going to have the center as the magnet(and not
328  * change it):
329  * @skipline actionslider_add
330  * @skipline indicator_pos_set
331  * @until object_show
332  *
333  * And another actionslider, in this one the indicator starts on the left.
334  * It has labels only in the center and right, and both bositions are
335  * magnetic. Because the left doesn't have a label and is not magnetic once
336  * the indicator leaves it can't return:
337  * @skipline actionslider_add
338  * @skipline indicator_pos_set
339  * @until object_show
340  * @note The greyed out area is a @ref Styles "style".
341  *
342  * And now an actionslider with a label in the indicator, and whose magnet
343  * properties change based on what was last selected:
344  * @skipline actionslider_add
345  * @skipline indicator_pos_set
346  * @until object_show
347  * @note The greyed out area is a @ref Styles "style".
348  *
349  * We are almost done, this next one is just an actionslider with all
350  * positions magnetized and having every possible label:
351  * @skipline actionslider_add
352  * @skipline indicator_pos_set
353  * @until object_show
354  *
355  * And for our last actionslider we have one that turns the magnetic property
356  * on and off:
357  * @skipline actionslider_add
358  * @skipline indicator_pos_set
359  * @until object_show
360  *
361  * The example will look like this:
362  * @image html screenshots/actionslider_01.png
363  * @image latex screenshots/actionslider_01.eps
364  *
365  * See the full source code @ref actionslider_example_01 "here"
366  */
367
368 /**
369  * @page elm_animator_example_page_01 Animator usage
370  * @dontinclude animator_example_01.c
371  *
372  * For this example we will be using a bit of evas, you could animate a
373  * elementary widget in much the same way, but to keep things simple we use
374  * an evas_object_rectangle.
375  *
376  * As every other example we start with our include and a simple callback to
377  * exit the app when the window is closed:
378  * @skipline #include
379  * @until }
380  *
381  * This next callback is the one that actually creates our animation, it
382  * changes the size, position and color of a rectangle given to it in @a
383  * data:
384  * @until }
385  *
386  * Next we have a callback that prints a string, nothing special:
387  * @until }
388  *
389  * This next callback is a little more interesting, it has a state variable
390  * to know if the animation is currently paused or running, and it toogles
391  * the state of the animation accordingly:
392  * @until }
393  * @until }
394  * @until }
395  *
396  * Finally we have a callback to stop the animation:
397  * @until }
398  *
399  * As with every example we need to do a bit of setup before we can actually
400  * use an animation, but for the purposes of this example that's not relevant
401  * so let's just skip to the good stuff, creating an animator:
402  * @skipline animator_add
403  * @note Since elm_animator is not a widget we can give it a NULL parent.
404  *
405  * Now that we have an elm_animator we set it's duration to 1 second:
406  * @line duration_set
407  *
408  * We would also like our animation to be reversible, so:
409  * @line reverse_set
410  *
411  * We also set our animation to repeat as many times as possible, which will
412  * mean that _end_cb will only be called after UINT_MAX * 2 seconds(UINT_MAX
413  * for the animation running forward and UNIT_MAX for the animation running
414  * backwards):
415  * @line repeat_set
416  *
417  * To add some fun to our animation we will use the IN_OUT curve style:
418  * @line curve_style
419  *
420  * To actually animate anything we need an operation callback:
421  * @line operation_callback
422  *
423  * Even though we set our animation to repeat for a very long time we are
424  * going to set a end callback to it:
425  * @line completion_callback
426  * @note Notice that stoping the animation with the stop button will not make
427  * _end_cb be called.
428  *
429  * Now that we have fully set up our animator we can tell it to start
430  * animating:
431  * @line animate
432  *
433  * There's a bit more of code that doesn't really matter to use so we skip
434  * right down to our last interesting point:
435  * @skipline animator_del
436  * @note Because we created our animator with no parent we need to delete it
437  * ourselves.
438  *
439  * The example should look like this:
440  * @image html screenshots/animator_example_01.png
441  * @image latex screenshots/animator_example_01.eps
442  * @n
443  * @image html screenshots/animator_example_02.png
444  * @image latex screenshots/animator_example_02.eps
445  * @n
446  * @image html screenshots/animator_example_03.png
447  * @image latex screenshots/animator_example_03.eps
448  *
449  * The full source code for this example can be found @ref
450  * animator_example_01_c "here"
451  */
452
453 /**
454  * @page transit_example_03_c elm_transit - Combined effects and options.
455  *
456  * This example shows how to apply the following transition effects:
457  * @li translation
458  * @li color
459  * @li rotation
460  * @li wipe
461  * @li zoom
462  * @li resizing
463  *
464  * It allows you to apply more than one effect at once, and also allows to
465  * set properties like event_enabled, auto_reverse, repeat_times and
466  * tween_mode.
467  *
468  * @include transit_example_03.c
469  */
470
471 /**
472  * @page transit_example_04_c elm_transit - Combined effects over two objects.
473  *
474  * This example shows how to apply the transition effects:
475  * @li flip
476  * @li resizable_flip
477  * @li fade
478  * @li blend
479  * over two objects. This kind of transition effect is used to make one
480  * object disappear and another one appear on its place.
481  *
482  * You can mix more than one effect of this type on the same objects, and the
483  * transition will apply both.
484  *
485  * @include transit_example_04.c
486  */
487
488 /**
489  * @page transit_example_01_explained elm_transit - Basic transit usage.
490  * @dontinclude transit_example_01.c
491  *
492  * The full code for this example can be found at @ref transit_example_01_c.
493  *
494  * This example shows the simplest way of creating a transition and applying
495  * it to an object. Similarly to every other elementary example, we create a
496  * window, set its title, size, autodel property, and setup a callback to
497  * exit the program when finished:
498  *
499  * @skip on_done
500  * @until evas_object_resize
501  *
502  * We also add a resizeable white background to use behind our animation:
503  *
504  * @skip bg_add
505  * @until evas_object_show
506  *
507  * And then we add a button that we will use to demonstrate the effects of
508  * our animation:
509  *
510  * @skip button_add
511  * @until evas_object_show(win)
512  *
513  * Notice that we are not adding the button with elm_win_resize_object_add()
514  * because we don't want the window to control the size of the button. We
515  * will use the transition to change the button size, so it could conflict
516  * with something else trying to control that size.
517  *
518  * Now, the simplest code possible to create the resize animation:
519  *
520  * @skip transit_add
521  * @until transit_go
522  *
523  * As you can see, this code is very easy to understand. First, we create the
524  * transition itself with elm_transit_add(). Then we add the button to this
525  * transition with elm_transit_object_add(), which means that the transition
526  * will operate over this button. The effect that we want now is changing the
527  * object size from 100x50 to 300x150, and can be achieved by adding the
528  * resize effect with elm_transit_effect_resizing_add().
529  *
530  * Finally, we set the transition time to 5 seconds and start the transition
531  * with elm_transit_go(). If we wanted more effects applied to this
532  * button, we could add them to the same transition. See the
533  * @ref transit_example_03_c to watch many transitions being applied to an
534  * object.
535  */
536
537 /**
538  * @page transit_example_02_explained elm_transit - Chained transitions.
539  * @dontinclude transit_example_02.c
540  *
541  * The full code for this example can be found at @ref transit_example_02_c.
542  *
543  * This example shows how to implement a chain of transitions. This chain is
544  * used to start a transition just after another transition ended. Similarly
545  * to every other elementary example, we create a window, set its title,
546  * size, autodel property, and setup a callback to exit the program when
547  * finished:
548  *
549  * @skip on_done
550  * @until evas_object_resize
551  *
552  * We also add a resizeable white background to use behind our animation:
553  *
554  * @skip bg_add
555  * @until evas_object_show
556  *
557  * This example will have a chain of 4 transitions, each of them applied to
558  * one button. Thus we create 4 different buttons:
559  *
560  * @skip button_add
561  * @until evas_object_show(bt4)
562  *
563  * Now we create a simple translation transition that will be started as soon
564  * as the program loads. It will be our first transition, and the other
565  * transitions will be started just after this transition ends:
566  *
567  * @skip transit_add
568  * @until transit_go
569  *
570  * The code displayed until now has nothing different from what you have
571  * already seen in @ref transit_example_01_explained, but now comes the new
572  * part: instead of creating a second transition that will start later using
573  * a timer, we create the it normally, and use
574  * elm_transit_chain_transit_add() instead of elm_transit_go. Since we are
575  * adding it in a chain after the first transition, it will start as soon as
576  * the first transition ends:
577  *
578  * @skip transit_add
579  * @until transit_chain_transit_add
580  *
581  * Finally we add the 2 other transitions to the chain, and run our program.
582  * It will make one transition start after the other finish, and there is the
583  * transition chain.
584  */
585
586 /**
587  * @page general_functions_example_page General (top-level) functions example
588  * @dontinclude general_funcs_example.c
589  *
590  * As told in their documentation blocks, the
591  * elm_app_compile_*_dir_set() family of functions have to be called
592  * before elm_app_info_set():
593  * @skip tell elm about
594  * @until elm_app_info_set
595  *
596  * We are here setting the fallback paths to the compiling time target
597  * paths, naturally. If you're building the example out of the
598  * project's build system, we're assuming they are the canonical ones.
599  *
600  * After the program starts, elm_app_info_set() will actually run and
601  * then you'll see an intrincasy: Elementary does the prefix lookup @b
602  * twice. This is so because of the quicklaunch infrastructure in
603  * Elementary (@ref Start), which will register a predefined prefix
604  * for possible users of the launch schema. We're not hooking into a
605  * quick launch, so this first call can't be avoided.
606  *
607  * If you ran this example from your "bindir" installation
608  * directiory, no output will emerge from these both attempts -- it
609  * will find the "magic" file there registered and set the prefixes
610  * silently. Otherwise, you could get something like:
611  @verbatim
612  WARNING: Could not determine its installed prefix for 'ELM'
613        so am falling back on the compiled in default:
614          usr
615        implied by the following:
616          bindir    = usr/lib
617          libdir    = usr/lib
618          datadir   = usr/share/elementary
619          localedir = usr/share/locale
620        Try setting the following environment variables:
621          ELM_PREFIX     - points to the base prefix of install
622        or the next 4 variables
623          ELM_BIN_DIR    - provide a specific binary directory
624          ELM_LIB_DIR    - provide a specific library directory
625          ELM_DATA_DIR   - provide a specific data directory
626          ELM_LOCALE_DIR - provide a specific locale directory
627  @endverbatim
628  * if you also didn't change those environment variables (remember
629  * they are also a valid way of communicating your prefix to the
630  * binary) - this is the scenario where it fallbacks to the paths set
631  * for compile time.
632  *
633  * Then, you can check the prefixes set on the standard output:
634  * @skip prefix was set to
635  * @until locale directory is
636  *
637  * In the fragment
638  * @skip by using this policy
639  * @until elm_win_autodel_set
640  * we demonstrate the use of Elementary policies. The policy defining
641  * under which circunstances our application should quit automatically
642  * is set to when its last window is closed (this one has just one
643  * window, though). This will save us from having to set a callback
644  * ourselves on the window, like done in @ref bg_example_01_c "this"
645  * example. Note that we need to tell the window to delete itself's
646  * object on a request to destroy the canvas coming, with
647  * elm_win_autodel_set().
648  *
649  * What follows is some boilerplate code, creating a frame with a @b
650  * button, our object of interest, and, below, widgets to change the
651  * button's behavior and exemplify the group of functions in question.
652  *
653  * @dontinclude general_funcs_example.c
654  * We enabled the focus highlight object for this window, so that you
655  * can keep track of the current focused object better:
656  * @skip elm_win_focus_highlight_enabled_set
657  * @until evas_object_show
658  * Use the tab key to navigate through the focus chain.
659  *
660  * @dontinclude general_funcs_example.c
661  * While creating the button, we exemplify how to use Elementary's
662  * finger size information to scale our UI:
663  * @skip fprintf(stdout, "Elementary
664  * @until evas_object_show
665  *
666  * @dontinclude general_funcs_example.c
667  * The first checkbox's callback is:
668  * @skip static void
669  * @until }
670  * When unsetting the checkbox, we disable the button, which will get a new
671  * decoration (greyed out) and stop receiving events. The focus chain
672  * will also ignore it.
673  *
674  * Following, there are 2 more buttons whose actions are focus/unfocus
675  * the top button, respectively:
676  * @skip focus callback
677  * @until }
678  * and
679  * @skip unfocus callback
680  * @until }
681  * Note the situations in which they won't take effect:
682  * - the button is not allowed to get focus or
683  * - the button is disabled
684  *
685  * The first restriction above you'll get by a second checkbox, whose
686  * callback is:
687  * @skip focus allow callback
688  * @until }
689  * Note that the button will still get mouse events, though.
690  *
691  * Next, there's a slider controlling the button's scale:
692  * @skip scaling callback
693  * @until }
694  *
695  * Experiment with it, so you understand the effect better. If you
696  * change its value, it will mess with the button's original size,
697  * naturally.
698  *
699  * The full code for this example can be found
700  * @ref general_functions_example_c "here".
701  */
702
703 /**
704  * @page theme_example_01 Theme - Using extensions
705  *
706  * @dontinclude theme_example_01.c
707  *
708  * Using extensions is extremely easy, discarding the part where you have to
709  * write the theme for them.
710  *
711  * In the following example we'll be creating two buttons, one to load or
712  * unload our extension theme and one to cycle around three possible styles,
713  * one of which we created.
714  *
715  * After including our one and only header we'll jump to the callback for
716  * the buttons. First one takes care of loading or unloading our extension
717  * file, relative to the default theme set (thus the @c NULL in the
718  * functions first parameter).
719  * @skipline Elementary.h
720  * @skip static void
721  * @until }
722  * @until }
723  * @until }
724  *
725  * The second button, as we said before, will just switch around different
726  * styles. In this case we have three of them. The first one is our custom
727  * style, named after something very unlikely to find in the default theme.
728  * The other two styles are the standard and one more, anchor, which exists
729  * in the default and is similar to the default, except the button vanishes
730  * when the mouse is not over it.
731  * @skip static void
732  * @until }
733  * @until }
734  *
735  * So what happens if the style switches to our custom one when the
736  * extension is loaded? Elementary falls back to the default for the
737  * widget.
738  *
739  * And the main function, simply enough, will create the window, set the
740  * buttons and their callbacks, and just to begin with our button styled
741  * we're also loading our extension at the beginning.
742  * @skip int
743  * @until ELM_MAIN
744  *
745  * In this case we wanted to easily remove extensions, but all adding an
746  * extension does is tell Elementary where else it should look for themes
747  * when it can't find them in the default theme. Another way to do this
748  * is to set the theme search order using elm_theme_set(), but this requires
749  * that the developer is careful not to override any user configuration.
750  * That can be helped by adding our theme to the end of whatver is already
751  * set, like in the following snippet.
752  * @code
753  * char buf[4096];
754  * snprintf(buf, sizeof(buf), "%s:./theme_example.edj", elme_theme_get(NULL);
755  * elm_theme_set(NULL, buf);
756  * @endcode
757  *
758  * If we were using overlays instead of extensions, the same thing applies,
759  * but the custom theme must be added to the front of the search path.
760  *
761  * In the end, we should be looking at something like this:
762  * @image html screenshots/theme_example_01.png
763  * @image latex screenshots/theme_example_01.eps
764  *
765  * That's all. Boringly simple, and the full code in one piece can be found
766  * @ref theme_example_01.c "here".
767  *
768  * And the code for our extension is @ref theme_example.edc "here".
769  *
770  * @example theme_example_01.c
771  * @example theme_example.edc
772  */
773
774 /**
775  * @page theme_example_02 Theme - Using overlays
776  *
777  * @dontinclude theme_example_02.c
778  *
779  * Overlays are like extensions in that you tell Elementary that some other
780  * theme contains the styles you need for your program. The difference is that
781  * they will be look in first, so they can override the default style of any
782  * widget.
783  *
784  * There's not much to say about them that hasn't been said in our previous
785  * example about @ref theme_example_01 "extensions", so going quickly through
786  * the code we have a function to load or unload the theme, which will be
787  * called when we click any button.
788  * @skipline Elementary.h
789  * @skip static void
790  * @until }
791  *
792  * And the main function, creating the window and adding some buttons to it.
793  * We load our theme as an overlay and nothing else. Notice there's no style
794  * set for any button there, which means they should be using the default
795  * that we override.
796  * @skip int
797  * @until ELM_MAIN
798  *
799  * That's pretty much it. The full code is @ref theme_example_02.c "here" and
800  * the definition of the theme is the same as before, and can be found in
801  * @ref theme_example.edc "here".
802  *
803  * @example theme_example_02.c
804  */
805
806  /**
807   * @page button_example_01 Button - Complete example
808   *
809   * @dontinclude button_example_01.c
810   *
811   * A button is simple, you click on it and something happens. That said,
812   * we'll go through an example to show in detail the button API less
813   * commonly used.
814   *
815   * In the end, we'll be presented with something that looks like this:
816   * @image html screenshots/button_01.png
817   * @image latex screenshots/button_01.eps
818   *
819   * The full code of the example is @ref button_example_01.c "here" and we
820   * will follow here with a rundown of it.
821   *
822   * @skip Elementary.h
823   * @until Elementary.h
824   * @skip struct
825   * @until App_Data
826   *
827   * We have several buttons to set different times for the autorepeat timeouts
828   * of the buttons that use it and a few more that we keep track of in our
829   * data struct. The mid button doesn't do much, just moves around according
830   * to what other buttons the user presses. Then four more buttons to move the
831   * central one, and we're also keeping track of the icon set in the middle
832   * button, since when this one moves, we change the icon, and when movement
833   * is finished (by releasing one of the four arrow buttons), we set back the
834   * normal icon.
835   * @skip static void
836   * @until }
837   *
838   * Keeping any of those four buttons pressed will trigger their autorepeat
839   * callback, where we move the button doing some size hint magic. To
840   * understand how that works better, refer to the @ref Box documentation.
841   * Also, the first time the function is called, we change the icon in the
842   * middle button, using elm_button_icon_unset() first to keep the reference
843   * to the previous one, so we don't need to recreate it when we are done
844   * moving it.
845   * @skip static void
846   * @until }
847   * @until size_hint_align_set
848   * @until }
849   *
850   * One more callback for the option buttons, that just sets the timeouts for
851   * the different autorepeat options.
852   *
853   * @skip static void
854   * @until }
855   * @until }
856   * @until }
857   *
858   * And the main function, which does some setting up of the buttons in boxes
859   * to make things work. Here we'll go through some snippets only.
860   *
861   * For the option buttons, it's just the button with its label and callback.
862   * @skip elm_button_add
863   * @until smart_callback_add
864   *
865   * For the ones that move the central button, we have no labels. There are
866   * icons instead, and the autorepeat option is toggled.
867   * @skip Gap: 1.0
868   * @skip elm_button_add
869   * @until data.cursors.up
870   *
871   * And just to show the mid button, which doesn't have anything special.
872   * @skip data.cursors.left
873   * @skip elm_button_add
874   * @until data.mid
875   *
876   * And we are done.
877   *
878   * @example button_example_01.c
879   */
880
881 /**
882  * @page bubble_01_example_page elm_bubble - Simple use.
883  * @dontinclude bubble_example_01.c
884  *
885  * This example shows a bubble with all fields set(label, info, content and
886  * icon) and the selected corner changing when the bubble is clicked. To be
887  * able use a bubble we need to do some setup and create a window, for this
888  * example we are going to ignore that part of the code since it isn't
889  * relevant to the bubble.
890  *
891  * To have the selected corner change in a clockwise motion we are going to
892  * use the following callback:
893  * @skip static
894  * @until }
895  * @until }
896  *
897  * Here we are creating an elm_label that is going to be used as the content
898  * for our bubble:
899  * @skipline elm_label
900  * @until show
901  * @note You could use any evas_object for this, we are using an elm_label
902  * for simplicity.
903  *
904  * Despite it's name the bubble's icon doesn't have to be an icon, it can be
905  * any evas_object. For this example we are going to make the icon a simple
906  * blue rectangle:
907  * @until show
908  *
909  * And finally we have the actual bubble creation and the setting of it's
910  * label, info and content:
911  * @until content
912  * @skipline show
913  * @note Because we didn't set a corner, the default("top_left") will be
914  * used.
915  *
916  * Now that we have our bubble all that is left is connecting the "clicked"
917  * signals to our callback:
918  * @line smart_callback
919  *
920  * This last bubble we created was very complete, so it's pertinent to show
921  * that most of that stuff is optional a bubble can be created with nothing
922  * but content:
923  * @until content
924  * @skipline show
925  *
926  * Our example will look like this:
927  * @image html screenshots/bubble_example_01.png
928  * @image latex screenshots/bubble_example_01.eps
929  *
930  * See the full source code @ref bubble_example_01.c here.
931  * @example bubble_example_01.c
932  */
933
934 /**
935  * @page box_example_01 Box - Basic API
936  *
937  * @dontinclude button_example_01.c
938  *
939  * As a special guest tonight, we have the @ref button_example_01 "simple
940  * button example". There are plenty of boxes in it, and to make the cursor
941  * buttons that moved a central one around when pressed, we had to use a
942  * variety of values for their hints.
943  *
944  * To start, let's take a look at the handling of the central button when
945  * we were moving it around. To achieve this effect without falling back to
946  * a complete manual positioning of the @c Evas_Object in our canvas, we just
947  * put it in a box and played with its alignment within it, as seen in the
948  * following snippet of the callback for the pressed buttons.
949  * @skip evas_object_size_hint_align_get
950  * @until evas_object_size_hint_align_set
951  *
952  * Not much to it. We get the current alignment of the object and change it
953  * by just a little, depending on which button was pressed, then set it
954  * again, making sure we stay within the 0.0-1.0 range so the button moves
955  * inside the space it has, instead of disappearing under the other objects.
956  *
957  * But as useful as an example as that may have been, the usual case with boxes
958  * is to set everything at the moment they are created, like we did for
959  * everything else in our main function.
960  *
961  * The entire layout of our program is made with boxes. We have one set as the
962  * resize object for the window, which means it will always be resized with
963  * the window. The weight hints set to @c EVAS_HINT_EXPAND will tell the
964  * window that the box can grow past it's minimum size, which allows resizing
965  * of it.
966  * @skip elm_main
967  * @skip elm_box_add
968  * @until evas_object_show
969  *
970  * Two more boxes, set to horizontal, hold the buttons to change the autorepeat
971  * configuration used by the buttons. We create each to take over all the
972  * available space horizontally, but we don't want them to grow vertically,
973  * so we keep that axis of the weight with 0.0. Then it gets packed in the
974  * main box.
975  * @skip box2
976  * @until evas_object_show
977  *
978  * The buttons in each of those boxes have nothing special, they are just packed
979  * in with their default values and the box will use their minimum size, as set
980  * by Elementary itself based on the label, icon, finger size and theme.
981  *
982  * But the buttons used to move the central one have a special disposition.
983  * The top one first, is placed right into the main box like our other smaller
984  * boxes. Set to expand horizontally and not vertically, and in this case we
985  * also tell it to fill that space, so it gets resized to take the entire
986  * width of the window.
987  * @skip Gap: 1.0
988  * @skip elm_button_add
989  * @until evas_object_show
990  *
991  * The bottom one will be the same, but for the other two we need to use a
992  * second box set to take as much space as we have, so we can place our side
993  * buttons in place and have the big empty space where the central button will
994  * move.
995  * @skip elm_box_add
996  * @until evas_object_show
997  *
998  * Then the buttons will have their hints inverted to the other top and bottom
999  * ones, to expand and fill vertically and keep their minimum size horizontally.
1000  * @skip elm_button_add
1001  * @until evas_object_show
1002  *
1003  * The central button takes every thing else. It will ask to be expanded in
1004  * both directions, but without filling its cell. Changing its alignment by
1005  * pressing the buttons will make it move around.
1006  * @skip elm_button_add
1007  * @until evas_object_show
1008  *
1009  * To end, the rightmost button is packed in the smaller box after the central
1010  * one, and back to the main box we have the bottom button at the end.
1011  */
1012
1013 /**
1014  * @page box_example_02 Box - Layout transitions
1015  *
1016  * @dontinclude box_example_02.c
1017  *
1018  * Setting a customized layout for a box is simple once you have the layout
1019  * function, which is just like the layout function for @c Evas_Box. The new
1020  * and fancier thing we can do with Elementary is animate the transition from
1021  * one layout to the next. We'll see now how to do that through a simple
1022  * example, while also taking a look at some of the API that was left
1023  * untouched in our @ref box_example_01 "previous example".
1024  *
1025  * @image html screenshots/box_example_02.png
1026  * @image latex screenshots/box_example_02.eps
1027  *
1028  * @skipline Elementary.h
1029  *
1030  * Our application data consists of a list of layout functions, given by
1031  * @c transitions. We'll be animating through them throughout the entire run.
1032  * The box with the stuff to move around and the last layout that was set to
1033  * make things easier in the code.
1034  * @skip typedef
1035  * @until Transitions_Data
1036  *
1037  * The box starts with three buttons, clicking on any of them will take it
1038  * out of the box without deleting the object. There are also two more buttons
1039  * outside, one to add an object to the box and the other to clear it.
1040  * This is all to show how you can interact with the items in the box, add
1041  * things and even remove them, while the transitions occur.
1042  *
1043  * One of the callback we'll be using creates a new button, asks the box for
1044  * the list of its children and if it's not empty, we add the new object after
1045  * the first one, otherwise just place at the end as it will not make any
1046  * difference.
1047  * @skip static void
1048  * @until }
1049  * @until }
1050  *
1051  * The clear button is even simpler. Everything in the box will be deleted,
1052  * leaving it empty and ready to fill it up with more stuff.
1053  * @skip static void
1054  * @until }
1055  *
1056  * And a little function to remove buttons from the box without deleting them.
1057  * This one is set for the @c clicked callback of the original buttons,
1058  * unpacking them when clicked and placing it somewhere in the screen where
1059  * they will not disturb. Once we do this, the box no longer has any control
1060  * of it, so it will be left untouched until the program ends.
1061  * @skip static void
1062  * @until }
1063  *
1064  * If we wanted, we could just call @c evas_object_del() on the object to
1065  * destroy it. In this case, no unpack is really necessary, as the box would
1066  * be notified of a child being deleted and adjust its calculations accordingly.
1067  *
1068  * The core of the program is the following function. It takes whatever
1069  * function is first on our list of layouts and together with the
1070  * @c last_layout, it creates an ::Elm_Box_Transition to use with
1071  * elm_box_layout_transition(). In here, we tell it to start from whatever
1072  * layout we last set, end with the one that was at the top of the list and
1073  * when everything is finished, call us back so we can create another
1074  * transition. Finally, move the new layout to the end of the list so we
1075  * can continue running through them until the program ends.
1076  * @skip static void
1077  * @until }
1078  *
1079  * The main function doesn't have antyhing special. Creation of box, initial
1080  * buttons and some callback setting. The only part worth mentioning is the
1081  * initialization of our application data.
1082  * @skip tdata.box
1083  * @until evas_object_box_layout_stack
1084  *
1085  * We have a simple static variable, set the box, the first layout we are
1086  * using as last and create the list with the different functions to go
1087  * through.
1088  *
1089  * And in the end, we set the first layout and call the same function we went
1090  * through before to start the run of transitions.
1091  * @until _test_box_transition_change
1092  *
1093  * For the full code, follow @ref box_example_02.c "here".
1094  *
1095  * @example box_example_02.c
1096  */
1097
1098 /**
1099  * @page clock_example Clock widget example
1100  *
1101  * This code places five Elementary clock widgets on a window, each of
1102  * them exemplifying a part of the widget's API.
1103  *
1104  * The first of them is the pristine clock:
1105  * @dontinclude clock_example.c
1106  * @skip pristine
1107  * @until evas_object_show
1108  * As you see, the defaults for a clock are:
1109  * - military time
1110  * - no seconds shown
1111  *
1112  * For am/pm time, see the second clock:
1113  * @dontinclude clock_example.c
1114  * @skip am/pm
1115  * @until evas_object_show
1116  *
1117  * The third one will show the seconds digits, which will flip in
1118  * synchrony with system time. Note, besides, that the time itself is
1119  * @b different from the system's -- it was customly set with
1120  * elm_clock_time_set():
1121  * @dontinclude clock_example.c
1122  * @skip with seconds
1123  * @until evas_object_show
1124  *
1125  * In both fourth and fifth ones, we turn on the <b>edition
1126  * mode</b>. See how you can change each of the sheets on it, and be
1127  * sure to try holding the mouse pressed over one of the sheet
1128  * arrows. The forth one also starts with a custom time set:
1129  * @dontinclude clock_example.c
1130  * @skip in edition
1131  * @until evas_object_show
1132  *
1133  * The fifth, besides editable, has only the time @b units editable,
1134  * for hours, minutes and seconds. This exemplifies
1135  * elm_clock_digit_edit_set():
1136  * @dontinclude clock_example.c
1137  * @skip but only
1138  * @until evas_object_show
1139  *
1140  * See the full @ref clock_example.c "example", whose window should
1141  * look like this picture:
1142  * @image html screenshots/clock_example.png
1143  * @image latex screenshots/clock_example.eps
1144  *
1145  * @example clock_example.c
1146  */
1147
1148 /**
1149  * @page bg_example_01_c bg_example_01.c
1150  * @include bg_example_01.c
1151  * @example bg_example_01.c
1152  */
1153
1154 /**
1155  * @page bg_example_02_c bg_example_02.c
1156  * @include bg_example_02.c
1157  * @example bg_example_02.c
1158  */
1159
1160 /**
1161  * @page bg_example_03_c bg_example_03.c
1162  * @include bg_example_03.c
1163  * @example bg_example_03.c
1164  */
1165
1166 /**
1167  * @page actionslider_example_01 Actionslider example
1168  * @include actionslider_example_01.c
1169  * @example actionslider_example_01.c
1170  */
1171
1172 /**
1173  * @page animator_example_01_c Animator example 01
1174  * @include animator_example_01.c
1175  * @example animator_example_01.c
1176  */
1177
1178 /**
1179  * @page transit_example_01_c Transit example 1
1180  * @include transit_example_01.c
1181  * @example transit_example_01.c
1182  */
1183
1184 /**
1185  * @page transit_example_02_c Transit example 2
1186  * @include transit_example_02.c
1187  * @example transit_example_02.c
1188  */
1189
1190 /**
1191  * @page general_functions_example_c General (top-level) functions example
1192  * @include general_funcs_example.c
1193  * @example general_funcs_example.c
1194  */