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 diskselector_example_01
38 * @ref diskselector_example_02
40 * @ref flipselector_example
42 * @ref fileselector_example
44 * @ref fileselector_button_example
46 * @ref fileselector_entry_example
48 * @ref index_example_01
50 * @ref index_example_02
54 * @page bg_01_example_page elm_bg - Plain color background.
55 * @dontinclude bg_example_01.c
57 * The full code for this example can be found at @ref bg_example_01_c,
58 * in the function @c test_bg_plain. It's part of the @c elementar_test
59 * suite, and thus has the code for the three examples referenced by this
62 * This first example just sets a default background with a plain color. The
63 * first part consists of creating an Elementary window. It's the common
64 * piece of code that you'll see everywhere in Elementary: @skip elm_main
67 * Now we really create our background object, using the window object as
72 * Then we set the size hints of the background object so that it will use
73 * all space available for it, and then add it as a resize object to the
74 * window, making it visible in the end:
76 * @skip size_hint_weight_set
77 * @until resize_object_add
79 * See @ref evas_object_size_hint_weight_set and elm_win_resize_object_add()
80 * for more detailed info about these functions.
82 * The end of the example is quite simple, just setting the minimum and
83 * maximum size of the background, so the Elementary window knows that it
84 * has to have at least the minimum size. The background also won't scale to
85 * a size above its maximum. Then we resize the window and show it in the
88 * @skip set size hints
91 * And here we finish our very simple background object usage example.
95 * @page bg_02_example_page elm_bg - Image background.
96 * @dontinclude bg_example_02.c
98 * The full code for this example can be found at @ref bg_example_02_c,
99 * in the function @c test_bg_image. It's part of the @c elementar_test
100 * suite, and thus has the code for the three examples referenced by this
103 * This is the second example, and shows how to use the Elementary
104 * background object to set an image as background of your application.
106 * We start this example exactly in the same way as the previous one, even
107 * when creating the background object:
112 * Now it's the different part.
114 * Our background will have an image, that will be displayed over the
115 * background color. Before loading the image, we set the load size of the
116 * image. The load size is a hint about the size that we want the image
117 * displayed in the screen. It's not the exact size that the image will have,
118 * but usually a bit bigger. The background object can still be scaled to a
119 * size bigger than the one set here. Setting the image load size to
120 * something smaller than its real size will reduce the memory used to keep
121 * the pixmap representation of the image, and the time to load it. Here we
122 * set the load size to 20x20 pixels, but the image is loaded with a size
123 * bigger than that (since it's just a hint):
125 * @skipline load_size_set
127 * And set our background image to be centered, instead of stretched or
128 * scaled, so the effect of the elm_bg_load_size_set() can be easily
131 * @skipline option_set
133 * We need a filename to set, so we get one from the previous installed
134 * images in the @c PACKAGE_DATA_DIR, and write its full path to a buffer.
135 * Then we use this buffer to set the filename in the background object:
140 * Notice that the third argument of the elm_bg_file_set() function is @c
141 * NULL, since we are setting an image to this background. This function
142 * also supports setting an edje group as background, in which case the @c
143 * group parameter wouldn't be @c NULL, but be the name of the group
146 * Finally, we can set the size hints, add the background as a resize
147 * object, and resize the window, exactly the same thing we do in the @ref
148 * bg_01_example_page example:
153 * And this is the end of this example.
155 * This example will look like this:
157 * @image html screenshots/bg_01.png
158 * @image latex screenshots/bg_01.eps width=\textwidth
162 * @page bg_03_example_page elm_bg - Background properties.
163 * @dontinclude bg_example_03.c
165 * The full code for this example can be found at @ref bg_example_03_c, in the
166 * function @c test_bg_options, with the callbacks @c _cb_overlay_changed, @c
167 * _cb_color_changed and @c _cb_radio_changed defined in the beginning of the
168 * file. It's part of the @c elementar_test suite, and thus has the code for
169 * the three examples referenced by this documentation.
171 * This example will show the properties available for the background object,
172 * and will use of some more widgets to set them.
174 * In order to do this, we will set some callbacks for these widgets. The
175 * first is for the radio buttons that will be used to choose the option
176 * passed as argument to elm_bg_option_set():
178 * @skip _cb_radio_changed
181 * The next callback will be used when setting the overlay (using
182 * elm_bg_overlay_set()):
184 * @skip _cb_overlay_changed
188 * And the last one, used to set the color (with elm_bg_color_set()):
190 * @skip _cb_color_changed
193 * We will get back to what these functions do soon. If you want to know more
194 * about how to set these callbacks and what these widgets are, look for:
195 * @li elm_radio_add()
196 * @li elm_check_add()
197 * @li elm_spinner_add()
199 * Now going to the main function, @c test_bg_options, we have the common
200 * code with the other examples:
205 * We add a plain background to this window, so it will have the default
206 * background color behind everything:
208 * @skip bg = elm_bg_add
209 * @until evas_object_show(bg)
211 * Then we add a vertical box (elm_box_add()) that will hold the background
212 * object that we are going to play with, as well as a horizontal box that
216 * @until evas_object_show
218 * Now we add the background object that is going to be of use for our
219 * example. It is an image background, as used in @ref bg_02_example_page ,
220 * so the code should be familiar:
223 * @until evas_object_show
225 * Notice the call to elm_box_pack_end(): it will pack the background object
226 * in the end of the Elementary box declared above. Just refer to that
227 * documentation for more info.
229 * Since this Elementary background is already an image background, we are
230 * going to play with its other properties. We will change its option
231 * (CENTER, SCALE, STRETCH, TILE), its color (RGB), and add an overlay to it.
232 * For all of these properties, we are going to add widgets that will
235 * First, lets add the horizontal box that will hold these widgets:
239 * For now, just consider this @c hbox as a rectangle that will contain the
240 * widgets, and will distribute them horizontally inside its content. Then we
241 * add radio buttons that will allow us to choose the property to use with
245 * @until evas_object_show
247 * Again, I won't give details about the use of these widgets, just look for
248 * their documentation if necessary. It's enough to know for now that we are
249 * packing them in the @c hbox, setting a label for them, and the most
250 * important parts: setting its value to @c ELM_BG_OPTION_CENTER and its
251 * callback to @c _cb_radio_changed (the function defined in the beginning of
252 * this example). We do this for the next 3 radio buttons added after this
253 * one, each of them with a different value.
255 * Now taking a look at the code of the callback @c _cb_radio_changed again,
256 * it will call elm_bg_option_set() with the value set from the checked radio
257 * button, thus setting the option for this background. The background is
258 * passed as argument to the @p data parameter of this callback, and is
259 * referenced here as @c o_bg.
261 * Later we set the default value for this radio button:
263 * @skipline elm_radio_value_set
265 * Then we add a checkbox for the elm_bg_overlay_set() function:
268 * @until evas_object_show
270 * Now look at the code of the @c _cb_overlay_changed again. If the checkbox
271 * state is checked, an overlay will be added to the background. It's done by
272 * creating an Edje object, and setting it with elm_bg_overlay_set() to the
273 * background object. For information about what are and how to set Edje
274 * object, look at the Edje documentation.
276 * Finally we add a spinner object (elm_spinner_add()) to be used to select
277 * the color of our background. In its callback it's possible to see the call
278 * to elm_bg_color_set(), which will change the color of this background.
279 * This color is used by the background to fill areas where the image doesn't
280 * cover (in this case, where we have an image background). The spinner is
281 * also packed into the @c hbox :
283 * @skip elm_spinner_add
284 * @until evas_object_show
286 * Then we just have to pack the @c hbox inside the @c box, set some size
287 * hints, and show our window:
292 * Now to see this code in action, open elementary_test, and go to the "Bg
293 * Options" test. It should demonstrate what was implemented here.
297 * @page actionslider_example_page Actionslider usage
298 * @dontinclude actionslider_example_01.c
300 * For this example we are going to assume knowledge of evas smart callbacks
301 * and some basic evas object functions. Elementary is not meant to be used
302 * without evas, if you're not yet familiar with evas it probably is worth
305 * And now to the example, when using Elementary we start by including
309 * Next we define some callbacks, they all share the same signature because
310 * they are all to be used with evas_object_smart_callback_add().
311 * The first one just prints the selected label(in two different ways):
314 * This next callback is a little more interesting, it makes the selected
315 * label magnetic(except if it's the center label):
318 * This callback enables or disables the magnetic propertty of the center
322 * And finally a callback to stop the main loop when the window is closed:
325 * To be able to create our actionsliders we need to do some setup, but this
326 * isn't really relevant here, so if you want to know about that go @ref
329 * With all that boring stuff out of the way we can proceed to creating some
331 * All actionsliders are created the same way:
332 * @skipline actionslider_add
333 * Next we must choose where the indicator starts, and for this one we choose
334 * the right, and set the right as magnetic:
335 * @skipline indicator_pos_set
336 * @until magnet_pos_set
338 * We then set the labels for the left and right, passing NULL as an argument
339 * to any of the labels makes that position have no label.
342 * Furthermore we mark both left and right as enabled positions, if we didn't
343 * do this all three positions would be enabled:
346 * Having the the enabled positions we now add a smart callback to change
347 * which position is magnetic, so that only the last selected position is
351 * And finally we set our printing callback and show the actionslider:
355 * For our next actionslider we are going to do much as we did for the
356 * previous except we are going to have the center as the magnet(and not
358 * @skipline actionslider_add
359 * @skipline indicator_pos_set
362 * And another actionslider, in this one the indicator starts on the left.
363 * It has labels only in the center and right, and both bositions are
364 * magnetic. Because the left doesn't have a label and is not magnetic once
365 * the indicator leaves it can't return:
366 * @skipline actionslider_add
367 * @skipline indicator_pos_set
369 * @note The greyed out area is a @ref Styles "style".
371 * And now an actionslider with a label in the indicator, and whose magnet
372 * properties change based on what was last selected:
373 * @skipline actionslider_add
374 * @skipline indicator_pos_set
376 * @note The greyed out area is a @ref Styles "style".
378 * We are almost done, this next one is just an actionslider with all
379 * positions magnetized and having every possible label:
380 * @skipline actionslider_add
381 * @skipline indicator_pos_set
384 * And for our last actionslider we have one that turns the magnetic property
386 * @skipline actionslider_add
387 * @skipline indicator_pos_set
390 * The example will look like this:
392 * @image html screenshots/actionslider_01.png
393 * @image latex screenshots/actionslider_01.eps width=\textwidth
395 * See the full source code @ref actionslider_example_01 "here"
399 * @page elm_animator_example_page_01 Animator usage
400 * @dontinclude animator_example_01.c
402 * For this example we will be using a bit of evas, you could animate a
403 * elementary widget in much the same way, but to keep things simple we use
404 * an evas_object_rectangle.
406 * As every other example we start with our include and a simple callback to
407 * exit the app when the window is closed:
411 * This next callback is the one that actually creates our animation, it
412 * changes the size, position and color of a rectangle given to it in @a
416 * Next we have a callback that prints a string, nothing special:
419 * This next callback is a little more interesting, it has a state variable
420 * to know if the animation is currently paused or running, and it toogles
421 * the state of the animation accordingly:
426 * Finally we have a callback to stop the animation:
429 * As with every example we need to do a bit of setup before we can actually
430 * use an animation, but for the purposes of this example that's not relevant
431 * so let's just skip to the good stuff, creating an animator:
432 * @skipline animator_add
433 * @note Since elm_animator is not a widget we can give it a NULL parent.
435 * Now that we have an elm_animator we set it's duration to 1 second:
438 * We would also like our animation to be reversible, so:
441 * We also set our animation to repeat as many times as possible, which will
442 * mean that _end_cb will only be called after UINT_MAX * 2 seconds(UINT_MAX
443 * for the animation running forward and UNIT_MAX for the animation running
447 * To add some fun to our animation we will use the IN_OUT curve style:
450 * To actually animate anything we need an operation callback:
451 * @line operation_callback
453 * Even though we set our animation to repeat for a very long time we are
454 * going to set a end callback to it:
455 * @line completion_callback
456 * @note Notice that stoping the animation with the stop button will not make
459 * Now that we have fully set up our animator we can tell it to start
463 * There's a bit more of code that doesn't really matter to use so we skip
464 * right down to our last interesting point:
465 * @skipline animator_del
466 * @note Because we created our animator with no parent we need to delete it
469 * The example should look like this:
471 * @image html screenshots/animator_example_01.png
472 * @image latex screenshots/animator_example_01.eps width=\textwidth
474 * @image html screenshots/animator_example_02.png
475 * @image latex screenshots/animator_example_02.eps width=\textwidth
477 * @image html screenshots/animator_example_03.png
478 * @image latex screenshots/animator_example_03.eps width=\textwidth
480 * The full source code for this example can be found @ref
481 * animator_example_01_c "here"
485 * @page transit_example_03_c elm_transit - Combined effects and options.
487 * This example shows how to apply the following transition effects:
495 * It allows you to apply more than one effect at once, and also allows to
496 * set properties like event_enabled, auto_reverse, repeat_times and
499 * @include transit_example_03.c
503 * @page transit_example_04_c elm_transit - Combined effects over two objects.
505 * This example shows how to apply the transition effects:
510 * over two objects. This kind of transition effect is used to make one
511 * object disappear and another one appear on its place.
513 * You can mix more than one effect of this type on the same objects, and the
514 * transition will apply both.
516 * @include transit_example_04.c
520 * @page transit_example_01_explained elm_transit - Basic transit usage.
521 * @dontinclude transit_example_01.c
523 * The full code for this example can be found at @ref transit_example_01_c.
525 * This example shows the simplest way of creating a transition and applying
526 * it to an object. Similarly to every other elementary example, we create a
527 * window, set its title, size, autodel property, and setup a callback to
528 * exit the program when finished:
531 * @until evas_object_resize
533 * We also add a resizeable white background to use behind our animation:
536 * @until evas_object_show
538 * And then we add a button that we will use to demonstrate the effects of
542 * @until evas_object_show(win)
544 * Notice that we are not adding the button with elm_win_resize_object_add()
545 * because we don't want the window to control the size of the button. We
546 * will use the transition to change the button size, so it could conflict
547 * with something else trying to control that size.
549 * Now, the simplest code possible to create the resize animation:
554 * As you can see, this code is very easy to understand. First, we create the
555 * transition itself with elm_transit_add(). Then we add the button to this
556 * transition with elm_transit_object_add(), which means that the transition
557 * will operate over this button. The effect that we want now is changing the
558 * object size from 100x50 to 300x150, and can be achieved by adding the
559 * resize effect with elm_transit_effect_resizing_add().
561 * Finally, we set the transition time to 5 seconds and start the transition
562 * with elm_transit_go(). If we wanted more effects applied to this
563 * button, we could add them to the same transition. See the
564 * @ref transit_example_03_c to watch many transitions being applied to an
569 * @page transit_example_02_explained elm_transit - Chained transitions.
570 * @dontinclude transit_example_02.c
572 * The full code for this example can be found at @ref transit_example_02_c.
574 * This example shows how to implement a chain of transitions. This chain is
575 * used to start a transition just after another transition ended. Similarly
576 * to every other elementary example, we create a window, set its title,
577 * size, autodel property, and setup a callback to exit the program when
581 * @until evas_object_resize
583 * We also add a resizeable white background to use behind our animation:
586 * @until evas_object_show
588 * This example will have a chain of 4 transitions, each of them applied to
589 * one button. Thus we create 4 different buttons:
592 * @until evas_object_show(bt4)
594 * Now we create a simple translation transition that will be started as soon
595 * as the program loads. It will be our first transition, and the other
596 * transitions will be started just after this transition ends:
601 * The code displayed until now has nothing different from what you have
602 * already seen in @ref transit_example_01_explained, but now comes the new
603 * part: instead of creating a second transition that will start later using
604 * a timer, we create the it normally, and use
605 * elm_transit_chain_transit_add() instead of elm_transit_go. Since we are
606 * adding it in a chain after the first transition, it will start as soon as
607 * the first transition ends:
610 * @until transit_chain_transit_add
612 * Finally we add the 2 other transitions to the chain, and run our program.
613 * It will make one transition start after the other finish, and there is the
618 * @page general_functions_example_page General (top-level) functions example
619 * @dontinclude general_funcs_example.c
621 * As told in their documentation blocks, the
622 * elm_app_compile_*_dir_set() family of functions have to be called
623 * before elm_app_info_set():
624 * @skip tell elm about
625 * @until elm_app_info_set
627 * We are here setting the fallback paths to the compiling time target
628 * paths, naturally. If you're building the example out of the
629 * project's build system, we're assuming they are the canonical ones.
631 * After the program starts, elm_app_info_set() will actually run and
632 * then you'll see an intrincasy: Elementary does the prefix lookup @b
633 * twice. This is so because of the quicklaunch infrastructure in
634 * Elementary (@ref Start), which will register a predefined prefix
635 * for possible users of the launch schema. We're not hooking into a
636 * quick launch, so this first call can't be avoided.
638 * If you ran this example from your "bindir" installation
639 * directiory, no output will emerge from these both attempts -- it
640 * will find the "magic" file there registered and set the prefixes
641 * silently. Otherwise, you could get something like:
643 WARNING: Could not determine its installed prefix for 'ELM'
644 so am falling back on the compiled in default:
646 implied by the following:
649 datadir = usr/share/elementary
650 localedir = usr/share/locale
651 Try setting the following environment variables:
652 ELM_PREFIX - points to the base prefix of install
653 or the next 4 variables
654 ELM_BIN_DIR - provide a specific binary directory
655 ELM_LIB_DIR - provide a specific library directory
656 ELM_DATA_DIR - provide a specific data directory
657 ELM_LOCALE_DIR - provide a specific locale directory
659 * if you also didn't change those environment variables (remember
660 * they are also a valid way of communicating your prefix to the
661 * binary) - this is the scenario where it fallbacks to the paths set
664 * Then, you can check the prefixes set on the standard output:
665 * @skip prefix was set to
666 * @until locale directory is
669 * @skip by using this policy
670 * @until elm_win_autodel_set
671 * we demonstrate the use of Elementary policies. The policy defining
672 * under which circunstances our application should quit automatically
673 * is set to when its last window is closed (this one has just one
674 * window, though). This will save us from having to set a callback
675 * ourselves on the window, like done in @ref bg_example_01_c "this"
676 * example. Note that we need to tell the window to delete itself's
677 * object on a request to destroy the canvas coming, with
678 * elm_win_autodel_set().
680 * What follows is some boilerplate code, creating a frame with a @b
681 * button, our object of interest, and, below, widgets to change the
682 * button's behavior and exemplify the group of functions in question.
684 * @dontinclude general_funcs_example.c
685 * We enabled the focus highlight object for this window, so that you
686 * can keep track of the current focused object better:
687 * @skip elm_win_focus_highlight_enabled_set
688 * @until evas_object_show
689 * Use the tab key to navigate through the focus chain.
691 * @dontinclude general_funcs_example.c
692 * While creating the button, we exemplify how to use Elementary's
693 * finger size information to scale our UI:
694 * @skip fprintf(stdout, "Elementary
695 * @until evas_object_show
697 * @dontinclude general_funcs_example.c
698 * The first checkbox's callback is:
701 * When unsetting the checkbox, we disable the button, which will get a new
702 * decoration (greyed out) and stop receiving events. The focus chain
703 * will also ignore it.
705 * Following, there are 2 more buttons whose actions are focus/unfocus
706 * the top button, respectively:
707 * @skip focus callback
710 * @skip unfocus callback
712 * Note the situations in which they won't take effect:
713 * - the button is not allowed to get focus or
714 * - the button is disabled
716 * The first restriction above you'll get by a second checkbox, whose
718 * @skip focus allow callback
720 * Note that the button will still get mouse events, though.
722 * Next, there's a slider controlling the button's scale:
723 * @skip scaling callback
726 * Experiment with it, so you understand the effect better. If you
727 * change its value, it will mess with the button's original size,
730 * The full code for this example can be found
731 * @ref general_functions_example_c "here".
735 * @page theme_example_01 Theme - Using extensions
737 * @dontinclude theme_example_01.c
739 * Using extensions is extremely easy, discarding the part where you have to
740 * write the theme for them.
742 * In the following example we'll be creating two buttons, one to load or
743 * unload our extension theme and one to cycle around three possible styles,
744 * one of which we created.
746 * After including our one and only header we'll jump to the callback for
747 * the buttons. First one takes care of loading or unloading our extension
748 * file, relative to the default theme set (thus the @c NULL in the
749 * functions first parameter).
750 * @skipline Elementary.h
756 * The second button, as we said before, will just switch around different
757 * styles. In this case we have three of them. The first one is our custom
758 * style, named after something very unlikely to find in the default theme.
759 * The other two styles are the standard and one more, anchor, which exists
760 * in the default and is similar to the default, except the button vanishes
761 * when the mouse is not over it.
766 * So what happens if the style switches to our custom one when the
767 * extension is loaded? Elementary falls back to the default for the
770 * And the main function, simply enough, will create the window, set the
771 * buttons and their callbacks, and just to begin with our button styled
772 * we're also loading our extension at the beginning.
776 * In this case we wanted to easily remove extensions, but all adding an
777 * extension does is tell Elementary where else it should look for themes
778 * when it can't find them in the default theme. Another way to do this
779 * is to set the theme search order using elm_theme_set(), but this requires
780 * that the developer is careful not to override any user configuration.
781 * That can be helped by adding our theme to the end of whatver is already
782 * set, like in the following snippet.
785 * snprintf(buf, sizeof(buf), "%s:./theme_example.edj", elme_theme_get(NULL);
786 * elm_theme_set(NULL, buf);
789 * If we were using overlays instead of extensions, the same thing applies,
790 * but the custom theme must be added to the front of the search path.
792 * In the end, we should be looking at something like this:
794 * @image html screenshots/theme_example_01.png
795 * @image latex screenshots/theme_example_01.eps width=\textwidth
797 * That's all. Boringly simple, and the full code in one piece can be found
798 * @ref theme_example_01.c "here".
800 * And the code for our extension is @ref theme_example.edc "here".
802 * @example theme_example_01.c
803 * @example theme_example.edc
807 * @page theme_example_02 Theme - Using overlays
809 * @dontinclude theme_example_02.c
811 * Overlays are like extensions in that you tell Elementary that some other
812 * theme contains the styles you need for your program. The difference is that
813 * they will be look in first, so they can override the default style of any
816 * There's not much to say about them that hasn't been said in our previous
817 * example about @ref theme_example_01 "extensions", so going quickly through
818 * the code we have a function to load or unload the theme, which will be
819 * called when we click any button.
820 * @skipline Elementary.h
824 * And the main function, creating the window and adding some buttons to it.
825 * We load our theme as an overlay and nothing else. Notice there's no style
826 * set for any button there, which means they should be using the default
831 * That's pretty much it. The full code is @ref theme_example_02.c "here" and
832 * the definition of the theme is the same as before, and can be found in
833 * @ref theme_example.edc "here".
835 * @example theme_example_02.c
839 * @page button_example_01 Button - Complete example
841 * @dontinclude button_example_01.c
843 * A button is simple, you click on it and something happens. That said,
844 * we'll go through an example to show in detail the button API less
847 * In the end, we'll be presented with something that looks like this:
849 * @image html screenshots/button_01.png
850 * @image latex screenshots/button_01.eps width=\textwidth
852 * The full code of the example is @ref button_example_01.c "here" and we
853 * will follow here with a rundown of it.
856 * @until Elementary.h
860 * We have several buttons to set different times for the autorepeat timeouts
861 * of the buttons that use it and a few more that we keep track of in our
862 * data struct. The mid button doesn't do much, just moves around according
863 * to what other buttons the user presses. Then four more buttons to move the
864 * central one, and we're also keeping track of the icon set in the middle
865 * button, since when this one moves, we change the icon, and when movement
866 * is finished (by releasing one of the four arrow buttons), we set back the
871 * Keeping any of those four buttons pressed will trigger their autorepeat
872 * callback, where we move the button doing some size hint magic. To
873 * understand how that works better, refer to the @ref Box documentation.
874 * Also, the first time the function is called, we change the icon in the
875 * middle button, using elm_button_icon_unset() first to keep the reference
876 * to the previous one, so we don't need to recreate it when we are done
880 * @until size_hint_align_set
883 * One more callback for the option buttons, that just sets the timeouts for
884 * the different autorepeat options.
891 * And the main function, which does some setting up of the buttons in boxes
892 * to make things work. Here we'll go through some snippets only.
894 * For the option buttons, it's just the button with its label and callback.
895 * @skip elm_button_add
896 * @until smart_callback_add
898 * For the ones that move the central button, we have no labels. There are
899 * icons instead, and the autorepeat option is toggled.
901 * @skip elm_button_add
902 * @until data.cursors.up
904 * And just to show the mid button, which doesn't have anything special.
905 * @skip data.cursors.left
906 * @skip elm_button_add
911 * @example button_example_01.c
915 * @page bubble_01_example_page elm_bubble - Simple use.
916 * @dontinclude bubble_example_01.c
918 * This example shows a bubble with all fields set(label, info, content and
919 * icon) and the selected corner changing when the bubble is clicked. To be
920 * able use a bubble we need to do some setup and create a window, for this
921 * example we are going to ignore that part of the code since it isn't
922 * relevant to the bubble.
924 * To have the selected corner change in a clockwise motion we are going to
925 * use the following callback:
930 * Here we are creating an elm_label that is going to be used as the content
932 * @skipline elm_label
934 * @note You could use any evas_object for this, we are using an elm_label
937 * Despite it's name the bubble's icon doesn't have to be an icon, it can be
938 * any evas_object. For this example we are going to make the icon a simple
942 * And finally we have the actual bubble creation and the setting of it's
943 * label, info and content:
946 * @note Because we didn't set a corner, the default("top_left") will be
949 * Now that we have our bubble all that is left is connecting the "clicked"
950 * signals to our callback:
951 * @line smart_callback
953 * This last bubble we created was very complete, so it's pertinent to show
954 * that most of that stuff is optional a bubble can be created with nothing
959 * Our example will look like this:
961 * @image html screenshots/bubble_example_01.png
962 * @image latex screenshots/bubble_example_01.eps width=\textwidth
964 * See the full source code @ref bubble_example_01.c here.
965 * @example bubble_example_01.c
969 * @page box_example_01 Box - Basic API
971 * @dontinclude button_example_01.c
973 * As a special guest tonight, we have the @ref button_example_01 "simple
974 * button example". There are plenty of boxes in it, and to make the cursor
975 * buttons that moved a central one around when pressed, we had to use a
976 * variety of values for their hints.
978 * To start, let's take a look at the handling of the central button when
979 * we were moving it around. To achieve this effect without falling back to
980 * a complete manual positioning of the @c Evas_Object in our canvas, we just
981 * put it in a box and played with its alignment within it, as seen in the
982 * following snippet of the callback for the pressed buttons.
983 * @skip evas_object_size_hint_align_get
984 * @until evas_object_size_hint_align_set
986 * Not much to it. We get the current alignment of the object and change it
987 * by just a little, depending on which button was pressed, then set it
988 * again, making sure we stay within the 0.0-1.0 range so the button moves
989 * inside the space it has, instead of disappearing under the other objects.
991 * But as useful as an example as that may have been, the usual case with boxes
992 * is to set everything at the moment they are created, like we did for
993 * everything else in our main function.
995 * The entire layout of our program is made with boxes. We have one set as the
996 * resize object for the window, which means it will always be resized with
997 * the window. The weight hints set to @c EVAS_HINT_EXPAND will tell the
998 * window that the box can grow past it's minimum size, which allows resizing
1002 * @until evas_object_show
1004 * Two more boxes, set to horizontal, hold the buttons to change the autorepeat
1005 * configuration used by the buttons. We create each to take over all the
1006 * available space horizontally, but we don't want them to grow vertically,
1007 * so we keep that axis of the weight with 0.0. Then it gets packed in the
1010 * @until evas_object_show
1012 * The buttons in each of those boxes have nothing special, they are just packed
1013 * in with their default values and the box will use their minimum size, as set
1014 * by Elementary itself based on the label, icon, finger size and theme.
1016 * But the buttons used to move the central one have a special disposition.
1017 * The top one first, is placed right into the main box like our other smaller
1018 * boxes. Set to expand horizontally and not vertically, and in this case we
1019 * also tell it to fill that space, so it gets resized to take the entire
1020 * width of the window.
1022 * @skip elm_button_add
1023 * @until evas_object_show
1025 * The bottom one will be the same, but for the other two we need to use a
1026 * second box set to take as much space as we have, so we can place our side
1027 * buttons in place and have the big empty space where the central button will
1030 * @until evas_object_show
1032 * Then the buttons will have their hints inverted to the other top and bottom
1033 * ones, to expand and fill vertically and keep their minimum size horizontally.
1034 * @skip elm_button_add
1035 * @until evas_object_show
1037 * The central button takes every thing else. It will ask to be expanded in
1038 * both directions, but without filling its cell. Changing its alignment by
1039 * pressing the buttons will make it move around.
1040 * @skip elm_button_add
1041 * @until evas_object_show
1043 * To end, the rightmost button is packed in the smaller box after the central
1044 * one, and back to the main box we have the bottom button at the end.
1048 * @page box_example_02 Box - Layout transitions
1050 * @dontinclude box_example_02.c
1052 * Setting a customized layout for a box is simple once you have the layout
1053 * function, which is just like the layout function for @c Evas_Box. The new
1054 * and fancier thing we can do with Elementary is animate the transition from
1055 * one layout to the next. We'll see now how to do that through a simple
1056 * example, while also taking a look at some of the API that was left
1057 * untouched in our @ref box_example_01 "previous example".
1059 * @image html screenshots/box_example_02.png
1060 * @image latex screenshots/box_example_02.eps width=\textwidth
1062 * @skipline Elementary.h
1064 * Our application data consists of a list of layout functions, given by
1065 * @c transitions. We'll be animating through them throughout the entire run.
1066 * The box with the stuff to move around and the last layout that was set to
1067 * make things easier in the code.
1069 * @until Transitions_Data
1071 * The box starts with three buttons, clicking on any of them will take it
1072 * out of the box without deleting the object. There are also two more buttons
1073 * outside, one to add an object to the box and the other to clear it.
1074 * This is all to show how you can interact with the items in the box, add
1075 * things and even remove them, while the transitions occur.
1077 * One of the callback we'll be using creates a new button, asks the box for
1078 * the list of its children and if it's not empty, we add the new object after
1079 * the first one, otherwise just place at the end as it will not make any
1085 * The clear button is even simpler. Everything in the box will be deleted,
1086 * leaving it empty and ready to fill it up with more stuff.
1090 * And a little function to remove buttons from the box without deleting them.
1091 * This one is set for the @c clicked callback of the original buttons,
1092 * unpacking them when clicked and placing it somewhere in the screen where
1093 * they will not disturb. Once we do this, the box no longer has any control
1094 * of it, so it will be left untouched until the program ends.
1098 * If we wanted, we could just call @c evas_object_del() on the object to
1099 * destroy it. In this case, no unpack is really necessary, as the box would
1100 * be notified of a child being deleted and adjust its calculations accordingly.
1102 * The core of the program is the following function. It takes whatever
1103 * function is first on our list of layouts and together with the
1104 * @c last_layout, it creates an ::Elm_Box_Transition to use with
1105 * elm_box_layout_transition(). In here, we tell it to start from whatever
1106 * layout we last set, end with the one that was at the top of the list and
1107 * when everything is finished, call us back so we can create another
1108 * transition. Finally, move the new layout to the end of the list so we
1109 * can continue running through them until the program ends.
1113 * The main function doesn't have antyhing special. Creation of box, initial
1114 * buttons and some callback setting. The only part worth mentioning is the
1115 * initialization of our application data.
1117 * @until evas_object_box_layout_stack
1119 * We have a simple static variable, set the box, the first layout we are
1120 * using as last and create the list with the different functions to go
1123 * And in the end, we set the first layout and call the same function we went
1124 * through before to start the run of transitions.
1125 * @until _test_box_transition_change
1127 * For the full code, follow @ref box_example_02.c "here".
1129 * @example box_example_02.c
1133 * @page calendar_example_01 Calendar - Simple creation.
1134 * @dontinclude calendar_example_01.c
1136 * As a first example, let's just display a calendar in our window,
1137 * explaining all steps required to do so.
1139 * First you should declare objects we intend to use:
1140 * @skipline Evas_Object
1142 * Then a window is created, a title is set and its set to be autodeleted.
1143 * More details can be found on windows examples:
1144 * @until elm_win_autodel
1146 * Next a simple background is placed on our windows. More details on
1147 * @ref bg_01_example_page:
1148 * @until evas_object_show(bg)
1150 * Now, the exciting part, let's add the calendar with elm_calendar_add(),
1151 * passing our window object as parent.
1152 * @until evas_object_show(cal);
1154 * To conclude our example, we should show the window and run elm mainloop:
1157 * Our example will look like this:
1159 * @image html screenshots/calendar_example_01.png
1160 * @image latex screenshots/calendar_example_01.eps width=\textwidth
1162 * See the full source code @ref calendar_example_01.c here.
1163 * @example calendar_example_01.c
1167 * @page calendar_example_02 Calendar - Layout strings formatting.
1168 * @dontinclude calendar_example_02.c
1170 * In this simple example, we'll explain how to format the label displaying
1171 * month and year, and also set weekday names.
1173 * To format month and year label, we need to create a callback function
1174 * to create a string given the selected time, declared under a
1175 * <tt> struct tm </tt>.
1177 * <tt> struct tm </tt>, declared on @c time.h, is a structure composed by
1179 * @li tm_sec seconds [0,59]
1180 * @li tm_min minutes [0,59]
1181 * @li tm_hour hour [0,23]
1182 * @li tm_mday day of month [1,31]
1183 * @li tm_mon month of year [0,11]
1184 * @li tm_year years since 1900
1185 * @li tm_wday day of week [0,6] (Sunday = 0)
1186 * @li tm_yday day of year [0,365]
1187 * @li tm_isdst daylight savings flag
1188 * @note glib version has 2 additional fields.
1190 * For our function, only stuff that matters are tm_mon and tm_year.
1191 * But we don't need to access it directly, since there are nice functions
1192 * to format date and time, as @c strftime.
1193 * We will get abbreviated month (%b) and year (%y) (check strftime manpage
1194 * for more) in our example:
1195 * @skipline static char
1198 * We need to alloc the string to be returned, and calendar widget will
1199 * free it when it's not needed, what is done by @c strdup.
1200 * So let's register our callback to calendar object:
1201 * @skipline elm_calendar_format_function_set
1203 * To set weekday names, we should declare them as an array of strings:
1204 * @dontinclude calendar_example_02.c
1205 * @skipline weekdays
1208 * And finally set them to calendar:
1209 * skipline weekdays_names_set
1211 * Our example will look like this:
1213 * @image html screenshots/calendar_example_02.png
1214 * @image latex screenshots/calendar_example_02.eps width=\textwidth
1216 * See the full source code @ref calendar_example_02.c here.
1217 * @example calendar_example_02.c
1221 * @page calendar_example_03 Calendar - Years restrictions.
1222 * @dontinclude calendar_example_03.c
1224 * This example explains how to set max and min year to be displayed
1225 * by a calendar object. This means that user won't be able to
1226 * see or select a date before and after selected years.
1227 * By default, limits are 1902 and maximun value will depends
1228 * on platform architecture (year 2037 for 32 bits); You can
1229 * read more about time functions on @c ctime manpage.
1231 * Straigh to the point, to set it is enough to call
1232 * elm_calendar_min_max_year_set(). First value is minimun year, second
1233 * is maximum. If first value is negative, it won't apply limit for min
1234 * year, if the second one is negative, won't apply for max year.
1235 * Setting both to negative value will clear limits (default state):
1236 * @skipline elm_calendar_min_max_year_set
1238 * Our example will look like this:
1240 * @image html screenshots/calendar_example_03.png
1241 * @image latex screenshots/calendar_example_03.eps width=\textwidth
1243 * See the full source code @ref calendar_example_03.c here.
1244 * @example calendar_example_03.c
1248 * @page calendar_example_04 Calendar - Days selection.
1249 * @dontinclude calendar_example_04.c
1251 * It's possible to disable date selection and to select a date
1252 * from your program, and that's what we'll see on this example.
1254 * If isn't required that users could select a day on calendar,
1255 * only interacting going through months, disabling days selection
1256 * could be a good idea to avoid confusion. For that:
1257 * @skipline elm_calendar_day_selection_enabled_set
1259 * Also, regarding days selection, you could be interested to set a
1260 * date to be highlighted on calendar from your code, maybe when
1261 * a specific event happens, or after calendar creation. Let's select
1262 * two days from current day:
1263 * @dontinclude calendar_example_04.c
1264 * @skipline SECS_DAY
1265 * @skipline current_time
1266 * @until elm_calendar_selected_time_set
1268 * Our example will look like this:
1270 * @image html screenshots/calendar_example_04.png
1271 * @image latex screenshots/calendar_example_04.eps width=\textwidth
1273 * See the full source code @ref calendar_example_04.c here.
1274 * @example calendar_example_04.c
1278 * @page calendar_example_05 Calendar - Signal callback and getters.
1279 * @dontinclude calendar_example_05.c
1281 * Most of setters explained on previous examples have associated getters.
1282 * That's the subject of this example. We'll add a callback to display
1283 * all calendar information every time user interacts with the calendar.
1285 * Let's check our callback function:
1286 * @skipline static void
1287 * @until double interval;
1289 * To get selected day, we need to call elm_calendar_selected_time_get(),
1290 * but to assure nothing wrong happened, we must check for function return.
1291 * It'll return @c EINA_FALSE if fail. Otherwise we can use time set to
1292 * our structure @p stime.
1293 * @skipline elm_calendar_selected_time_get
1296 * Next we'll get information from calendar and place on declared vars:
1297 * @skipline interval
1298 * @until elm_calendar_weekdays_names_get
1300 * The only tricky part is that last line gets an array of strings
1301 * (char arrays), one for each weekday.
1303 * Then we can simple print that to stdin:
1307 * <tt> struct tm </tt> is declared on @c time.h. You can check @c ctime
1308 * manpage to read about it.
1310 * To register this callback, that will be called every time user selects
1311 * a day or goes to next or previous month, just add a callback for signal
1313 * @skipline evas_object_smart_callback_add
1315 * Our example will look like this:
1317 * @image html screenshots/calendar_example_05.png
1318 * @image latex screenshots/calendar_example_05.eps width=\textwidth
1320 * See the full source code @ref calendar_example_05.c here.
1321 * @example calendar_example_05.c
1325 * @page calendar_example_06 Calendar - Calendar marks.
1326 * @dontinclude calendar_example_06.c
1328 * On this example marks management will be explained. Functions
1329 * elm_calendar_mark_add(), elm_calendar_mark_del() and
1330 * elm_calendar_marks_clear() will be covered.
1332 * To add a mark, will be required to choose three things:
1334 * @li mark date, or start date if it will be repeated
1335 * @li mark periodicity
1337 * Style defines the kind of mark will be displayed over marked day,
1338 * on caledar. Default theme supports @b holiday and @b checked.
1339 * If more is required, is possible to set a new theme to calendar
1340 * widget using elm_object_style_set(), and use
1341 * the signal that will be used by such marks.
1343 * Date is a <tt> struct tm </tt>, as defined by @c time.h. More can
1344 * be read on @c ctime manpage.
1345 * If a date relative from current is required, this struct can be set
1347 * @skipline current_time
1348 * @until localtime_r
1350 * Or if it's an absolute date, you can just declare the struct like:
1351 * @dontinclude calendar_example_06.c
1353 * @until christmas.tm_mon
1355 * Periodicity is how frequently the mark will be displayed over the
1356 * calendar. Can be a unique mark (that don't repeat), or it can repeat
1357 * daily, weekly, monthly or annually. It's enumerated by
1358 * @c Elm_Calendar_Mark_Repeat.
1360 * So let's add some marks to our calendar. We will add christmas holiday,
1361 * set Sundays as holidays, and check current day and day after that.
1362 * @dontinclude calendar_example_06.c
1364 * @until christmas.tm_mon
1365 * @skipline current_time
1366 * @until ELM_CALENDAR_WEEKLY
1368 * We kept the return of first mark add, because we don't really won't it
1369 * to be checked, so let's remove it:
1370 * @skipline elm_calendar_mark_del
1372 * After all marks are added and removed, is required to draw them:
1373 * @skipline elm_calendar_marks_draw
1375 * Finally, to clear all marks, let's set a callback for our button:
1376 * @skipline elm_button_add
1377 * @until evas_object_show(bt);
1379 * This callback will receive our calendar object, and should clear it:
1380 * @dontinclude calendar_example_06.c
1383 * @note Remember to draw marks after clear the calendar.
1385 * Our example will look like this:
1387 * @image html screenshots/calendar_example_06.png
1388 * @image latex screenshots/calendar_example_06.eps width=\textwidth
1390 * See the full source code @ref calendar_example_06.c here.
1391 * @example calendar_example_06.c
1395 * @page clock_example Clock widget example
1397 * This code places five Elementary clock widgets on a window, each of
1398 * them exemplifying a part of the widget's API.
1400 * The first of them is the pristine clock:
1401 * @dontinclude clock_example.c
1403 * @until evas_object_show
1404 * As you see, the defaults for a clock are:
1406 * - no seconds shown
1408 * For am/pm time, see the second clock:
1409 * @dontinclude clock_example.c
1411 * @until evas_object_show
1413 * The third one will show the seconds digits, which will flip in
1414 * synchrony with system time. Note, besides, that the time itself is
1415 * @b different from the system's -- it was customly set with
1416 * elm_clock_time_set():
1417 * @dontinclude clock_example.c
1418 * @skip with seconds
1419 * @until evas_object_show
1421 * In both fourth and fifth ones, we turn on the <b>edition
1422 * mode</b>. See how you can change each of the sheets on it, and be
1423 * sure to try holding the mouse pressed over one of the sheet
1424 * arrows. The forth one also starts with a custom time set:
1425 * @dontinclude clock_example.c
1427 * @until evas_object_show
1429 * The fifth, besides editable, has only the time @b units editable,
1430 * for hours, minutes and seconds. This exemplifies
1431 * elm_clock_digit_edit_set():
1432 * @dontinclude clock_example.c
1434 * @until evas_object_show
1436 * See the full @ref clock_example.c "example", whose window should
1437 * look like this picture:
1439 * @image html screenshots/clock_example.png
1440 * @image latex screenshots/clock_example.eps width=\textwidth
1442 * See the full @ref clock_example_c "source code" for this example.
1444 * @example clock_example.c
1448 * @page diskselector_example_01 Diskselector widget example
1450 * This code places 4 Elementary diskselector widgets on a window, each of
1451 * them exemplifying a part of the widget's API.
1453 * All of them will have weekdays as items, since we won't focus
1454 * on items management on this example. For an example about this subject,
1455 * check @ref diskselector_example_02.
1457 * The first of them is a default diskselector.
1458 * @dontinclude diskselector_example_01.c
1461 * @skipline elm_diskselector_add
1462 * @until evas_object_show
1464 * We are just adding the diskselector, so as you can see, defaults for it are:
1465 * @li Only 3 items visible each time.
1466 * @li Only 3 characters are displayed for labels on side positions.
1467 * @li The first added item remains centeres, i.e., it's the selected item.
1469 * To add items, we are just appending it on a loop, using function
1470 * elm_diskselector_item_append(), that will be better exaplained on
1471 * items management example.
1473 * For a circular diskselector, check the second widget. A circular
1474 * diskselector will display first item after last, and last previous to
1475 * the first one. So, as you can see, @b Sa will appears on left side
1476 * of selected @b Sunday. This property is set with
1477 * elm_diskselector_round_set().
1479 * Also, we decide to display only 2 character for side labels, instead of 3.
1480 * For this we call elm_diskselector_side_label_length_set(). As result,
1481 * we'll see @b Mo displayed instead of @b Mon, when @b Monday is on a
1484 * @skipline elm_diskselector_add
1485 * @until evas_object_show
1487 * But so far, we are only displaying 3 items at once. If more are wanted,
1488 * is enough to call elm_diskselector_display_item_num_set(), as you can
1490 * @skipline elm_diskselector_add
1491 * @until evas_object_show
1493 * @note You can't set less than 3 items to be displayed.
1495 * Finally, if a bounce effect is required, or you would like to see
1496 * scrollbars, it is possible. But, for default theme, diskselector
1497 * scrollbars will be invisible anyway.
1498 * @skipline elm_diskselector_add
1499 * @until evas_object_show
1501 * See the full @ref diskselector_example_01.c "diskselector_example_01.c"
1502 * code, whose window should look like this picture:
1504 * @image html screenshots/diskselector_example_01.png
1505 * @image latex screenshots/diskselector_example_01.eps width=\textwidth
1507 * @example diskselector_example_01.c
1511 * @page diskselector_example_02 Diskselector - Items management
1513 * This code places a Elementary diskselector widgets on a window,
1514 * along with some buttons trigerring actions on it (though its API).
1515 * It covers most of Elm_Diskselector_Item functions.
1517 * On our @c main function, we are adding a default diskselector with
1518 * 3 items. We are only setting their labels (second parameter of function
1519 * elm_diskselector_item_append):
1520 * @dontinclude diskselector_example_02.c
1521 * @skipline elm_diskselector_add
1524 * Next we are adding lots of buttons, each one for a callback function
1525 * that will realize a task covering part of diskselector items API.
1526 * Lets check the first one:
1527 * @skipline elm_button_add
1528 * @until evas_object_show
1530 * We are labeling the button with a task description with
1531 * elm_object_text_set() and setting a callback
1532 * function evas_object_smart_callback_add().
1533 * Each callback function will have the signature:
1534 * <tt> static void _task_cb(void *data, Evas_Object *obj,
1535 * void *event_info)</tt> with the function name varying for each task.
1537 * Now let's cover all of them.
1539 * <b> Appending an item: </b>
1540 * @dontinclude diskselector_example_02.c
1544 * All items are included on diskselector after last one. You @b can't
1547 * The first parameter of elm_diskselector_item_append() is the diskselector
1548 * object, that we are receiving as data on our callback function.
1549 * The second one is a label, the string that will be placed in the center
1550 * of our item. As we don't wan't icons or callback functions, we can
1551 * send NULL as third, fourth and fifth parameters.
1553 * <b> Appending an item with icon: </b>
1554 * @dontinclude diskselector_example_02.c
1555 * @skipline _add_ic_cb
1558 * If an icon is required, you can pass it as third paramenter on our
1559 * elm_diskselector_item_append() function. It will be place on the
1560 * left side of item's label, that will be shifted to right a bit.
1562 * For more details about how to create icons, look for elm_icon examples.
1564 * <b> Appending an item with callback function for selected: </b>
1565 * @dontinclude diskselector_example_02.c
1570 * To set a callback function that will be called every time an item is
1571 * selected, i.e., everytime the diskselector stops with this item in
1572 * center position, just pass the function as fourth paramenter.
1574 * <b> Appending an item with callback function for selected with data: </b>
1575 * @dontinclude diskselector_example_02.c
1576 * @skipline _sel_data_cb
1582 * If the callback function request an extra data, it can be attached to our
1583 * item passing a pointer for data as fifth parameter.
1584 * Our function _sel_data_cb will receive it as <tt> void *data </tt>.
1586 * If you want to free this data, or handle that the way you need when the
1587 * item is deleted, set a callback function for that, with
1588 * elm_diskselector_item_del_cb_set().
1590 * As you can see we check if @c it is not @c NULL after appending it.
1591 * If an error happens, we won't try to set a function for it.
1593 * <b> Deleting an item: </b>
1594 * @dontinclude diskselector_example_02.c
1599 * To delete an item we simple need to call elm_diskselector_item_del() with
1600 * a pointer for such item.
1602 * If you need, you can get selected item with
1603 * elm_diskselector_selected_item_get(), that will return a pointer for it.
1605 * <b> Unselecting an item: </b>
1606 * @dontinclude diskselector_example_02.c
1607 * @skipline _unselect_cb
1610 * To select an item, you should call elm_diskselector_item_selected_set()
1611 * passing @c EINA_TRUE, and to unselect it, @c EINA_FALSE.
1613 * If you unselect the selected item, diskselector will automatically select
1616 * <b> Printing all items: </b>
1617 * @dontinclude diskselector_example_02.c
1618 * @skipline _print_cb
1621 * <b> Clearing the diskselector: </b>
1622 * @dontinclude diskselector_example_02.c
1623 * @skipline _clear_cb
1626 * <b> Selecting the first item: </b>
1627 * @dontinclude diskselector_example_02.c
1628 * @skipline _select_first_cb
1631 * <b> Selecting the last item: </b>
1632 * @dontinclude diskselector_example_02.c
1633 * @skipline _select_last_cb
1636 * <b> Selecting the next item: </b>
1637 * @dontinclude diskselector_example_02.c
1638 * @skipline _select_next_cb
1641 * <b> Selecting the previous item: </b>
1642 * @dontinclude diskselector_example_02.c
1643 * @skipline _select_prev_cb
1646 * See the full @ref diskselector_example_02.c "diskselector_example_02.c"
1647 * code, whose window should look like this picture:
1649 * @image html screenshots/diskselector_example_02.png
1650 * @image latex screenshots/diskselector_example_02.eps width=\textwidth
1652 * @example diskselector_example_02.c
1656 * @page flipselector_example Flip selector widget example
1658 * This code places an Elementary flip selector widget on a window,
1659 * along with two buttons trigerring actions on it (though its API).
1661 * The selector is being populated with the following items:
1662 * @dontinclude flipselector_example.c
1666 * Next, we create it, populating it with those items and registering
1667 * two (smart) callbacks on it:
1668 * @dontinclude flipselector_example.c
1669 * @skip fp = elm_flipselector_add
1670 * @until object_show
1672 * Those two callbacks will take place whenever one of those smart
1673 * events occur, and they will just print something to @c stdout:
1674 * @dontinclude flipselector_example.c
1675 * @skip underflow callback
1676 * @until static void
1677 * Flip the sheets on the widget while looking at the items list, in
1678 * the source code, and you'll get the idea of those events.
1680 * The two buttons below the flip selector will take the actions
1681 * described in their labels:
1682 * @dontinclude flipselector_example.c
1683 * @skip bt = elm_button_add
1684 * @until callback_add(win
1686 * @dontinclude flipselector_example.c
1687 * @skip unselect the item
1690 * Click on them to exercise those flip selector API calls. To
1691 * interact with the other parts of this API, there's a command line
1692 * interface, whose help string can be asked for with the 'h' key:
1693 * @dontinclude flipselector_example.c
1697 * The 'n' and 'p' keys will exemplify elm_flipselector_flip_next()
1698 * and elm_flipselector_flip_prev(), respectively. 'f' and 'l' account
1699 * for elm_flipselector_first_item_get() and
1700 * elm_flipselector_last_item_get(), respectively. Finally, 's' will
1701 * issue elm_flipselector_selected_item_get() on our example flip
1704 * See the full @ref flipselector_example.c "example", whose window should
1705 * look like this picture:
1707 * @image html screenshots/flipselector_example.png
1708 * @image latex screenshots/flipselector_example.eps width=\textwidth
1710 * See the full @ref flipselector_example_c "source code" for this example.
1712 * @example flipselector_example.c
1716 * @page fileselector_example File selector widget example
1718 * This code places two Elementary file selector widgets on a window.
1719 * The one on the left is layouting file system items in a @b list,
1720 * while the the other is layouting them in a @b grid.
1722 * The one having the majority of hooks of interest is on the left,
1723 * which we create as follows:
1724 * @dontinclude fileselector_example.c
1725 * @skip first file selector
1726 * @until object_show
1728 * Note that we enable custom edition of file/directory selection, via
1729 * the text entry it has on its bottom, via
1730 * elm_fileselector_is_save_set(). It starts with the list view, which
1731 * is the default, and we make it not expandable in place
1732 * (elm_fileselector_expandable_set()), so that it replaces its view's
1733 * contents with the current directory's entries each time one
1734 * navigates to a different folder. For both of file selectors we are
1735 * starting to list the contents found in the @c "/tmp" directory
1736 * (elm_fileselector_path_set()).
1738 * Note the code setting it to "grid mode" and observe the differences
1739 * in the file selector's views, in the example. We also hide the
1740 * second file selector's Ok/Cancel buttons -- since it's there just
1741 * to show the grid view (and navigation) -- via
1742 * elm_fileselector_buttons_ok_cancel_set().
1744 * The @c "done" event, which triggers the callback below
1745 * @dontinclude fileselector_example.c
1748 * will be called at the time one clicks the "Ok"/"Cancel" buttons of
1749 * the file selector (on the left). Note that it will print the path
1750 * to the current selection, if any.
1752 * The @c "selected" event, which triggers the callback below
1753 * @dontinclude fileselector_example.c
1754 * @skip bt = 'selected' cb
1756 * takes place when one selects a file (if the file selector is @b not
1757 * under folders-only mode) or when one selects a folder (when in
1758 * folders-only mode). Experiment it by selecting different file
1761 * What comes next is the code creating the three check boxes and two
1762 * buttons below the file selector in the right. They will exercise a
1763 * bunch of functions on the file selector's API, for the instance on
1764 * the left. Experiment with them, specially the buttons, to get the
1765 * difference between elm_fileselector_path_get() and
1766 * elm_fileselector_selected_get().
1768 * Finally, there's the code adding the second file selector, on the
1770 * @dontinclude fileselector_example.c
1771 * @skip second file selector
1772 * @until object_show
1774 * Pay attention to the code setting it to "grid mode" and observe the
1775 * differences in the file selector's views, in the example. We also
1776 * hide the second file selector's Ok/Cancel buttons -- since it's
1777 * there just to show the grid view (and navigation) -- via
1778 * elm_fileselector_buttons_ok_cancel_set().
1780 * See the full @ref fileselector_example.c "example", whose window
1781 * should look like this picture:
1783 * @image html screenshots/fileselector_example.png
1784 * @image latex screenshots/fileselector_example.eps width=\textwidth
1786 * See the full @ref fileselector_example_c "source code" for this example.
1788 * @example fileselector_example.c
1792 * @page fileselector_button_example File selector button widget example
1794 * This code places an Elementary file selector button widget on a
1795 * window, along with some other checkboxes and a text entry. Those
1796 * are there just as knobs on the file selector button's state and to
1797 * display information from it.
1799 * Here's how we instantiate it:
1800 * @dontinclude fileselector_button_example.c
1801 * @skip ic = elm_icon_add
1802 * @until evas_object_show
1804 * Note that we set on it both icon and label decorations. It's set to
1805 * list the contents of the @c "/tmp" directory, too, with
1806 * elm_fileselector_button_path_set(). What follows are checkboxes to
1807 * exercise some of its API funtions:
1808 * @dontinclude fileselector_button_example.c
1809 * @skip ck = elm_check_add
1810 * @until evas_object_show(en)
1812 * The checkboxes will toggle whether the file selector button's
1813 * internal file selector:
1814 * - must have an editable text entry for file names (thus, be in
1815 * "save dialog mode")
1816 * - is to be raised as an "inner window" (note it's the default
1817 * behavior) or as a dedicated window
1818 * - is to populate its view with folders only
1819 * - is to expand its folders, in its view, <b>in place</b>, and not
1820 * repainting it entirely just with the contents of a sole
1823 * The entry labeled @c "Last selection" will exercise the @c
1824 * "file,chosen" smart event coming from the file selector button:
1825 * @dontinclude fileselector_button_example.c
1827 * @until toggle inwin
1829 * Whenever you dismiss or acknowledges the file selector, after it's
1830 * raised, the @c event_info string will contain the last selection on
1831 * it (if any was made).
1833 * This is how the example, just after called, should look like:
1835 * @image html screenshots/fileselector_button_example_00.png
1836 * @image latex screenshots/fileselector_button_example_00.eps width=\textwidth
1838 * Click on the file selector button to raise its internal file
1839 * selector, which will be contained on an <b>"inner window"</b>:
1841 * @image html screenshots/fileselector_button_example_01.png
1842 * @image latex screenshots/fileselector_button_example_01.eps width=\textwidth
1844 * Toggle the "inwin mode" switch off and, if you click on the file
1845 * selector button again, you'll get @b two windows, the original one
1846 * (note the last selection there!)
1848 * @image html screenshots/fileselector_button_example_02.png
1849 * @image latex screenshots/fileselector_button_example_02.eps width=\textwidth
1851 * and the file selector's new one
1853 * @image html screenshots/fileselector_button_example_03.png
1854 * @image latex screenshots/fileselector_button_example_03.eps width=\textwidth
1856 * Play with the checkboxes to get the behavior changes on the file
1857 * selector button. The respective API calls on the widget coming from
1858 * those knobs where shown in the code already.
1860 * See the full @ref fileselector_button_example_c "source code" for
1863 * @example fileselector_button_example.c
1867 * @page fileselector_entry_example File selector entry widget example
1869 * This code places an Elementary file selector entry widget on a
1870 * window, along with some other checkboxes. Those are there just as
1871 * knobs on the file selector entry's state.
1873 * Here's how we instantiate it:
1874 * @dontinclude fileselector_entry_example.c
1875 * @skip ic = elm_icon_add
1876 * @until evas_object_show
1878 * Note that we set on it's button both icon and label
1879 * decorations. It's set to exhibit the path of (and list the contents
1880 * of, when internal file selector is launched) the @c "/tmp"
1881 * directory, also, with elm_fileselector_entry_path_set(). What
1882 * follows are checkboxes to exercise some of its API funtions:
1883 * @dontinclude fileselector_entry_example.c
1884 * @skip ck = elm_check_add
1885 * @until callback_add(fs_entry
1887 * The checkboxes will toggle whether the file selector entry's
1888 * internal file selector:
1889 * - must have an editable text entry for file names (thus, be in
1890 * "save dialog mode")
1891 * - is to be raised as an "inner window" (note it's the default
1892 * behavior) or as a dedicated window
1893 * - is to populate its view with folders only
1894 * - is to expand its folders, in its view, <b>in place</b>, and not
1895 * repainting it entirely just with the contents of a sole
1898 * Observe how the entry's text will match the string coming from the
1899 * @c "file,chosen" smart event:
1900 * @dontinclude fileselector_entry_example.c
1903 * Whenever you dismiss or acknowledges the file selector, after it's
1904 * raised, the @c event_info string will contain the last selection on
1905 * it (if any was made).
1907 * Try, also, to type in a valid system path and, then, open the file
1908 * selector's window: it will start the file browsing there, for you.
1910 * This is how the example, just after called, should look like:
1912 * @image html screenshots/fileselector_entry_example_00.png
1913 * @image latex screenshots/fileselector_entry_example_00.eps width=\textwidth
1915 * Click on the file selector entry to raise its internal file
1916 * selector, which will be contained on an <b>"inner window"</b>:
1918 * @image html screenshots/fileselector_entry_example_01.png
1919 * @image latex screenshots/fileselector_entry_example_01.eps width=\textwidth
1921 * Toggle the "inwin mode" switch off and, if you click on the file
1922 * selector entry again, you'll get @b two windows, the original one
1923 * (note the last selection there!)
1925 * @image html screenshots/fileselector_entry_example_02.png
1926 * @image latex screenshots/fileselector_entry_example_02.eps width=\textwidth
1928 * and the file selector's new one
1930 * @image html screenshots/fileselector_entry_example_03.png
1931 * @image latex screenshots/fileselector_entry_example_03.eps width=\textwidth
1933 * Play with the checkboxes to get the behavior changes on the file
1934 * selector entry. The respective API calls on the widget coming from
1935 * those knobs where shown in the code already.
1937 * See the full @ref fileselector_entry_example_c "source code" for
1940 * @example fileselector_entry_example.c
1944 * @page layout_example_01 Layout - Content, Table and Box
1946 * This example shows how one can use the @ref Layout widget to create a
1947 * customized distribution of widgets on the screen, controled by an Edje theme.
1948 * The full source code for this example can be found at @ref
1949 * layout_example_01_c.
1951 * Our custom layout is defined by a file, @ref layout_example_edc, which is an
1952 * Edje theme file. Look for the Edje documentation to understand it. For now,
1953 * it's enough to know that we describe some specific parts on this layout
1955 * @li a title text field;
1956 * @li a box container;
1957 * @li a table container;
1958 * @li and a content container.
1960 * Going straight to the code, the following snippet instantiates the layout
1963 * @dontinclude layout_example_01.c
1964 * @skip elm_layout_add
1965 * @until evas_object_show(layout)
1967 * As any other widget, we set some properties for the size calculation. But
1968 * notice on this piece of code the call to the function elm_layout_file_set().
1969 * Here is where the theme file is loaded, and particularly the specific group
1970 * from this theme file. Also notice that the theme file here is referenced as
1971 * an .edj, which is a .edc theme file compiled to its binary form. Again, look
1972 * for the Edje documentation for more information about theme files.
1974 * Next, we fetch from our theme a data string referenced by the key "title".
1975 * This data was defined in the theme, and can be used as parameters which the
1976 * program get from the specific theme that it is using. In this case, we store
1977 * the title of this window and program in the theme, as a "data" entry, just
1978 * for demonstration purposes:
1982 * This call elm_layout_data_get() is used to fetch the string based on the key,
1983 * and elm_object_text_part_set() will set the part defined in the theme as
1984 * "example/title" to contain this string. This key "example/title" has nothing
1985 * special. It's just an arbitrary convention that we are using in this example.
1986 * Every string in this example referencing a part of this theme will be of the
1987 * form "example/<something>".
1989 * Now let's start using our layout to distribute things on the window space.
1990 * Since the layout was added as a resize object to the elementary window, it
1991 * will always occupy the entire space available for this window.
1993 * The theme already has a title, and it also defines a table element which is
1994 * positioned approximately between 50% and 70% of the height of this window,
1995 * and has 100% of the width. We create some widgets (two icons, a clock and a
1996 * button) and pack them inside the table, in a distribution similar to a HTML
1999 * @until evas_object_show(bt)
2001 * Notice that we just set size hints for every object, and call the function
2002 * elm_layout_table_pack(), which does all the work. It will place the elements
2003 * in the specified row/column, with row and column span if required, and then
2004 * the object's size and position will be controled by the layout widget. It
2005 * will also respect size hints, alignments and weight properties set to these
2006 * widgets. The resulting distribution on the screen depends on the table
2007 * properties (described in the theme), the size hints set on each widget, and
2008 * on the cells of the table that are being used.
2010 * For instance, we add the two icons and the clock on the first, second and
2011 * third cells of the first row, and add the button the second row, making it
2012 * span for 3 columns (thus having the size of the entire table width). This
2013 * will result in a table that has 2 rows and 3 columns.
2015 * Now let's add some widgets to the box area of our layout. This box is around
2016 * 20% and 50% of the vertical size of the layout, and 100% of its width. The
2017 * theme defines that it will use an "horizontal flow" distribution to its
2018 * elements. Unlike the table, a box will distribute elements without knowing
2019 * about rows and columns, and the distribution function selected will take care
2020 * of putting them in row, column, both, or any other available layout. This is
2021 * also described in the Edje documentation.
2023 * This box area is similar to the @ref Box widget of elementary, with the
2024 * difference that its position and properties are controled by the theme of the
2025 * layout. It also contains more than one API to add items to it, since the
2026 * items position now is defined in terms of a list of items, not a matrix.
2027 * There's the first position (can have items added to it with
2028 * elm_layout_box_prepend()), the last position (elm_layout_box_append()), the
2029 * nth position (elm_layout_box_insert_at()) and the position right before an
2030 * element (elm_layout_box_insert_before()). We use insert_at and prepend
2031 * functions to add the first two buttons to this box, and insert_before on the
2032 * callback of each button. The callback code will be shown later, but it
2033 * basically adds a button just before the clicked button using the
2034 * elm_layout_box_insert_before() function. Here's the code for adding the first
2037 * @until evas_object_show(item)
2038 * @until evas_object_show(item)
2040 * Finally, we have an area in this layout theme, in the bottom part of it,
2041 * reserved for adding an specific widget. Differently from the 2 parts
2042 * described until now, this one can only receive one widget with the call
2043 * elm_layout_content_set(). If there was already an item on this specific part,
2044 * it will be deleted (one can use elm_layout_content_unset() in order to remove
2045 * it without deleting). An example of removing it without deleting, but
2046 * manually deleting this widget just after that, can be seen on the callback
2047 * for this button. Actually, the callback defined for this button will clean
2048 * the two other parts (deleting all of their elements) and then remove and
2049 * delete this button.
2051 * @until _swallow_btn_cb
2053 * Also notice that, for this last added button, we don't have to call
2054 * evas_object_show() on it. This is a particularity of the theme for layouts,
2055 * that will have total control over the properties like size, position,
2056 * visibility and clipping of a widget added with elm_layout_content_set().
2057 * Again, read the Edje documentation to understand this better.
2059 * Now we just put the code for the different callbacks specified for each kind
2060 * of button and make simple comments about them:
2062 * @dontinclude layout_example_01.c
2064 * @until evas_object_del(item)
2067 * The first callback is used for the button in the table, and will just remove
2068 * itself from the table with elm_layout_table_unpack(), which remove items
2069 * without deleting them, and then calling evas_object_del() on itself.
2071 * The second callback is for buttons added to the box. When clicked, these
2072 * buttons will create a new button, and add them to the same box, in the
2073 * position just before the clicked button.
2075 * And the last callback is for the button added to the "content" area. It will
2076 * clear both the table and the box, passing @c EINA_TRUE to their respective @c
2077 * clear parameters, which will imply on the items of these containers being
2080 * A screenshot of this example can be seen on:
2082 * @image html screenshots/layout_example_01.png
2083 * @image latex screenshots/layout_example_01.eps width=\textwidth
2088 * @page layout_example_02 Layout - Predefined Layout
2090 * This example shows how one can use the @ref Layout with a predefined theme
2091 * layout to add a back and next button to a simple window. The full source code
2092 * for this example can be found at @ref layout_example_02_c.
2094 * After setting up the window and background, we add the layout widget to the
2095 * window. But instead of using elm_layout_file_set() to load its theme from a
2096 * custom theme file, we can use elm_layout_theme_set() to load one of the
2097 * predefined layouts that come with elementary. Particularly on this example,
2098 * we load the them of class "layout", group "application" and style
2099 * "content-back-next" (since we want the back and next buttons).
2101 * @dontinclude layout_example_02.c
2102 * @skip elm_layout_add
2103 * @until evas_object_show(layout)
2105 * This default theme contains only a "content" area named
2106 * "elm.swallow.content", where we can add any widget (it can be even a
2107 * container widget, like a box, frame, list, or even another layout). Since we
2108 * just want to show the resulting layout, we add a simple icon to it:
2110 * @until layout_content_set
2112 * This default layout also provides some signals when the next and prev buttons
2113 * are clicked. We can register callbacks to them with the
2114 * elm_object_signal_callback_add() function:
2116 * @until elm,action,next
2118 * In the @ref layout_example_03 you can see how to send signals to the layout with
2119 * elm_object_signal_emit().
2121 * Now our callback just changes the picture being displayed when one of the
2122 * buttons are clicked:
2124 * @dontinclude layout_example_02.c
2126 * @until standard_set
2129 * It's possible to see that it gets the name of the image being shown from the
2130 * array of image names, going forward on this array when "next" is clicked and
2131 * backward when "back" is clicked.
2133 * A screenshot of this example can be seen on:
2135 * @image html screenshots/layout_example_02.png
2136 * @image latex screenshots/layout_example_02.eps width=\textwidth
2140 * @page layout_example_03 Layout - Signals and Size Changed
2142 * This example shows how one can send and receive signals to/from the layout,
2143 * and what to do when the layout theme has its size changed. The full source
2144 * code for this example can be found at @ref layout_example_03_c.
2146 * In this exmaple we will use another group from the same layout theme file
2147 * used in @ref layout_example_01. Its instanciation and loading happens in the
2150 * @dontinclude layout_example_03.c
2151 * @skip elm_layout_add
2152 * @until evas_object_show
2154 * This time we register a callback to be called whenever we receive a signal
2155 * after the end of the animation that happens in this layout:
2157 * @until signal_callback_add
2159 * We also add a button that will send signals to the layout:
2161 * @until callback_add
2163 * The callback for this button will check what type of signal it should send,
2164 * and then emit it. The code for this callback follows:
2166 * @dontinclude layout_exmaple_03.c
2167 * @skip static Eina_Bool
2172 * As we said before, we are receiving a signal whenever the animation started
2173 * by the button click ends. This is the callback for that signal:
2177 * Notice from this callback that the elm_layout_sizing_eval() function must be
2178 * called if we want our widget to update its size after the layout theme having
2179 * changed its minimum size. This happens because the animation specified in the
2180 * theme increases the size of the content area to a value higher than the
2181 * widget size, thus requiring more space. But the elementary layout widget
2182 * has no way to know this, thus needing the elm_layout_sizing_eval() to
2183 * be called on the layout, informing that this size has changed.
2185 * A screenshot of this example can be seen on:
2187 * @image html screenshots/layout_example_03.png
2188 * @image latex screenshots/layout_example_03.eps width=\textwidth
2192 * @page tutorial_hover Hover example
2193 * @dontinclude hover_example_01.c
2195 * On this example we are going to have a button that when clicked will show our
2196 * hover widget, this hover will have content set on it's left, top, right and
2197 * middle positions. In the middle position we are placing a button that when
2198 * clicked will hide the hover. We are also going to use a non-default theme
2199 * for our hover. We won't explain the functioning of button for that see @ref
2202 * We start our example with a couple of callbacks that show and hide the data
2203 * they're given(which we'll see later on is the hover widget):
2208 * In our main function we'll do some initialization and then create 3
2209 * rectangles, one red, one green and one blue to use in our hover. We'll also
2210 * create the 2 buttons that will show and hide the hover:
2213 * With all of that squared away we can now get to the heart of the matter,
2214 * creating our hover widget, which is easy as pie:
2217 * Having created our hover we now need to set the parent and target. Which if
2218 * you recall from the function documentations are going to tell the hover which
2219 * area it should cover and where it should be centered:
2222 * Now we set the theme for our hover. We're using the popout theme which gives
2223 * our contents a white background and causes their appearance to be animated:
2226 * And finally we set the content for our positions:
2229 * So far so good? Great 'cause that's all there is too it, what is left now is
2230 * just connecting our buttons to the callbacks we defined at the beginning of
2231 * the example and run the main loop:
2234 * Our example will initially look like this:
2236 * @image html screenshots/hover_example_01.png
2237 * @image latex screenshots/hover_example_01.eps width=\textwidth
2239 * And after you click the "Show hover" button it will look like this:
2241 * @image html screenshots/hover_example_01_a.png
2242 * @image latex screenshots/hover_example_01_a.eps width=\textwidth
2244 * @example hover_example_01.c
2248 * @page tutorial_flip Flip example
2249 * @dontinclude flip_example_01.c
2251 * This example will show a flip with two rectangles on it(one blue, one
2252 * green). Our example will allow the user to choose the animation the flip
2253 * uses and to interact with it. To allow the user to choose the interaction
2254 * mode we use radio buttons, we will however not explain them, if you would
2255 * like to know more about radio buttons see @ref radio.
2257 * We start our example with the usual setup and then create the 2 rectangles
2258 * we will use in our flip:
2259 * @until show(rect2)
2261 * The next thing to do is to create our flip and set it's front and back
2265 * The next thing we do is set the interaction mode(which the user can later
2266 * change) to the page animation:
2269 * Setting a interaction mode however is not sufficient, we also need to
2270 * choose which directions we allow interaction from, for this example we
2271 * will use all of them:
2274 * We are also going to set the hitsize to the entire flip(in all directions)
2275 * to make our flip very easy to interact with:
2278 * After that we create our radio buttons and start the main loop:
2281 * When the user clicks a radio button a function that changes the
2282 * interaction mode and animates the flip is called:
2284 * @note The elm_flip_go() call here serves no purpose other than to
2285 * ilustrate that it's possible to animate the flip programmatically.
2287 * Our example will look like this:
2289 * @image html screenshots/flip_example_01.png
2290 * @image latex screenshots/flip_example_01.eps width=\textwidth
2292 * @note Since this is an animated example the screenshot doesn't do it
2293 * justice, it is a good idea to compile it and see the animations.
2295 * @example flip_example_01.c
2299 * @page tutorial_label Label example
2300 * @dontinclude label_example_01.c
2302 * In this example we are going to create 6 labels, set some properties on
2303 * them and see what changes in appearance those properties cause.
2305 * We start with the setup code that by now you should be familiar with:
2308 * For our first label we have a moderately long text(that doesn't fit in the
2309 * label's width) so we will make it a sliding label. Since the text isn't
2310 * too long we don't need the animation to be very long, 3 seconds should
2311 * give us a nice speed:
2314 * For our second label we have the same text, but this time we aren't going
2315 * to have it slide, we're going to ellipsize it. Because we ask our label
2316 * widget to ellipsize the text it will first diminsh the fontsize so that it
2317 * can show as much of the text as possible:
2320 * For the third label we are going to ellipsize the text again, however this
2321 * time to make sure the fontsize isn't diminshed we will set a line wrap.
2322 * The wrap won't actually cause a line break because we set the label to
2326 * For our fourth label we will set line wrapping but won't set ellipsis, so
2327 * that our text will indeed be wrapped instead of ellipsized. For this label
2328 * we choose character wrap:
2331 * Just two more, for our fifth label we do the same as for the fourth
2332 * except we set the wrap to word:
2335 * And last but not least for our sixth label we set the style to "marker" and
2336 * the color to red(the default color is white which would be hard to see on
2337 * our white background):
2340 * Our example will look like this:
2342 * @image html screenshots/label_example_01.png
2343 * @image latex screenshots/label_example_01.eps width=\textwidth
2345 * @example label_example_01.c
2349 * @page tutorial_image Image example
2350 * @dontinclude image_example_01.c
2352 * This example is as simple as possible. An image object will be added to the
2353 * window over a white background, and set to be resizeable together with the
2354 * window. All the options set through the example will affect the behavior of
2357 * We start with the code for creating a window and its background, and also
2358 * add the code to write the path to the image that will be loaded:
2363 * Now we create the image object, and set that file to be loaded:
2367 * We can now go setting our options.
2369 * elm_image_no_scale_set() is used just to set this value to true (we
2370 * don't want to scale our image anyway, just resize it).
2372 * elm_image_scale_set() is used to allow the image to be resized to a size
2373 * smaller than the original one, but not to a size bigger than it.
2375 * elm_elm_image_smooth_set() will disable the smooth scaling, so the scale
2376 * algorithm used to scale the image to the new object size is going to be
2377 * faster, but with a lower quality.
2379 * elm_image_orient_set() is used to flip the image around the (1, 0) (0, 1)
2382 * elm_image_aspect_ratio_retained_set() is used to keep the original aspect
2383 * ratio of the image, even when the window is resized to another aspect ratio.
2385 * elm_image_fill_outside_set() is used to ensure that the image will fill the
2386 * entire area available to it, even if keeping the aspect ratio. The image
2387 * will overflow its width or height (any of them that is necessary) to the
2388 * object area, instead of resizing the image down until it can fit entirely in
2391 * elm_image_editable_set() is used just to cover the API, but won't affect
2392 * this example since we are not using any copy & paste property.
2394 * This is the code for setting these options:
2398 * Now some last touches in our object size hints, window and background, to
2399 * display this image properly:
2403 * This example will look like this:
2405 * @image html screenshots/image_example_01.png
2406 * @image latex screenshots/image_example_01.eps width=\textwidth
2408 * @example image_example_01.c
2412 * @page tutorial_icon Icon example
2413 * @dontinclude icon_example_01.c
2415 * This example is as simple as possible. An icon object will be added to the
2416 * window over a white background, and set to be resizeable together with the
2417 * window. All the options set through the example will affect the behavior of
2420 * We start with the code for creating a window and its background:
2425 * Now we create the icon object, and set lookup order of the icon, and choose
2430 * An intersting thing is that after setting this, it's possible to check where
2431 * in the filesystem is the theme used by this icon, and the name of the group
2436 * We can now go setting our options.
2438 * elm_icon_no_scale_set() is used just to set this value to true (we
2439 * don't want to scale our icon anyway, just resize it).
2441 * elm_icon_scale_set() is used to allow the icon to be resized to a size
2442 * smaller than the original one, but not to a size bigger than it.
2444 * elm_elm_icon_smooth_set() will disable the smooth scaling, so the scale
2445 * algorithm used to scale the icon to the new object size is going to be
2446 * faster, but with a lower quality.
2448 * elm_icon_fill_outside_set() is used to ensure that the icon will fill the
2449 * entire area available to it, even if keeping the aspect ratio. The icon
2450 * will overflow its width or height (any of them that is necessary) to the
2451 * object area, instead of resizing the icon down until it can fit entirely in
2454 * This is the code for setting these options:
2456 * @until fill_outside
2458 * However, if you try this example you may notice that this image is not being
2459 * affected by all of these options. This happens because the used icon will be
2460 * from elementary theme, and thus it has its own set of options like smooth
2461 * scaling and fill_outside options. You can change the "home" icon to use some
2462 * image (from your system) and see that then those options will be respected.
2464 * Now some last touches in our object size hints, window and background, to
2465 * display this icon properly:
2469 * This example will look like this:
2471 * @image html screenshots/icon_example_01.png
2472 * @image latex screenshots/icon_example_01.eps width=\textwidth
2474 * @example icon_example_01.c
2478 * @page tutorial_hoversel Hoversel example
2479 * @dontinclude hoversel_example_01.c
2481 * In this example we will create a hoversel with 3 items, one with a label but
2482 * no icon and two with both a label and an icon. Every item that is clicked
2483 * will be deleted, but everytime the hoversel is activated we will also add an
2484 * item. In addition our first item will print all items when clicked and our
2485 * third item will clear all items in the hoversel.
2487 * We will start with the normal creation of window stuff:
2490 * Next we will create a red rectangle to use as the icon of our hoversel:
2493 * And now we create our hoversel and set some of it's properties. We set @p win
2494 * as its parent, ask it to not be horizontal(be vertical) and give it a label
2498 * Next we will add our three items, setting a callback to be called for the
2502 * We also set a pair of callbacks to be called whenever any item is selected or
2503 * when the hoversel is activated:
2506 * And then ask that our hoversel be shown and run the main loop:
2509 * We now have the callback for our first item which prints all items in the
2513 * Next we have the callback for our third item which removes all items from the
2517 * Next we have the callback that is called whenever an item is clicked and
2518 * deletes that item:
2521 * And the callback that is called when the hoversel is activated and adds an
2522 * item to the hoversel. Note that since we allocate memory for the item we need
2523 * to know when the item dies so we can free that memory:
2526 * And finally the callback that frees the memory we allocated for items created
2527 * in the @p _add_item callback:
2530 * Our example will initially look like this:
2532 * @image html screenshots/hoversel_example_01.png
2533 * @image latex screenshots/hoversel_example_01.eps width=\textwidth
2535 * And when the hoversel is clicked it will look like this:
2537 * @image html screenshots/hoversel_example_01_a.png
2538 * @image latex screenshots/hoversel_example_01_a.eps width=\textwidth
2540 * @example hoversel_example_01.c
2544 * @page conformant_example Conformant Example.
2546 * In this example we'll explain how to create applications to work
2547 * with illume, considering space required for virtual keyboards, indicator
2550 * Illume is a module for Enlightenment that modifies the user interface
2551 * to work cleanly and nicely on a mobile device. It has support for
2552 * virtual keyboard, among other nice features.
2554 * Let's start creating a very simple window with a vertical box
2555 * with multi-line entry between two buttons.
2556 * This entry will expand filling all space on window not used by buttons.
2558 * @dontinclude conformant_example_01.c
2559 * @skipline elm_main
2562 * For information about how to create windows, boxes, buttons or entries,
2563 * look for documentation for these widgets.
2565 * It will looks fine when you don't need a virtual keyboard, as you
2566 * can see on the following image:
2568 * @image html screenshots/conformant_example_01.png
2569 * @image latex screenshots/conformant_example_01.eps width=\textwidth
2571 * But if you call a virtual keyboard, the window will resize, changing
2572 * widgets size and position. All the content will shrink.
2574 * If you don't want such behaviour, you
2575 * will need a conformant to account for space taken up by the indicator,
2576 * virtual keyboard and softkey.
2578 * In this case, using the conformant in a proper way, you will have
2579 * a window like the following:
2581 * @image html screenshots/conformant_example_02.png
2582 * @image latex screenshots/conformant_example_02.eps width=\textwidth
2584 * As you can see, it guess the space that will be required by the keyboard,
2585 * indicator and softkey bars.
2587 * So, let's study each step required to transform our initial example on
2590 * First of all, we need to set the window as an illume conformant window:
2591 * @dontinclude conformant_example_02.c
2592 * @skipline elm_win_conformant_set
2594 * Next, we'll add a conformant widget, and set it to resize with the window,
2595 * instead of the box.
2597 * @until evas_object_show
2599 * Finally, we'll set the box as conformant's content, just like this:
2600 * @skipline elm_conformant_content_set
2602 * Compare both examples code:
2603 * @ref conformant_example_01.c "conformant_example_01.c"
2604 * @ref conformant_example_02.c "conformant_example_02.c"
2606 * @example conformant_example_01.c
2607 * @example conformant_example_02.c
2611 * @page index_example_01 Index widget example 1
2613 * This code places an Elementary index widget on a window, which also
2614 * has a very long list of arbitrary strings on it. The list is
2615 * sorted alphabetically and the index will be used to index the first
2616 * items of each set of strings beginning with an alphabet letter.
2618 * Below the list are some buttons, which are there just to exercise
2619 * some index widget's API.
2621 * Here's how we instantiate it:
2622 * @dontinclude index_example_01.c
2623 * @skip elm_list_add
2624 * @until evas_object_show(d.index)
2625 * where we're showing also the list being created. Note that we issue
2626 * elm_win_resize_object_add() on the index, so that it's set to have
2627 * the whole window as its container. Then, we have to populate both
2628 * list and index widgets:
2629 * @dontinclude index_example_01.c
2630 * @skip for (i = 0; i < (sizeof(dict) / sizeof(dict[0])); i++)
2634 * The strings populating the list come from a file
2635 * @dontinclude index_example_01.c
2636 * @skip static const char *dict
2639 * We use the @c curr char variable to hold the last initial letter
2640 * seen on that ordered list of strings, so that we're able to have an
2641 * index item pointing to each list item starting a new letter
2642 * "section". Note that our index item data pointers will be the list
2643 * item handles. We are also setting a callback function to index
2644 * items deletion events:
2645 * @dontinclude index_example_01.c
2649 * There, we show you that the @c event_info pointer will contain the
2650 * item in question's data, i.e., a given list item's pointer. Because
2651 * item data is also returned in the @c data argument on
2652 * @c Evas_Smart_Cb functions, those two pointers must have the same
2653 * values. On this deletion callback, we're deleting the referred list
2654 * item too, just to exemplify that anything could be done there.
2656 * Next, we hook to two smart events of the index object:
2657 * @dontinclude index_example_01.c
2658 * @skip smart_callback_add(d.index
2659 * @until _index_selected
2660 * @dontinclude index_example_01.c
2661 * @skip "delay,changed" hook
2665 * Check that, whenever one holds the mouse pressed over a given index
2666 * letter for some time, the list beneath it will roll down to the
2667 * item pointed to by that index item. When one releases the mouse
2668 * button, the second callback takes place. There, we check that the
2669 * reported item data, on @c event_info, is the same reported by
2670 * elm_index_item_selected_get(), which gives the last selection's
2671 * data on the index widget.
2673 * The first of the three buttons that follow will call
2674 * elm_index_active_set(), thus showing the index automatically for
2675 * you, if it's not already visible, what is checked with
2676 * elm_index_active_get(). The second button will exercise @b deletion
2677 * of index item objects, by the following code:
2678 * @dontinclude index_example_01.c
2679 * @skip delete an index item
2682 * It will get the last index item selected's data and find the
2683 * respective #Elm_Index_Item handle with elm_index_item_find(). We
2684 * need the latter to query the indexing letter string from, with
2685 * elm_index_item_letter_get(). Next, comes the delition, itself,
2686 * which will also trigger the @c _index_item_del callback function,
2689 * The third button, finally, will exercise elm_index_item_clear(),
2690 * which will delete @b all of the index's items.
2692 * This is how the example program's window looks like with the index
2694 * @image html screenshots/index_example_00.png
2695 * @image latex screenshots/index_example_00.eps
2697 * When it's shown, it's like the following figure:
2698 * @image html screenshots/index_example_01.png
2699 * @image latex screenshots/index_example_01.eps
2701 * See the full @ref index_example_01_c "source code" for
2704 * @example index_example_01.c
2708 * @page index_example_02 Index widget example 2
2710 * This code places an Elementary index widget on a window, indexing
2711 * grid items. The items are placed so that their labels @b don't
2712 * follow any order, but the index itself is ordered (through
2713 * elm_index_item_sorted_insert()). This is a complement to to @ref
2714 * index_example_01 "the first example on indexes".
2716 * Here's the list of item labels to be used on the grid (in that
2718 * @dontinclude index_example_02.c
2719 * @skip static const char *items
2722 * In the interesting part of the code, here, we first instantiate the
2723 * grid (more on grids on their examples) and, after creating our
2724 * index, for each grid item we also create an index one to reference
2726 * @dontinclude index_example_02.c
2727 * @skip grid = elm_gengrid_add
2729 * @until smart_callback_add
2731 * The order in which they'll appear in the index, though, is @b
2732 * alphabetical, becase of elm_index_item_sorted_insert() usage
2733 * together with the comparing function, where we take the letters of
2734 * each index item to base our ordering on. The parameters on
2735 * @c _index_cmp have to be declared as void pointers because of the
2736 * @c Eina_Compare_Cb prototype requisition, but in this case we know
2737 * they'll be #Elm_Index_Item's:
2738 * @dontinclude index_example_02.c
2739 * @skip ordering alphabetically
2742 * The last interesting bit is the callback in the @c "delay,changed"
2743 * smart event, which will bring the given grid item to the grid's
2745 * @dontinclude index_example_02.c
2749 * Note how the grid will move kind of randomly while you move your
2750 * mouse pointer held over the index from top to bottom -- that's
2751 * because of the the random order the items have in the grid itself.
2753 * This is how the example program's window looks like:
2754 * @image html screenshots/index_example_03.png
2755 * @image latex screenshots/index_example_03.eps
2757 * See the full @ref index_example_c "source code" for
2760 * @example index_example_02.c
2764 * @page tutorial_ctxpopup Ctxpopup example
2765 * @dontinclude ctxpopup_example_01.c
2767 * In this example we have a list with two items, when either item is clicked
2768 * a ctxpopup for it will be shown. Our two ctxpopups are quite different, the
2769 * one for the first item is a vertical and it's items contain both labels and
2770 * icons, the one for the second item is horizontal and it's items have icons
2773 * We will begin examining our example code by looking at the callback we'll use
2774 * when items in the ctxpopup are clicked. It's very simple, all it does is
2775 * print the label present in the ctxpopup item:
2778 * Next we examine a function that creates ctxpopup items, it was created to
2779 * avoid repeating the same code whenever we needed to add an item to our
2780 * ctxpopup. Our function creates an icon from the standard set of icons, and
2781 * then creates the item, with the label received as an argument. We also set
2782 * the callback to be called when the item is clicked:
2785 * Finally we have the function that will create the ctxpopup for the first item
2786 * in our list. This one is somewhat more complex though, so let's go through it
2787 * in parts. First we declare our variable and add the ctxpopup:
2788 * @until ctxpopup_add
2790 * Next we create a bunch of items for our ctxpopup, marking two of them as
2791 * disabled just so we can see what that will look like:
2792 * @until disabled_set
2793 * @until disabled_set
2795 * Then we ask evas where the mouse pointer was so that we can have our ctxpopup
2796 * appear in the right place, set a maximum size for the ctxpopup, move it and
2800 * And last we mark the list item as not selected:
2803 * Our next function is the callback that will create the ctxpopup for the
2804 * second list item, it is very similar to the previous function. A couple of
2805 * interesting things to note is that we ask our ctxpopup to be horizontal, and
2806 * that we pass NULL as the label for every item:
2809 * And with all of that in place we can now get to our main function where we
2810 * create the window, the list, the list items and run the main loop:
2813 * The example will initially look like this:
2815 * @image html screenshots/ctxpopup_example_01.png
2816 * @image latex screenshots/ctxpopup_example_01.eps width=\textwidth
2818 * @note This doesn't show the ctxpopup tough, since it will only appear when
2819 * we click one of the list items.
2821 * Here is what our first ctxpopup will look like:
2823 * @image html screenshots/ctxpopup_example_01_a.png
2824 * @image latex screenshots/ctxpopup_example_01_a.eps width=\textwidth
2826 * And here the second ctxpopup:
2828 * @image html screenshots/ctxpopup_example_01_b.png
2829 * @image latex screenshots/ctxpopup_example_01_b.eps width=\textwidth
2831 * @example ctxpopup_example_01.c
2835 * @page tutorial_pager
2836 * @dontinclude pager_example_01.c
2838 * In this example we'll have a pager with 3 rectangles on it, one blue, one
2839 * green and one blue, we'll also have 1 button for each rectangle. Pressing a
2840 * button will bring the associated rectangle to the front of the pager(promote
2843 * We start our example with some run of the mill code that you've seen in other
2847 * And then we get right to creating our pager, setting a style and some basic
2851 * Well a pager without any content is not of much use, so let's create the
2852 * first of our rectangles, add it to the pager and create the button for it:
2853 * @until smart_callback
2854 * @note The only line of above code that directly relates to our pager is the
2855 * call to elm_pager_content_push().
2857 * And now we will do the same thing again twice for our next two rectangles:
2858 * @until smart_callback
2859 * @until smart_callback
2861 * Now that we haver our widgets create we can get to running the main loop:
2864 * We also have the callback that is called when any of the buttons is pressed,
2865 * this callback is receiving the rectangle in it's @p data argument, so we
2866 * check if it's already on top and if not move it there:
2869 * Our example will look like this:
2871 * @image html screenshots/pager_example_01.png
2872 * @image latex screenshots/pager_example_01.eps width=\textwidth
2873 * @note Like all examples that involve animations the screenshot doesn't do it
2874 * justice, seeing it in action is a must.
2876 * @example pager_example_01.c
2880 * @page bg_example_01_c bg_example_01.c
2881 * @include bg_example_01.c
2882 * @example bg_example_01.c
2886 * @page bg_example_02_c bg_example_02.c
2887 * @include bg_example_02.c
2888 * @example bg_example_02.c
2892 * @page bg_example_03_c bg_example_03.c
2893 * @include bg_example_03.c
2894 * @example bg_example_03.c
2898 * @page actionslider_example_01 Actionslider example
2899 * @include actionslider_example_01.c
2900 * @example actionslider_example_01.c
2904 * @page animator_example_01_c Animator example 01
2905 * @include animator_example_01.c
2906 * @example animator_example_01.c
2910 * @page transit_example_01_c Transit example 1
2911 * @include transit_example_01.c
2912 * @example transit_example_01.c
2916 * @page transit_example_02_c Transit example 2
2917 * @include transit_example_02.c
2918 * @example transit_example_02.c
2922 * @page general_functions_example_c General (top-level) functions example
2923 * @include general_funcs_example.c
2924 * @example general_funcs_example.c
2928 * @page clock_example_c Clock example
2929 * @include clock_example.c
2930 * @example clock_example.c
2934 * @page flipselector_example_c Flipselector example
2935 * @include flipselector_example.c
2936 * @example flipselector_example.c
2940 * @page fileselector_example_c Fileselector example
2941 * @include fileselector_example.c
2942 * @example fileselector_example.c
2946 * @page fileselector_button_example_c Fileselector button example
2947 * @include fileselector_button_example.c
2948 * @example fileselector_button_example.c
2952 * @page fileselector_entry_example_c Fileselector entry example
2953 * @include fileselector_entry_example.c
2954 * @example fileselector_entry_example.c
2958 * @page index_example_01_c Index example
2959 * @include index_example_01.c
2960 * @example index_example_01.c
2964 * @page index_example_02_c Index example
2965 * @include index_example_02.c
2966 * @example index_example_02.c
2970 * @page layout_example_01_c layout_example_01.c
2971 * @include layout_example_01.c
2972 * @example layout_example_01.c
2976 * @page layout_example_02_c layout_example_02.c
2977 * @include layout_example_02.c
2978 * @example layout_example_02.c
2982 * @page layout_example_03_c layout_example_03.c
2983 * @include layout_example_03.c
2984 * @example layout_example_03.c
2988 * @page layout_example_edc An example of layout theme file
2990 * This theme file contains two groups. Each of them is a different theme, and
2991 * can be used by an Elementary Layout widget. A theme can be used more than
2992 * once by many different Elementary Layout widgets too.
2994 * @include layout_example.edc
2995 * @example layout_example.edc