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