2 * @page Examples Examples
4 * Here is a page with Elementary examples.
6 * @ref bg_01_example_page
8 * @ref bg_02_example_page
10 * @ref bg_03_example_page
12 * @ref actionslider_example_page
14 * @ref elm_animator_example_page_01
16 * @ref transit_example_01_explained
18 * @ref transit_example_02_explained
20 * @ref general_functions_example_page
22 * @ref calendar_example_01
24 * @ref calendar_example_02
26 * @ref calendar_example_03
28 * @ref calendar_example_04
30 * @ref calendar_example_05
32 * @ref calendar_example_06
36 * @ref flipselector_example
38 * @ref fileselector_example
40 * @ref fileselector_button_example
42 * @ref fileselector_entry_example
46 * @page bg_01_example_page elm_bg - Plain color background.
47 * @dontinclude bg_example_01.c
49 * The full code for this example can be found at @ref bg_example_01_c,
50 * in the function @c test_bg_plain. It's part of the @c elementar_test
51 * suite, and thus has the code for the three examples referenced by this
54 * This first example just sets a default background with a plain color. The
55 * first part consists of creating an Elementary window. It's the common
56 * piece of code that you'll see everywhere in Elementary: @skip elm_main
59 * Now we really create our background object, using the window object as
64 * Then we set the size hints of the background object so that it will use
65 * all space available for it, and then add it as a resize object to the
66 * window, making it visible in the end:
68 * @skip size_hint_weight_set
69 * @until resize_object_add
71 * See @ref evas_object_size_hint_weight_set and elm_win_resize_object_add()
72 * for more detailed info about these functions.
74 * The end of the example is quite simple, just setting the minimum and
75 * maximum size of the background, so the Elementary window knows that it
76 * has to have at least the minimum size. The background also won't scale to
77 * a size above its maximum. Then we resize the window and show it in the
80 * @skip set size hints
83 * And here we finish our very simple background object usage example.
87 * @page bg_02_example_page elm_bg - Image background.
88 * @dontinclude bg_example_02.c
90 * The full code for this example can be found at @ref bg_example_02_c,
91 * in the function @c test_bg_image. It's part of the @c elementar_test
92 * suite, and thus has the code for the three examples referenced by this
95 * This is the second example, and shows how to use the Elementary
96 * background object to set an image as background of your application.
98 * We start this example exactly in the same way as the previous one, even
99 * when creating the background object:
104 * Now it's the different part.
106 * Our background will have an image, that will be displayed over the
107 * background color. Before loading the image, we set the load size of the
108 * image. The load size is a hint about the size that we want the image
109 * displayed in the screen. It's not the exact size that the image will have,
110 * but usually a bit bigger. The background object can still be scaled to a
111 * size bigger than the one set here. Setting the image load size to
112 * something smaller than its real size will reduce the memory used to keep
113 * the pixmap representation of the image, and the time to load it. Here we
114 * set the load size to 20x20 pixels, but the image is loaded with a size
115 * bigger than that (since it's just a hint):
117 * @skipline load_size_set
119 * And set our background image to be centered, instead of stretched or
120 * scaled, so the effect of the elm_bg_load_size_set() can be easily
123 * @skipline option_set
125 * We need a filename to set, so we get one from the previous installed
126 * images in the @c PACKAGE_DATA_DIR, and write its full path to a buffer.
127 * Then we use this buffer to set the filename in the background object:
132 * Notice that the third argument of the elm_bg_file_set() function is @c
133 * NULL, since we are setting an image to this background. This function
134 * also supports setting an edje group as background, in which case the @c
135 * group parameter wouldn't be @c NULL, but be the name of the group
138 * Finally, we can set the size hints, add the background as a resize
139 * object, and resize the window, exactly the same thing we do in the @ref
140 * bg_01_example_page example:
145 * And this is the end of this example.
147 * This example will look like this:
148 * @image html screenshots/bg_01.png
149 * @image latex screenshots/bg_01.eps
153 * @page bg_03_example_page elm_bg - Background properties.
154 * @dontinclude bg_example_03.c
156 * The full code for this example can be found at @ref bg_example_03_c, in the
157 * function @c test_bg_options, with the callbacks @c _cb_overlay_changed, @c
158 * _cb_color_changed and @c _cb_radio_changed defined in the beginning of the
159 * file. It's part of the @c elementar_test suite, and thus has the code for
160 * the three examples referenced by this documentation.
162 * This example will show the properties available for the background object,
163 * and will use of some more widgets to set them.
165 * In order to do this, we will set some callbacks for these widgets. The
166 * first is for the radio buttons that will be used to choose the option
167 * passed as argument to elm_bg_option_set():
169 * @skip _cb_radio_changed
172 * The next callback will be used when setting the overlay (using
173 * elm_bg_overlay_set()):
175 * @skip _cb_overlay_changed
179 * And the last one, used to set the color (with elm_bg_color_set()):
181 * @skip _cb_color_changed
184 * We will get back to what these functions do soon. If you want to know more
185 * about how to set these callbacks and what these widgets are, look for:
186 * @li elm_radio_add()
187 * @li elm_check_add()
188 * @li elm_spinner_add()
190 * Now going to the main function, @c test_bg_options, we have the common
191 * code with the other examples:
196 * We add a plain background to this window, so it will have the default
197 * background color behind everything:
199 * @skip bg = elm_bg_add
200 * @until evas_object_show(bg)
202 * Then we add a vertical box (elm_box_add()) that will hold the background
203 * object that we are going to play with, as well as a horizontal box that
207 * @until evas_object_show
209 * Now we add the background object that is going to be of use for our
210 * example. It is an image background, as used in @ref bg_02_example_page ,
211 * so the code should be familiar:
214 * @until evas_object_show
216 * Notice the call to elm_box_pack_end(): it will pack the background object
217 * in the end of the Elementary box declared above. Just refer to that
218 * documentation for more info.
220 * Since this Elementary background is already an image background, we are
221 * going to play with its other properties. We will change its option
222 * (CENTER, SCALE, STRETCH, TILE), its color (RGB), and add an overlay to it.
223 * For all of these properties, we are going to add widgets that will
226 * First, lets add the horizontal box that will hold these widgets:
230 * For now, just consider this @c hbox as a rectangle that will contain the
231 * widgets, and will distribute them horizontally inside its content. Then we
232 * add radio buttons that will allow us to choose the property to use with
236 * @until evas_object_show
238 * Again, I won't give details about the use of these widgets, just look for
239 * their documentation if necessary. It's enough to know for now that we are
240 * packing them in the @c hbox, setting a label for them, and the most
241 * important parts: setting its value to @c ELM_BG_OPTION_CENTER and its
242 * callback to @c _cb_radio_changed (the function defined in the beginning of
243 * this example). We do this for the next 3 radio buttons added after this
244 * one, each of them with a different value.
246 * Now taking a look at the code of the callback @c _cb_radio_changed again,
247 * it will call elm_bg_option_set() with the value set from the checked radio
248 * button, thus setting the option for this background. The background is
249 * passed as argument to the @p data parameter of this callback, and is
250 * referenced here as @c o_bg.
252 * Later we set the default value for this radio button:
254 * @skipline elm_radio_value_set
256 * Then we add a checkbox for the elm_bg_overlay_set() function:
259 * @until evas_object_show
261 * Now look at the code of the @c _cb_overlay_changed again. If the checkbox
262 * state is checked, an overlay will be added to the background. It's done by
263 * creating an Edje object, and setting it with elm_bg_overlay_set() to the
264 * background object. For information about what are and how to set Edje
265 * object, look at the Edje documentation.
267 * Finally we add a spinner object (elm_spinner_add()) to be used to select
268 * the color of our background. In its callback it's possible to see the call
269 * to elm_bg_color_set(), which will change the color of this background.
270 * This color is used by the background to fill areas where the image doesn't
271 * cover (in this case, where we have an image background). The spinner is
272 * also packed into the @c hbox :
274 * @skip elm_spinner_add
275 * @until evas_object_show
277 * Then we just have to pack the @c hbox inside the @c box, set some size
278 * hints, and show our window:
283 * Now to see this code in action, open elementary_test, and go to the "Bg
284 * Options" test. It should demonstrate what was implemented here.
288 * @page actionslider_example_page Actionslider usage
289 * @dontinclude actionslider_example_01.c
291 * For this example we are going to assume knowledge of evas smart callbacks
292 * and some basic evas object functions. Elementary is not meant to be used
293 * without evas, if you're not yet familiar with evas it probably is worth
296 * And now to the example, when using Elementary we start by including
300 * Next we define some callbacks, they all share the same signature because
301 * they are all to be used with evas_object_smart_callback_add().
302 * The first one just prints the selected label(in two different ways):
305 * This next callback is a little more interesting, it makes the selected
306 * label magnetic(except if it's the center label):
309 * This callback enables or disables the magnetic propertty of the center
313 * And finally a callback to stop the main loop when the window is closed:
316 * To be able to create our actionsliders we need to do some setup, but this
317 * isn't really relevant here, so if you want to know about that go @ref
320 * With all that boring stuff out of the way we can proceed to creating some
322 * All actionsliders are created the same way:
323 * @skipline actionslider_add
324 * Next we must choose where the indicator starts, and for this one we choose
325 * the right, and set the right as magnetic:
326 * @skipline indicator_pos_set
327 * @until magnet_pos_set
329 * We then set the labels for the left and right, passing NULL as an argument
330 * to any of the labels makes that position have no label.
333 * Furthermore we mark both left and right as enabled positions, if we didn't
334 * do this all three positions would be enabled:
337 * Having the the enabled positions we now add a smart callback to change
338 * which position is magnetic, so that only the last selected position is
342 * And finally we set our printing callback and show the actionslider:
346 * For our next actionslider we are going to do much as we did for the
347 * previous except we are going to have the center as the magnet(and not
349 * @skipline actionslider_add
350 * @skipline indicator_pos_set
353 * And another actionslider, in this one the indicator starts on the left.
354 * It has labels only in the center and right, and both bositions are
355 * magnetic. Because the left doesn't have a label and is not magnetic once
356 * the indicator leaves it can't return:
357 * @skipline actionslider_add
358 * @skipline indicator_pos_set
360 * @note The greyed out area is a @ref Styles "style".
362 * And now an actionslider with a label in the indicator, and whose magnet
363 * properties change based on what was last selected:
364 * @skipline actionslider_add
365 * @skipline indicator_pos_set
367 * @note The greyed out area is a @ref Styles "style".
369 * We are almost done, this next one is just an actionslider with all
370 * positions magnetized and having every possible label:
371 * @skipline actionslider_add
372 * @skipline indicator_pos_set
375 * And for our last actionslider we have one that turns the magnetic property
377 * @skipline actionslider_add
378 * @skipline indicator_pos_set
381 * The example will look like this:
382 * @image html screenshots/actionslider_01.png
383 * @image latex screenshots/actionslider_01.eps
385 * See the full source code @ref actionslider_example_01 "here"
389 * @page elm_animator_example_page_01 Animator usage
390 * @dontinclude animator_example_01.c
392 * For this example we will be using a bit of evas, you could animate a
393 * elementary widget in much the same way, but to keep things simple we use
394 * an evas_object_rectangle.
396 * As every other example we start with our include and a simple callback to
397 * exit the app when the window is closed:
401 * This next callback is the one that actually creates our animation, it
402 * changes the size, position and color of a rectangle given to it in @a
406 * Next we have a callback that prints a string, nothing special:
409 * This next callback is a little more interesting, it has a state variable
410 * to know if the animation is currently paused or running, and it toogles
411 * the state of the animation accordingly:
416 * Finally we have a callback to stop the animation:
419 * As with every example we need to do a bit of setup before we can actually
420 * use an animation, but for the purposes of this example that's not relevant
421 * so let's just skip to the good stuff, creating an animator:
422 * @skipline animator_add
423 * @note Since elm_animator is not a widget we can give it a NULL parent.
425 * Now that we have an elm_animator we set it's duration to 1 second:
428 * We would also like our animation to be reversible, so:
431 * We also set our animation to repeat as many times as possible, which will
432 * mean that _end_cb will only be called after UINT_MAX * 2 seconds(UINT_MAX
433 * for the animation running forward and UNIT_MAX for the animation running
437 * To add some fun to our animation we will use the IN_OUT curve style:
440 * To actually animate anything we need an operation callback:
441 * @line operation_callback
443 * Even though we set our animation to repeat for a very long time we are
444 * going to set a end callback to it:
445 * @line completion_callback
446 * @note Notice that stoping the animation with the stop button will not make
449 * Now that we have fully set up our animator we can tell it to start
453 * There's a bit more of code that doesn't really matter to use so we skip
454 * right down to our last interesting point:
455 * @skipline animator_del
456 * @note Because we created our animator with no parent we need to delete it
459 * The example should look like this:
460 * @image html screenshots/animator_example_01.png
461 * @image latex screenshots/animator_example_01.eps
463 * @image html screenshots/animator_example_02.png
464 * @image latex screenshots/animator_example_02.eps
466 * @image html screenshots/animator_example_03.png
467 * @image latex screenshots/animator_example_03.eps
469 * The full source code for this example can be found @ref
470 * animator_example_01_c "here"
474 * @page transit_example_03_c elm_transit - Combined effects and options.
476 * This example shows how to apply the following transition effects:
484 * It allows you to apply more than one effect at once, and also allows to
485 * set properties like event_enabled, auto_reverse, repeat_times and
488 * @include transit_example_03.c
492 * @page transit_example_04_c elm_transit - Combined effects over two objects.
494 * This example shows how to apply the transition effects:
499 * over two objects. This kind of transition effect is used to make one
500 * object disappear and another one appear on its place.
502 * You can mix more than one effect of this type on the same objects, and the
503 * transition will apply both.
505 * @include transit_example_04.c
509 * @page transit_example_01_explained elm_transit - Basic transit usage.
510 * @dontinclude transit_example_01.c
512 * The full code for this example can be found at @ref transit_example_01_c.
514 * This example shows the simplest way of creating a transition and applying
515 * it to an object. Similarly to every other elementary example, we create a
516 * window, set its title, size, autodel property, and setup a callback to
517 * exit the program when finished:
520 * @until evas_object_resize
522 * We also add a resizeable white background to use behind our animation:
525 * @until evas_object_show
527 * And then we add a button that we will use to demonstrate the effects of
531 * @until evas_object_show(win)
533 * Notice that we are not adding the button with elm_win_resize_object_add()
534 * because we don't want the window to control the size of the button. We
535 * will use the transition to change the button size, so it could conflict
536 * with something else trying to control that size.
538 * Now, the simplest code possible to create the resize animation:
543 * As you can see, this code is very easy to understand. First, we create the
544 * transition itself with elm_transit_add(). Then we add the button to this
545 * transition with elm_transit_object_add(), which means that the transition
546 * will operate over this button. The effect that we want now is changing the
547 * object size from 100x50 to 300x150, and can be achieved by adding the
548 * resize effect with elm_transit_effect_resizing_add().
550 * Finally, we set the transition time to 5 seconds and start the transition
551 * with elm_transit_go(). If we wanted more effects applied to this
552 * button, we could add them to the same transition. See the
553 * @ref transit_example_03_c to watch many transitions being applied to an
558 * @page transit_example_02_explained elm_transit - Chained transitions.
559 * @dontinclude transit_example_02.c
561 * The full code for this example can be found at @ref transit_example_02_c.
563 * This example shows how to implement a chain of transitions. This chain is
564 * used to start a transition just after another transition ended. Similarly
565 * to every other elementary example, we create a window, set its title,
566 * size, autodel property, and setup a callback to exit the program when
570 * @until evas_object_resize
572 * We also add a resizeable white background to use behind our animation:
575 * @until evas_object_show
577 * This example will have a chain of 4 transitions, each of them applied to
578 * one button. Thus we create 4 different buttons:
581 * @until evas_object_show(bt4)
583 * Now we create a simple translation transition that will be started as soon
584 * as the program loads. It will be our first transition, and the other
585 * transitions will be started just after this transition ends:
590 * The code displayed until now has nothing different from what you have
591 * already seen in @ref transit_example_01_explained, but now comes the new
592 * part: instead of creating a second transition that will start later using
593 * a timer, we create the it normally, and use
594 * elm_transit_chain_transit_add() instead of elm_transit_go. Since we are
595 * adding it in a chain after the first transition, it will start as soon as
596 * the first transition ends:
599 * @until transit_chain_transit_add
601 * Finally we add the 2 other transitions to the chain, and run our program.
602 * It will make one transition start after the other finish, and there is the
607 * @page general_functions_example_page General (top-level) functions example
608 * @dontinclude general_funcs_example.c
610 * As told in their documentation blocks, the
611 * elm_app_compile_*_dir_set() family of functions have to be called
612 * before elm_app_info_set():
613 * @skip tell elm about
614 * @until elm_app_info_set
616 * We are here setting the fallback paths to the compiling time target
617 * paths, naturally. If you're building the example out of the
618 * project's build system, we're assuming they are the canonical ones.
620 * After the program starts, elm_app_info_set() will actually run and
621 * then you'll see an intrincasy: Elementary does the prefix lookup @b
622 * twice. This is so because of the quicklaunch infrastructure in
623 * Elementary (@ref Start), which will register a predefined prefix
624 * for possible users of the launch schema. We're not hooking into a
625 * quick launch, so this first call can't be avoided.
627 * If you ran this example from your "bindir" installation
628 * directiory, no output will emerge from these both attempts -- it
629 * will find the "magic" file there registered and set the prefixes
630 * silently. Otherwise, you could get something like:
632 WARNING: Could not determine its installed prefix for 'ELM'
633 so am falling back on the compiled in default:
635 implied by the following:
638 datadir = usr/share/elementary
639 localedir = usr/share/locale
640 Try setting the following environment variables:
641 ELM_PREFIX - points to the base prefix of install
642 or the next 4 variables
643 ELM_BIN_DIR - provide a specific binary directory
644 ELM_LIB_DIR - provide a specific library directory
645 ELM_DATA_DIR - provide a specific data directory
646 ELM_LOCALE_DIR - provide a specific locale directory
648 * if you also didn't change those environment variables (remember
649 * they are also a valid way of communicating your prefix to the
650 * binary) - this is the scenario where it fallbacks to the paths set
653 * Then, you can check the prefixes set on the standard output:
654 * @skip prefix was set to
655 * @until locale directory is
658 * @skip by using this policy
659 * @until elm_win_autodel_set
660 * we demonstrate the use of Elementary policies. The policy defining
661 * under which circunstances our application should quit automatically
662 * is set to when its last window is closed (this one has just one
663 * window, though). This will save us from having to set a callback
664 * ourselves on the window, like done in @ref bg_example_01_c "this"
665 * example. Note that we need to tell the window to delete itself's
666 * object on a request to destroy the canvas coming, with
667 * elm_win_autodel_set().
669 * What follows is some boilerplate code, creating a frame with a @b
670 * button, our object of interest, and, below, widgets to change the
671 * button's behavior and exemplify the group of functions in question.
673 * @dontinclude general_funcs_example.c
674 * We enabled the focus highlight object for this window, so that you
675 * can keep track of the current focused object better:
676 * @skip elm_win_focus_highlight_enabled_set
677 * @until evas_object_show
678 * Use the tab key to navigate through the focus chain.
680 * @dontinclude general_funcs_example.c
681 * While creating the button, we exemplify how to use Elementary's
682 * finger size information to scale our UI:
683 * @skip fprintf(stdout, "Elementary
684 * @until evas_object_show
686 * @dontinclude general_funcs_example.c
687 * The first checkbox's callback is:
690 * When unsetting the checkbox, we disable the button, which will get a new
691 * decoration (greyed out) and stop receiving events. The focus chain
692 * will also ignore it.
694 * Following, there are 2 more buttons whose actions are focus/unfocus
695 * the top button, respectively:
696 * @skip focus callback
699 * @skip unfocus callback
701 * Note the situations in which they won't take effect:
702 * - the button is not allowed to get focus or
703 * - the button is disabled
705 * The first restriction above you'll get by a second checkbox, whose
707 * @skip focus allow callback
709 * Note that the button will still get mouse events, though.
711 * Next, there's a slider controlling the button's scale:
712 * @skip scaling callback
715 * Experiment with it, so you understand the effect better. If you
716 * change its value, it will mess with the button's original size,
719 * The full code for this example can be found
720 * @ref general_functions_example_c "here".
724 * @page theme_example_01 Theme - Using extensions
726 * @dontinclude theme_example_01.c
728 * Using extensions is extremely easy, discarding the part where you have to
729 * write the theme for them.
731 * In the following example we'll be creating two buttons, one to load or
732 * unload our extension theme and one to cycle around three possible styles,
733 * one of which we created.
735 * After including our one and only header we'll jump to the callback for
736 * the buttons. First one takes care of loading or unloading our extension
737 * file, relative to the default theme set (thus the @c NULL in the
738 * functions first parameter).
739 * @skipline Elementary.h
745 * The second button, as we said before, will just switch around different
746 * styles. In this case we have three of them. The first one is our custom
747 * style, named after something very unlikely to find in the default theme.
748 * The other two styles are the standard and one more, anchor, which exists
749 * in the default and is similar to the default, except the button vanishes
750 * when the mouse is not over it.
755 * So what happens if the style switches to our custom one when the
756 * extension is loaded? Elementary falls back to the default for the
759 * And the main function, simply enough, will create the window, set the
760 * buttons and their callbacks, and just to begin with our button styled
761 * we're also loading our extension at the beginning.
765 * In this case we wanted to easily remove extensions, but all adding an
766 * extension does is tell Elementary where else it should look for themes
767 * when it can't find them in the default theme. Another way to do this
768 * is to set the theme search order using elm_theme_set(), but this requires
769 * that the developer is careful not to override any user configuration.
770 * That can be helped by adding our theme to the end of whatver is already
771 * set, like in the following snippet.
774 * snprintf(buf, sizeof(buf), "%s:./theme_example.edj", elme_theme_get(NULL);
775 * elm_theme_set(NULL, buf);
778 * If we were using overlays instead of extensions, the same thing applies,
779 * but the custom theme must be added to the front of the search path.
781 * In the end, we should be looking at something like this:
782 * @image html screenshots/theme_example_01.png
783 * @image latex screenshots/theme_example_01.eps
785 * That's all. Boringly simple, and the full code in one piece can be found
786 * @ref theme_example_01.c "here".
788 * And the code for our extension is @ref theme_example.edc "here".
790 * @example theme_example_01.c
791 * @example theme_example.edc
795 * @page theme_example_02 Theme - Using overlays
797 * @dontinclude theme_example_02.c
799 * Overlays are like extensions in that you tell Elementary that some other
800 * theme contains the styles you need for your program. The difference is that
801 * they will be look in first, so they can override the default style of any
804 * There's not much to say about them that hasn't been said in our previous
805 * example about @ref theme_example_01 "extensions", so going quickly through
806 * the code we have a function to load or unload the theme, which will be
807 * called when we click any button.
808 * @skipline Elementary.h
812 * And the main function, creating the window and adding some buttons to it.
813 * We load our theme as an overlay and nothing else. Notice there's no style
814 * set for any button there, which means they should be using the default
819 * That's pretty much it. The full code is @ref theme_example_02.c "here" and
820 * the definition of the theme is the same as before, and can be found in
821 * @ref theme_example.edc "here".
823 * @example theme_example_02.c
827 * @page button_example_01 Button - Complete example
829 * @dontinclude button_example_01.c
831 * A button is simple, you click on it and something happens. That said,
832 * we'll go through an example to show in detail the button API less
835 * In the end, we'll be presented with something that looks like this:
836 * @image html screenshots/button_01.png
837 * @image latex screenshots/button_01.eps
839 * The full code of the example is @ref button_example_01.c "here" and we
840 * will follow here with a rundown of it.
843 * @until Elementary.h
847 * We have several buttons to set different times for the autorepeat timeouts
848 * of the buttons that use it and a few more that we keep track of in our
849 * data struct. The mid button doesn't do much, just moves around according
850 * to what other buttons the user presses. Then four more buttons to move the
851 * central one, and we're also keeping track of the icon set in the middle
852 * button, since when this one moves, we change the icon, and when movement
853 * is finished (by releasing one of the four arrow buttons), we set back the
858 * Keeping any of those four buttons pressed will trigger their autorepeat
859 * callback, where we move the button doing some size hint magic. To
860 * understand how that works better, refer to the @ref Box documentation.
861 * Also, the first time the function is called, we change the icon in the
862 * middle button, using elm_button_icon_unset() first to keep the reference
863 * to the previous one, so we don't need to recreate it when we are done
867 * @until size_hint_align_set
870 * One more callback for the option buttons, that just sets the timeouts for
871 * the different autorepeat options.
878 * And the main function, which does some setting up of the buttons in boxes
879 * to make things work. Here we'll go through some snippets only.
881 * For the option buttons, it's just the button with its label and callback.
882 * @skip elm_button_add
883 * @until smart_callback_add
885 * For the ones that move the central button, we have no labels. There are
886 * icons instead, and the autorepeat option is toggled.
888 * @skip elm_button_add
889 * @until data.cursors.up
891 * And just to show the mid button, which doesn't have anything special.
892 * @skip data.cursors.left
893 * @skip elm_button_add
898 * @example button_example_01.c
902 * @page bubble_01_example_page elm_bubble - Simple use.
903 * @dontinclude bubble_example_01.c
905 * This example shows a bubble with all fields set(label, info, content and
906 * icon) and the selected corner changing when the bubble is clicked. To be
907 * able use a bubble we need to do some setup and create a window, for this
908 * example we are going to ignore that part of the code since it isn't
909 * relevant to the bubble.
911 * To have the selected corner change in a clockwise motion we are going to
912 * use the following callback:
917 * Here we are creating an elm_label that is going to be used as the content
919 * @skipline elm_label
921 * @note You could use any evas_object for this, we are using an elm_label
924 * Despite it's name the bubble's icon doesn't have to be an icon, it can be
925 * any evas_object. For this example we are going to make the icon a simple
929 * And finally we have the actual bubble creation and the setting of it's
930 * label, info and content:
933 * @note Because we didn't set a corner, the default("top_left") will be
936 * Now that we have our bubble all that is left is connecting the "clicked"
937 * signals to our callback:
938 * @line smart_callback
940 * This last bubble we created was very complete, so it's pertinent to show
941 * that most of that stuff is optional a bubble can be created with nothing
946 * Our example will look like this:
947 * @image html screenshots/bubble_example_01.png
948 * @image latex screenshots/bubble_example_01.eps
950 * See the full source code @ref bubble_example_01.c here.
951 * @example bubble_example_01.c
955 * @page box_example_01 Box - Basic API
957 * @dontinclude button_example_01.c
959 * As a special guest tonight, we have the @ref button_example_01 "simple
960 * button example". There are plenty of boxes in it, and to make the cursor
961 * buttons that moved a central one around when pressed, we had to use a
962 * variety of values for their hints.
964 * To start, let's take a look at the handling of the central button when
965 * we were moving it around. To achieve this effect without falling back to
966 * a complete manual positioning of the @c Evas_Object in our canvas, we just
967 * put it in a box and played with its alignment within it, as seen in the
968 * following snippet of the callback for the pressed buttons.
969 * @skip evas_object_size_hint_align_get
970 * @until evas_object_size_hint_align_set
972 * Not much to it. We get the current alignment of the object and change it
973 * by just a little, depending on which button was pressed, then set it
974 * again, making sure we stay within the 0.0-1.0 range so the button moves
975 * inside the space it has, instead of disappearing under the other objects.
977 * But as useful as an example as that may have been, the usual case with boxes
978 * is to set everything at the moment they are created, like we did for
979 * everything else in our main function.
981 * The entire layout of our program is made with boxes. We have one set as the
982 * resize object for the window, which means it will always be resized with
983 * the window. The weight hints set to @c EVAS_HINT_EXPAND will tell the
984 * window that the box can grow past it's minimum size, which allows resizing
988 * @until evas_object_show
990 * Two more boxes, set to horizontal, hold the buttons to change the autorepeat
991 * configuration used by the buttons. We create each to take over all the
992 * available space horizontally, but we don't want them to grow vertically,
993 * so we keep that axis of the weight with 0.0. Then it gets packed in the
996 * @until evas_object_show
998 * The buttons in each of those boxes have nothing special, they are just packed
999 * in with their default values and the box will use their minimum size, as set
1000 * by Elementary itself based on the label, icon, finger size and theme.
1002 * But the buttons used to move the central one have a special disposition.
1003 * The top one first, is placed right into the main box like our other smaller
1004 * boxes. Set to expand horizontally and not vertically, and in this case we
1005 * also tell it to fill that space, so it gets resized to take the entire
1006 * width of the window.
1008 * @skip elm_button_add
1009 * @until evas_object_show
1011 * The bottom one will be the same, but for the other two we need to use a
1012 * second box set to take as much space as we have, so we can place our side
1013 * buttons in place and have the big empty space where the central button will
1016 * @until evas_object_show
1018 * Then the buttons will have their hints inverted to the other top and bottom
1019 * ones, to expand and fill vertically and keep their minimum size horizontally.
1020 * @skip elm_button_add
1021 * @until evas_object_show
1023 * The central button takes every thing else. It will ask to be expanded in
1024 * both directions, but without filling its cell. Changing its alignment by
1025 * pressing the buttons will make it move around.
1026 * @skip elm_button_add
1027 * @until evas_object_show
1029 * To end, the rightmost button is packed in the smaller box after the central
1030 * one, and back to the main box we have the bottom button at the end.
1034 * @page box_example_02 Box - Layout transitions
1036 * @dontinclude box_example_02.c
1038 * Setting a customized layout for a box is simple once you have the layout
1039 * function, which is just like the layout function for @c Evas_Box. The new
1040 * and fancier thing we can do with Elementary is animate the transition from
1041 * one layout to the next. We'll see now how to do that through a simple
1042 * example, while also taking a look at some of the API that was left
1043 * untouched in our @ref box_example_01 "previous example".
1045 * @image html screenshots/box_example_02.png
1046 * @image latex screenshots/box_example_02.eps
1048 * @skipline Elementary.h
1050 * Our application data consists of a list of layout functions, given by
1051 * @c transitions. We'll be animating through them throughout the entire run.
1052 * The box with the stuff to move around and the last layout that was set to
1053 * make things easier in the code.
1055 * @until Transitions_Data
1057 * The box starts with three buttons, clicking on any of them will take it
1058 * out of the box without deleting the object. There are also two more buttons
1059 * outside, one to add an object to the box and the other to clear it.
1060 * This is all to show how you can interact with the items in the box, add
1061 * things and even remove them, while the transitions occur.
1063 * One of the callback we'll be using creates a new button, asks the box for
1064 * the list of its children and if it's not empty, we add the new object after
1065 * the first one, otherwise just place at the end as it will not make any
1071 * The clear button is even simpler. Everything in the box will be deleted,
1072 * leaving it empty and ready to fill it up with more stuff.
1076 * And a little function to remove buttons from the box without deleting them.
1077 * This one is set for the @c clicked callback of the original buttons,
1078 * unpacking them when clicked and placing it somewhere in the screen where
1079 * they will not disturb. Once we do this, the box no longer has any control
1080 * of it, so it will be left untouched until the program ends.
1084 * If we wanted, we could just call @c evas_object_del() on the object to
1085 * destroy it. In this case, no unpack is really necessary, as the box would
1086 * be notified of a child being deleted and adjust its calculations accordingly.
1088 * The core of the program is the following function. It takes whatever
1089 * function is first on our list of layouts and together with the
1090 * @c last_layout, it creates an ::Elm_Box_Transition to use with
1091 * elm_box_layout_transition(). In here, we tell it to start from whatever
1092 * layout we last set, end with the one that was at the top of the list and
1093 * when everything is finished, call us back so we can create another
1094 * transition. Finally, move the new layout to the end of the list so we
1095 * can continue running through them until the program ends.
1099 * The main function doesn't have antyhing special. Creation of box, initial
1100 * buttons and some callback setting. The only part worth mentioning is the
1101 * initialization of our application data.
1103 * @until evas_object_box_layout_stack
1105 * We have a simple static variable, set the box, the first layout we are
1106 * using as last and create the list with the different functions to go
1109 * And in the end, we set the first layout and call the same function we went
1110 * through before to start the run of transitions.
1111 * @until _test_box_transition_change
1113 * For the full code, follow @ref box_example_02.c "here".
1115 * @example box_example_02.c
1119 * @page calendar_example_01 Calendar - Simple creation.
1120 * @dontinclude calendar_example_01.c
1122 * As a first example, let's just display a calendar in our window,
1123 * explaining all steps required to do so.
1125 * First you should declare objects we intend to use:
1126 * @skipline Evas_Object
1128 * Then a window is created, a title is set and its set to be autodeleted.
1129 * More details can be found on windows examples:
1130 * @until elm_win_autodel
1132 * Next a simple background is placed on our windows. More details on
1133 * @ref bg_01_example_page:
1134 * @until evas_object_show(bg)
1136 * Now, the exciting part, let's add the calendar with elm_calendar_add(),
1137 * passing our window object as parent.
1138 * @until evas_object_show(cal);
1140 * To conclude our example, we should show the window and run elm mainloop:
1143 * Our example will look like this:
1144 * @image html screenshots/calendar_example_01.png
1145 * @image latex screenshots/calendar_example_01.eps
1147 * See the full source code @ref calendar_example_01.c here.
1148 * @example calendar_example_01.c
1152 * @page calendar_example_02 Calendar - Layout strings formatting.
1153 * @dontinclude calendar_example_02.c
1155 * In this simple example, we'll explain how to format the label displaying
1156 * month and year, and also set weekday names.
1158 * To format month and year label, we need to create a callback function
1159 * to create a string given the selected time, declared under a
1160 * <tt> struct tm </tt>.
1162 * <tt> struct tm </tt>, declared on @c time.h, is a structure composed by
1164 * @li tm_sec seconds [0,59]
1165 * @li tm_min minutes [0,59]
1166 * @li tm_hour hour [0,23]
1167 * @li tm_mday day of month [1,31]
1168 * @li tm_mon month of year [0,11]
1169 * @li tm_year years since 1900
1170 * @li tm_wday day of week [0,6] (Sunday = 0)
1171 * @li tm_yday day of year [0,365]
1172 * @li tm_isdst daylight savings flag
1173 * @note glib version has 2 additional fields.
1175 * For our function, only stuff that matters are tm_mon and tm_year.
1176 * But we don't need to access it directly, since there are nice functions
1177 * to format date and time, as @c strftime.
1178 * We will get abbreviated month (%b) and year (%y) (check strftime manpage
1179 * for more) in our example:
1180 * @skipline static char
1183 * We need to alloc the string to be returned, and calendar widget will
1184 * free it when it's not needed, what is done by @c strdup.
1185 * So let's register our callback to calendar object:
1186 * @skipline elm_calendar_format_function_set
1188 * To set weekday names, we should declare them as an array of strings:
1189 * @dontinclude calendar_example_02.c
1190 * @skipline weekdays
1193 * And finally set them to calendar:
1194 * skipline weekdays_names_set
1196 * Our example will look like this:
1197 * @image html screenshots/calendar_example_02.png
1198 * @image latex screenshots/calendar_example_02.eps
1200 * See the full source code @ref calendar_example_02.c here.
1201 * @example calendar_example_02.c
1205 * @page calendar_example_03 Calendar - Years restrictions.
1206 * @dontinclude calendar_example_03.c
1208 * This example explains how to set max and min year to be displayed
1209 * by a calendar object. This means that user won't be able to
1210 * see or select a date before and after selected years.
1211 * By default, limits are 1902 and maximun value will depends
1212 * on platform architecture (year 2037 for 32 bits); You can
1213 * read more about time functions on @c ctime manpage.
1215 * Straigh to the point, to set it is enough to call
1216 * elm_calendar_min_max_year_set(). First value is minimun year, second
1217 * is maximum. If first value is negative, it won't apply limit for min
1218 * year, if the second one is negative, won't apply for max year.
1219 * Setting both to negative value will clear limits (default state):
1220 * @skipline elm_calendar_min_max_year_set
1222 * Our example will look like this:
1223 * @image html screenshots/calendar_example_03.png
1224 * @image latex screenshots/calendar_example_03.eps
1226 * See the full source code @ref calendar_example_03.c here.
1227 * @example calendar_example_03.c
1231 * @page calendar_example_04 Calendar - Days selection.
1232 * @dontinclude calendar_example_04.c
1234 * It's possible to disable date selection and to select a date
1235 * from your program, and that's what we'll see on this example.
1237 * If isn't required that users could select a day on calendar,
1238 * only interacting going through months, disabling days selection
1239 * could be a good idea to avoid confusion. For that:
1240 * @skipline elm_calendar_day_selection_enabled_set
1242 * Also, regarding days selection, you could be interested to set a
1243 * date to be highlighted on calendar from your code, maybe when
1244 * a specific event happens, or after calendar creation. Let's select
1245 * two days from current day:
1246 * @dontinclude calendar_example_04.c
1247 * @skipline SECS_DAY
1248 * @skipline current_time
1249 * @until elm_calendar_selected_time_set
1251 * Our example will look like this:
1252 * @image html screenshots/calendar_example_04.png
1253 * @image latex screenshots/calendar_example_04.eps
1255 * See the full source code @ref calendar_example_04.c here.
1256 * @example calendar_example_04.c
1260 * @page calendar_example_05 Calendar - Signal callback and getters.
1261 * @dontinclude calendar_example_05.c
1263 * Most of setters explained on previous examples have associated getters.
1264 * That's the subject of this example. We'll add a callback to display
1265 * all calendar information every time user interacts with the calendar.
1267 * Let's check our callback function:
1268 * @skipline static void
1269 * @until double interval;
1271 * To get selected day, we need to call elm_calendar_selected_time_get(),
1272 * but to assure nothing wrong happened, we must check for function return.
1273 * It'll return @c EINA_FALSE if fail. Otherwise we can use time set to
1274 * our structure @p stime.
1275 * @skipline elm_calendar_selected_time_get
1278 * Next we'll get information from calendar and place on declared vars:
1279 * @skipline interval
1280 * @until elm_calendar_weekdays_names_get
1282 * The only tricky part is that last line gets an array of strings
1283 * (char arrays), one for each weekday.
1285 * Then we can simple print that to stdin:
1289 * <tt> struct tm </tt> is declared on @c time.h. You can check @c ctime
1290 * manpage to read about it.
1292 * To register this callback, that will be called every time user selects
1293 * a day or goes to next or previous month, just add a callback for signal
1295 * @skipline evas_object_smart_callback_add
1297 * Our example will look like this:
1298 * @image html screenshots/calendar_example_05.png
1299 * @image latex screenshots/calendar_example_05.eps
1301 * See the full source code @ref calendar_example_05.c here.
1302 * @example calendar_example_05.c
1306 * @page calendar_example_06 Calendar - Calendar marks.
1307 * @dontinclude calendar_example_06.c
1309 * On this example marks management will be explained. Functions
1310 * elm_calendar_mark_add(), elm_calendar_mark_del() and
1311 * elm_calendar_marks_clear() will be covered.
1313 * To add a mark, will be required to choose three things:
1315 * @li mark date, or start date if it will be repeated
1316 * @li mark periodicity
1318 * Style defines the kind of mark will be displayed over marked day,
1319 * on caledar. Default theme supports @b holiday and @b checked.
1320 * If more is required, is possible to set a new theme to calendar
1321 * widget using elm_object_style_set(), and use
1322 * the signal that will be used by such marks.
1324 * Date is a <tt> struct tm </tt>, as defined by @c time.h. More can
1325 * be read on @c ctime manpage.
1326 * If a date relative from current is required, this struct can be set
1328 * @skipline current_time
1329 * @until localtime_r
1331 * Or if it's an absolute date, you can just declare the struct like:
1332 * @dontinclude calendar_example_06.c
1334 * @until christmas.tm_mon
1336 * Periodicity is how frequently the mark will be displayed over the
1337 * calendar. Can be a unique mark (that don't repeat), or it can repeat
1338 * daily, weekly, monthly or annually. It's enumerated by
1339 * @c Elm_Calendar_Mark_Repeat.
1341 * So let's add some marks to our calendar. We will add christmas holiday,
1342 * set Sundays as holidays, and check current day and day after that.
1343 * @dontinclude calendar_example_06.c
1345 * @until christmas.tm_mon
1346 * @skipline current_time
1347 * @until ELM_CALENDAR_WEEKLY
1349 * We kept the return of first mark add, because we don't really won't it
1350 * to be checked, so let's remove it:
1351 * @skipline elm_calendar_mark_del
1353 * After all marks are added and removed, is required to draw them:
1354 * @skipline elm_calendar_marks_draw
1356 * Finally, to clear all marks, let's set a callback for our button:
1357 * @skipline elm_button_add
1358 * @until evas_object_show(bt);
1360 * This callback will receive our calendar object, and should clear it:
1361 * @dontinclude calendar_example_06.c
1364 * @note Remember to draw marks after clear the calendar.
1366 * Our example will look like this:
1367 * @image html screenshots/calendar_example_06.png
1368 * @image latex screenshots/calendar_example_06.eps
1370 * See the full source code @ref calendar_example_06.c here.
1371 * @example calendar_example_06.c
1375 * @page clock_example Clock widget example
1377 * This code places five Elementary clock widgets on a window, each of
1378 * them exemplifying a part of the widget's API.
1380 * The first of them is the pristine clock:
1381 * @dontinclude clock_example.c
1383 * @until evas_object_show
1384 * As you see, the defaults for a clock are:
1386 * - no seconds shown
1388 * For am/pm time, see the second clock:
1389 * @dontinclude clock_example.c
1391 * @until evas_object_show
1393 * The third one will show the seconds digits, which will flip in
1394 * synchrony with system time. Note, besides, that the time itself is
1395 * @b different from the system's -- it was customly set with
1396 * elm_clock_time_set():
1397 * @dontinclude clock_example.c
1398 * @skip with seconds
1399 * @until evas_object_show
1401 * In both fourth and fifth ones, we turn on the <b>edition
1402 * mode</b>. See how you can change each of the sheets on it, and be
1403 * sure to try holding the mouse pressed over one of the sheet
1404 * arrows. The forth one also starts with a custom time set:
1405 * @dontinclude clock_example.c
1407 * @until evas_object_show
1409 * The fifth, besides editable, has only the time @b units editable,
1410 * for hours, minutes and seconds. This exemplifies
1411 * elm_clock_digit_edit_set():
1412 * @dontinclude clock_example.c
1414 * @until evas_object_show
1416 * See the full @ref clock_example.c "example", whose window should
1417 * look like this picture:
1418 * @image html screenshots/clock_example.png
1419 * @image latex screenshots/clock_example.eps
1421 * See the full @ref clock_example_c "source code" for this example.
1423 * @example clock_example.c
1427 * @page flipselector_example Flip selector widget example
1429 * This code places an Elementary flip selector widget on a window,
1430 * along with two buttons trigerring actions on it (though its API).
1432 * The selector is being populated with the following items:
1433 * @dontinclude flipselector_example.c
1437 * Next, we create it, populating it with those items and registering
1438 * two (smart) callbacks on it:
1439 * @dontinclude flipselector_example.c
1440 * @skip fp = elm_flipselector_add
1441 * @until object_show
1443 * Those two callbacks will take place whenever one of those smart
1444 * events occur, and they will just print something to @c stdout:
1445 * @dontinclude flipselector_example.c
1446 * @skip underflow callback
1447 * @until static void
1448 * Flip the sheets on the widget while looking at the items list, in
1449 * the source code, and you'll get the idea of those events.
1451 * The two buttons below the flip selector will take the actions
1452 * described in their labels:
1453 * @dontinclude flipselector_example.c
1454 * @skip bt = elm_button_add
1455 * @until callback_add(win
1457 * @dontinclude flipselector_example.c
1458 * @skip unselect the item
1461 * Click on them to exercise those flip selector API calls. To
1462 * interact with the other parts of this API, there's a command line
1463 * interface, whose help string can be asked for with the 'h' key:
1464 * @dontinclude flipselector_example.c
1468 * The 'n' and 'p' keys will exemplify elm_flipselector_flip_next()
1469 * and elm_flipselector_flip_prev(), respectively. 'f' and 'l' account
1470 * for elm_flipselector_first_item_get() and
1471 * elm_flipselector_last_item_get(), respectively. Finally, 's' will
1472 * issue elm_flipselector_selected_item_get() on our example flip
1475 * See the full @ref flipselector_example.c "example", whose window should
1476 * look like this picture:
1477 * @image html screenshots/flipselector_example.png
1478 * @image latex screenshots/flipselector_example.eps
1480 * See the full @ref flipselector_example_c "source code" for this example.
1482 * @example flipselector_example.c
1486 * @page fileselector_example File selector widget example
1488 * This code places two Elementary file selector widgets on a window.
1489 * The one on the left is layouting file system items in a @b list,
1490 * while the the other is layouting them in a @b grid.
1492 * The one having the majority of hooks of interest is on the left,
1493 * which we create as follows:
1494 * @dontinclude fileselector_example.c
1495 * @skip first file selector
1496 * @until object_show
1498 * Note that we enable custom edition of file/directory selection, via
1499 * the text entry it has on its bottom, via
1500 * elm_fileselector_is_save_set(). It starts with the list view, which
1501 * is the default, and we make it not expandable in place
1502 * (elm_fileselector_expandable_set()), so that it replaces its view's
1503 * contents with the current directory's entries each time one
1504 * navigates to a different folder. For both of file selectors we are
1505 * starting to list the contents found in the @c "/tmp" directory
1506 * (elm_fileselector_path_set()).
1508 * Note the code setting it to "grid mode" and observe the differences
1509 * in the file selector's views, in the example. We also hide the
1510 * second file selector's Ok/Cancel buttons -- since it's there just
1511 * to show the grid view (and navigation) -- via
1512 * elm_fileselector_buttons_ok_cancel_set().
1514 * The @c "done" event, which triggers the callback below
1515 * @dontinclude fileselector_example.c
1518 * will be called at the time one clicks the "Ok"/"Cancel" buttons of
1519 * the file selector (on the left). Note that it will print the path
1520 * to the current selection, if any.
1522 * The @c "selected" event, which triggers the callback below
1523 * @dontinclude fileselector_example.c
1524 * @skip bt = 'selected' cb
1526 * takes place when one selects a file (if the file selector is @b not
1527 * under folders-only mode) or when one selects a folder (when in
1528 * folders-only mode). Experiment it by selecting different file
1531 * What comes next is the code creating the three check boxes and two
1532 * buttons below the file selector in the right. They will exercise a
1533 * bunch of functions on the file selector's API, for the instance on
1534 * the left. Experiment with them, specially the buttons, to get the
1535 * difference between elm_fileselector_path_get() and
1536 * elm_fileselector_selected_get().
1538 * Finally, there's the code adding the second file selector, on the
1540 * @dontinclude fileselector_example.c
1541 * @skip second file selector
1542 * @until object_show
1544 * Pay attention to the code setting it to "grid mode" and observe the
1545 * differences in the file selector's views, in the example. We also
1546 * hide the second file selector's Ok/Cancel buttons -- since it's
1547 * there just to show the grid view (and navigation) -- via
1548 * elm_fileselector_buttons_ok_cancel_set().
1550 * See the full @ref fileselector_example.c "example", whose window
1551 * should look like this picture:
1552 * @image html screenshots/fileselector_example.png
1553 * @image latex screenshots/fileselector_example.eps
1555 * See the full @ref fileselector_example_c "source code" for this example.
1557 * @example fileselector_example.c
1561 * @page fileselector_button_example File selector button widget example
1563 * This code places an Elementary file selector button widget on a
1564 * window, along with some other checkboxes and a text entry. Those
1565 * are there just as knobs on the file selector button's state and to
1566 * display information from it.
1568 * Here's how we instantiate it:
1569 * @dontinclude fileselector_button_example.c
1570 * @skip ic = elm_icon_add
1571 * @until evas_object_show
1573 * Note that we set on it both icon and label decorations. It's set to
1574 * list the contents of the @c "/tmp" directory, too, with
1575 * elm_fileselector_button_path_set(). What follows are checkboxes to
1576 * exercise some of its API funtions:
1577 * @dontinclude fileselector_button_example.c
1578 * @skip ck = elm_check_add
1579 * @until evas_object_show(en)
1581 * The checkboxes will toggle whether the file selector button's
1582 * internal file selector:
1583 * - must have an editable text entry for file names (thus, be in
1584 * "save dialog mode")
1585 * - is to be raised as an "inner window" (note it's the default
1586 * behavior) or as a dedicated window
1587 * - is to populate its view with folders only
1588 * - is to expand its folders, in its view, <b>in place</b>, and not
1589 * repainting it entirely just with the contents of a sole
1592 * The entry labeled @c "Last selection" will exercise the @c
1593 * "file,chosen" smart event coming from the file selector button:
1594 * @dontinclude fileselector_button_example.c
1596 * @until toggle inwin
1598 * Whenever you dismiss or acknowledges the file selector, after it's
1599 * raised, the @c event_info string will contain the last selection on
1600 * it (if any was made).
1602 * This is how the example, just after called, should look like:
1603 * @image html screenshots/fileselector_button_example_00.png
1604 * @image latex screenshots/fileselector_button_example_00.eps
1606 * Click on the file selector button to raise its internal file
1607 * selector, which will be contained on an <b>"inner window"</b>:
1608 * @image html screenshots/fileselector_button_example_01.png
1609 * @image latex screenshots/fileselector_button_example_01.eps
1611 * Toggle the "inwin mode" switch off and, if you click on the file
1612 * selector button again, you'll get @b two windows, the original one
1613 * (note the last selection there!)
1614 * @image html screenshots/fileselector_button_example_02.png
1615 * @image latex screenshots/fileselector_button_example_02.eps
1616 * and the file selector's new one
1617 * @image html screenshots/fileselector_button_example_03.png
1618 * @image latex screenshots/fileselector_button_example_03.eps
1620 * Play with the checkboxes to get the behavior changes on the file
1621 * selector button. The respective API calls on the widget coming from
1622 * those knobs where shown in the code already.
1624 * See the full @ref fileselector_button_example_c "source code" for
1627 * @example fileselector_button_example.c
1631 * @page fileselector_entry_example File selector entry widget example
1633 * This code places an Elementary file selector entry widget on a
1634 * window, along with some other checkboxes. Those are there just as
1635 * knobs on the file selector entry's state.
1637 * Here's how we instantiate it:
1638 * @dontinclude fileselector_entry_example.c
1639 * @skip ic = elm_icon_add
1640 * @until evas_object_show
1642 * Note that we set on it's button both icon and label
1643 * decorations. It's set to exhibit the path of (and list the contents
1644 * of, when internal file selector is launched) the @c "/tmp"
1645 * directory, also, with elm_fileselector_entry_path_set(). What
1646 * follows are checkboxes to exercise some of its API funtions:
1647 * @dontinclude fileselector_entry_example.c
1648 * @skip ck = elm_check_add
1649 * @until callback_add(fs_entry
1651 * The checkboxes will toggle whether the file selector entry's
1652 * internal file selector:
1653 * - must have an editable text entry for file names (thus, be in
1654 * "save dialog mode")
1655 * - is to be raised as an "inner window" (note it's the default
1656 * behavior) or as a dedicated window
1657 * - is to populate its view with folders only
1658 * - is to expand its folders, in its view, <b>in place</b>, and not
1659 * repainting it entirely just with the contents of a sole
1662 * Observe how the entry's text will match the string coming from the
1663 * @c "file,chosen" smart event:
1664 * @dontinclude fileselector_entry_example.c
1667 * Whenever you dismiss or acknowledges the file selector, after it's
1668 * raised, the @c event_info string will contain the last selection on
1669 * it (if any was made).
1671 * Try, also, to type in a valid system path and, then, open the file
1672 * selector's window: it will start the file browsing there, for you.
1674 * This is how the example, just after called, should look like:
1675 * @image html screenshots/fileselector_entry_example_00.png
1676 * @image latex screenshots/fileselector_entry_example_00.eps
1678 * Click on the file selector entry to raise its internal file
1679 * selector, which will be contained on an <b>"inner window"</b>:
1680 * @image html screenshots/fileselector_entry_example_01.png
1681 * @image latex screenshots/fileselector_entry_example_01.eps
1683 * Toggle the "inwin mode" switch off and, if you click on the file
1684 * selector entry again, you'll get @b two windows, the original one
1685 * (note the last selection there!)
1686 * @image html screenshots/fileselector_entry_example_02.png
1687 * @image latex screenshots/fileselector_entry_example_02.eps
1688 * and the file selector's new one
1689 * @image html screenshots/fileselector_entry_example_03.png
1690 * @image latex screenshots/fileselector_entry_example_03.eps
1692 * Play with the checkboxes to get the behavior changes on the file
1693 * selector entry. The respective API calls on the widget coming from
1694 * those knobs where shown in the code already.
1696 * See the full @ref fileselector_entry_example_c "source code" for
1699 * @example fileselector_entry_example.c
1703 * @page tutorial_hover Hover example
1704 * @dontinclude hover_example_01.c
1706 * On this example we are going to have a button that when clicked will show our
1707 * hover widget, this hover will have content set on it's left, top, right and
1708 * middle positions. In the middle position we are placing a button that when
1709 * clicked will hide the hover. We are also going to use a non-default theme
1710 * for our hover. We won't explain the functioning of button for that see @ref
1713 * We start our example with a couple of callbacks that show and hide the data
1714 * they're given(which we'll see later on is the hover widget):
1719 * In our main function we'll do some initialization and then create 3
1720 * rectangles, one red, one green and one blue to use in our hover. We'll also
1721 * create the 2 buttons that will show and hide the hover:
1724 * With all of that squared away we can now get to the heart of the matter,
1725 * creating our hover widget, which is easy as pie:
1728 * Having created our hover we now need to set the parent and target. Which if
1729 * you recall from the function documentations are going to tell the hover which
1730 * area it should cover and where it should be centered:
1733 * Now we set the theme for our hover. We're using the popout theme which gives
1734 * our contents a white background and causes their appearance to be animated:
1737 * And finally we set the content for our positions:
1740 * So far so good? Great 'cause that's all there is too it, what is left now is
1741 * just connecting our buttons to the callbacks we defined at the beginning of
1742 * the example and run the main loop:
1745 * Our example will initially look like this:
1746 * @image html screenshots/hover_example_01.png
1747 * @image latex screenshots/hover_example_01.eps
1749 * And after you click the "Show hover" button it will look like this:
1750 * @image html screenshots/hover_example_01_a.png
1751 * @image latex screenshots/hover_example_01_a.eps
1753 * @example hover_example_01.c
1757 * @page tutorial_flip Flip example
1758 * @dontinclude flip_example_01.c
1760 * This example will show a flip with two rectangles on it(one blue, one
1761 * green). Our example will allow the user to choose the animation the flip
1762 * uses and to interact with it. To allow the user to choose the interaction
1763 * mode we use radio buttons, we will however not explain them, if you would
1764 * like to know more about radio buttons see @ref radio.
1766 * We start our example with the usual setup and then create the 2 rectangles
1767 * we will use in our flip:
1768 * @until show(rect2)
1770 * The next thing to do is to create our flip and set it's front and back
1774 * The next thing we do is set the interaction mode(which the user can later
1775 * change) to the page animation:
1778 * Setting a interaction mode however is not sufficient, we also need to
1779 * choose which directions we allow interaction from, for this example we
1780 * will use all of them:
1783 * We are also going to set the hitsize to the entire flip(in all directions)
1784 * to make our flip very easy to interact with:
1787 * After that we create our radio buttons and start the main loop:
1790 * When the user clicks a radio button a function that changes the
1791 * interaction mode and animates the flip is called:
1793 * @note The elm_flip_go() call here serves no purpose other than to
1794 * ilustrate that it's possible to animate the flip programmatically.
1796 * Our example will look like this:
1797 * @image html screenshots/flip_example_01.png
1798 * @image latex screenshots/flip_example_01.eps
1799 * @note Since this is an animated example the screenshot doesn't do it
1800 * justice, it is a good idea to compile it and see the animations.
1802 * @example flip_example_01.c
1806 * @page tutorial_label Label example
1807 * @dontinclude label_example_01.c
1809 * In this example we are going to create 6 labels, set some properties on
1810 * them and see what changes in appearance those properties cause.
1812 * We start with the setup code that by now you should be familiar with:
1815 * For our first label we have a moderately long text(that doesn't fit in the
1816 * label's width) so we will make it a sliding label. Since the text isn't
1817 * too long we don't need the animation to be very long, 3 seconds should
1818 * give us a nice speed:
1821 * For our second label we have the same text, but this time we aren't going
1822 * to have it slide, we're going to ellipsize it. Because we ask our label
1823 * widget to ellipsize the text it will first diminsh the fontsize so that it
1824 * can show as much of the text as possible:
1827 * For the third label we are going to ellipsize the text again, however this
1828 * time to make sure the fontsize isn't diminshed we will set a line wrap.
1829 * The wrap won't actually cause a line break because we set the label to
1833 * For our fourth label we will set line wrapping but won't set ellipsis, so
1834 * that our text will indeed be wrapped instead of ellipsized. For this label
1835 * we choose character wrap:
1838 * Just two more, for our fifth label we do the same as for the fourth
1839 * except we set the wrap to word:
1842 * And last but not least for our sixth label we set the style to "marker" and
1843 * the color to red(the default color is white which would be hard to see on
1844 * our white background):
1847 * Our example will look like this:
1848 * @image html screenshots/label_example_01.png
1849 * @image latex screenshots/label_example_01.eps
1851 * @example label_example_01.c
1855 * @page tutorial_image Image example
1856 * @dontinclude image_example_01.c
1858 * This example is as simple as possible. An image object will be added to the
1859 * window over a white background, and set to be resizeable together with the
1860 * window. All the options set through the example will affect the behavior of
1863 * We start with the code for creating a window and its background, and also
1864 * add the code to write the path to the image that will be loaded:
1869 * Now we create the image object, and set that file to be loaded:
1873 * We can now go setting our options.
1875 * elm_image_no_scale_set() is used just to set this value to true (we
1876 * don't want to scale our image anyway, just resize it).
1878 * elm_image_scale_set() is used to allow the image to be resized to a size
1879 * smaller than the original one, but not to a size bigger than it.
1881 * elm_elm_image_smooth_set() will disable the smooth scaling, so the scale
1882 * algorithm used to scale the image to the new object size is going to be
1883 * faster, but with a lower quality.
1885 * elm_image_orient_set() is used to flip the image around the (1, 0) (0, 1)
1888 * elm_image_aspect_ratio_retained_set() is used to keep the original aspect
1889 * ratio of the image, even when the window is resized to another aspect ratio.
1891 * elm_image_fill_outside_set() is used to ensure that the image will fill the
1892 * entire area available to it, even if keeping the aspect ratio. The image
1893 * will overflow its width or height (any of them that is necessary) to the
1894 * object area, instead of resizing the image down until it can fit entirely in
1897 * elm_image_editable_set() is used just to cover the API, but won't affect
1898 * this example since we are not using any copy & paste property.
1900 * This is the code for setting these options:
1904 * Now some last touches in our object size hints, window and background, to
1905 * display this image properly:
1909 * This example will look like this:
1911 * @image html screenshots/image_example_01.png
1912 * @image latex screenshots/image_example_01.eps
1914 * @example image_example_01.c
1918 * @page tutorial_hoversel Hoversel example
1919 * @dontinclude hoversel_example_01.c
1921 * In this example we will create a hoversel with 3 items, one with a label but
1922 * no icon and two with both a label and an icon. Every item that is clicked
1923 * will be deleted, but everytime the hoversel is activated we will also add an
1924 * item. In addition our first item will print all items when clicked and our
1925 * third item will clear all items in the hoversel.
1927 * We will start with the normal creation of window stuff:
1930 * Next we will create a red rectangle to use as the icon of our hoversel:
1933 * And now we create our hoversel and set some of it's properties. We set @p win
1934 * as its parent, ask it to not be horizontal(be vertical) and give it a label
1938 * Next we will add our three items, setting a callback to be called for the
1942 * We also set a pair of callbacks to be called whenever any item is selected or
1943 * when the hoversel is activated:
1946 * And then ask that our hoversel be shown and run the main loop:
1949 * We now have the callback for our first item which prints all items in the
1953 * Next we have the callback for our third item which removes all items from the
1957 * Next we have the callback that is called whenever an item is clicked and
1958 * deletes that item:
1961 * And the callback that is called when the hoversel is activated and adds an
1962 * item to the hoversel. Note that since we allocate memory for the item we need
1963 * to know when the item dies so we can free that memory:
1966 * And finally the callback that frees the memory we allocated for items created
1967 * in the @p _add_item callback:
1970 * Our example will initially look like this:
1971 * @image html screenshots/hoversel_example_01.png
1972 * @image latex screenshots/hoversel_example_01.eps
1974 * And when the hoversel is clicked it will look like this:
1975 * @image html screenshots/hoversel_example_01_a.png
1976 * @image latex screenshots/hoversel_example_01_a.eps
1978 * @example hoversel_example_01.c
1982 * @page bg_example_01_c bg_example_01.c
1983 * @include bg_example_01.c
1984 * @example bg_example_01.c
1988 * @page bg_example_02_c bg_example_02.c
1989 * @include bg_example_02.c
1990 * @example bg_example_02.c
1994 * @page bg_example_03_c bg_example_03.c
1995 * @include bg_example_03.c
1996 * @example bg_example_03.c
2000 * @page actionslider_example_01 Actionslider example
2001 * @include actionslider_example_01.c
2002 * @example actionslider_example_01.c
2006 * @page animator_example_01_c Animator example 01
2007 * @include animator_example_01.c
2008 * @example animator_example_01.c
2012 * @page transit_example_01_c Transit example 1
2013 * @include transit_example_01.c
2014 * @example transit_example_01.c
2018 * @page transit_example_02_c Transit example 2
2019 * @include transit_example_02.c
2020 * @example transit_example_02.c
2024 * @page general_functions_example_c General (top-level) functions example
2025 * @include general_funcs_example.c
2026 * @example general_funcs_example.c
2030 * @page clock_example_c Clock example
2031 * @include clock_example.c
2032 * @example clock_example.c
2036 * @page flipselector_example_c Flipselector example
2037 * @include flipselector_example.c
2038 * @example flipselector_example.c
2042 * @page fileselector_example_c Fileselector example
2043 * @include fileselector_example.c
2044 * @example fileselector_example.c
2048 * @page fileselector_button_example_c Fileselector button example
2049 * @include fileselector_button_example.c
2050 * @example fileselector_button_example.c
2054 * @page fileselector_entry_example_c Fileselector entry example
2055 * @include fileselector_entry_example.c
2056 * @example fileselector_entry_example.c