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
34 * @ref spinner_example
38 * @ref diskselector_example_01
40 * @ref diskselector_example_02
42 * @ref list_example_01
44 * @ref list_example_02
46 * @ref list_example_03
48 * @ref flipselector_example
50 * @ref fileselector_example
52 * @ref fileselector_button_example
54 * @ref fileselector_entry_example
56 * @ref index_example_01
58 * @ref index_example_02
60 * @ref gengrid_example
64 * @page bg_01_example_page elm_bg - Plain color background.
65 * @dontinclude bg_example_01.c
67 * The full code for this example can be found at @ref bg_example_01_c,
68 * in the function @c test_bg_plain. It's part of the @c elementar_test
69 * suite, and thus has the code for the three examples referenced by this
72 * This first example just sets a default background with a plain color. The
73 * first part consists of creating an Elementary window. It's the common
74 * piece of code that you'll see everywhere in Elementary: @skip elm_main
77 * Now we really create our background object, using the window object as
82 * Then we set the size hints of the background object so that it will use
83 * all space available for it, and then add it as a resize object to the
84 * window, making it visible in the end:
86 * @skip size_hint_weight_set
87 * @until resize_object_add
89 * See @ref evas_object_size_hint_weight_set and elm_win_resize_object_add()
90 * for more detailed info about these functions.
92 * The end of the example is quite simple, just setting the minimum and
93 * maximum size of the background, so the Elementary window knows that it
94 * has to have at least the minimum size. The background also won't scale to
95 * a size above its maximum. Then we resize the window and show it in the
98 * @skip set size hints
101 * And here we finish our very simple background object usage example.
105 * @page bg_02_example_page elm_bg - Image background.
106 * @dontinclude bg_example_02.c
108 * The full code for this example can be found at @ref bg_example_02_c,
109 * in the function @c test_bg_image. It's part of the @c elementar_test
110 * suite, and thus has the code for the three examples referenced by this
113 * This is the second example, and shows how to use the Elementary
114 * background object to set an image as background of your application.
116 * We start this example exactly in the same way as the previous one, even
117 * when creating the background object:
122 * Now it's the different part.
124 * Our background will have an image, that will be displayed over the
125 * background color. Before loading the image, we set the load size of the
126 * image. The load size is a hint about the size that we want the image
127 * displayed in the screen. It's not the exact size that the image will have,
128 * but usually a bit bigger. The background object can still be scaled to a
129 * size bigger than the one set here. Setting the image load size to
130 * something smaller than its real size will reduce the memory used to keep
131 * the pixmap representation of the image, and the time to load it. Here we
132 * set the load size to 20x20 pixels, but the image is loaded with a size
133 * bigger than that (since it's just a hint):
135 * @skipline load_size_set
137 * And set our background image to be centered, instead of stretched or
138 * scaled, so the effect of the elm_bg_load_size_set() can be easily
141 * @skipline option_set
143 * We need a filename to set, so we get one from the previous installed
144 * images in the @c PACKAGE_DATA_DIR, and write its full path to a buffer.
145 * Then we use this buffer to set the filename in the background object:
150 * Notice that the third argument of the elm_bg_file_set() function is @c
151 * NULL, since we are setting an image to this background. This function
152 * also supports setting an edje group as background, in which case the @c
153 * group parameter wouldn't be @c NULL, but be the name of the group
156 * Finally, we can set the size hints, add the background as a resize
157 * object, and resize the window, exactly the same thing we do in the @ref
158 * bg_01_example_page example:
163 * And this is the end of this example.
165 * This example will look like this:
167 * @image html screenshots/bg_01.png
168 * @image latex screenshots/bg_01.eps width=\textwidth
172 * @page bg_03_example_page elm_bg - Background properties.
173 * @dontinclude bg_example_03.c
175 * The full code for this example can be found at @ref bg_example_03_c, in the
176 * function @c test_bg_options, with the callbacks @c _cb_overlay_changed, @c
177 * _cb_color_changed and @c _cb_radio_changed defined in the beginning of the
178 * file. It's part of the @c elementar_test suite, and thus has the code for
179 * the three examples referenced by this documentation.
181 * This example will show the properties available for the background object,
182 * and will use of some more widgets to set them.
184 * In order to do this, we will set some callbacks for these widgets. The
185 * first is for the radio buttons that will be used to choose the option
186 * passed as argument to elm_bg_option_set():
188 * @skip _cb_radio_changed
191 * The next callback will be used when setting the overlay (using
192 * elm_bg_overlay_set()):
194 * @skip _cb_overlay_changed
198 * And the last one, used to set the color (with elm_bg_color_set()):
200 * @skip _cb_color_changed
203 * We will get back to what these functions do soon. If you want to know more
204 * about how to set these callbacks and what these widgets are, look for:
205 * @li elm_radio_add()
206 * @li elm_check_add()
207 * @li elm_spinner_add()
209 * Now going to the main function, @c test_bg_options, we have the common
210 * code with the other examples:
215 * We add a plain background to this window, so it will have the default
216 * background color behind everything:
218 * @skip bg = elm_bg_add
219 * @until evas_object_show(bg)
221 * Then we add a vertical box (elm_box_add()) that will hold the background
222 * object that we are going to play with, as well as a horizontal box that
226 * @until evas_object_show
228 * Now we add the background object that is going to be of use for our
229 * example. It is an image background, as used in @ref bg_02_example_page ,
230 * so the code should be familiar:
233 * @until evas_object_show
235 * Notice the call to elm_box_pack_end(): it will pack the background object
236 * in the end of the Elementary box declared above. Just refer to that
237 * documentation for more info.
239 * Since this Elementary background is already an image background, we are
240 * going to play with its other properties. We will change its option
241 * (CENTER, SCALE, STRETCH, TILE), its color (RGB), and add an overlay to it.
242 * For all of these properties, we are going to add widgets that will
245 * First, lets add the horizontal box that will hold these widgets:
249 * For now, just consider this @c hbox as a rectangle that will contain the
250 * widgets, and will distribute them horizontally inside its content. Then we
251 * add radio buttons that will allow us to choose the property to use with
255 * @until evas_object_show
257 * Again, I won't give details about the use of these widgets, just look for
258 * their documentation if necessary. It's enough to know for now that we are
259 * packing them in the @c hbox, setting a label for them, and the most
260 * important parts: setting its value to @c ELM_BG_OPTION_CENTER and its
261 * callback to @c _cb_radio_changed (the function defined in the beginning of
262 * this example). We do this for the next 3 radio buttons added after this
263 * one, each of them with a different value.
265 * Now taking a look at the code of the callback @c _cb_radio_changed again,
266 * it will call elm_bg_option_set() with the value set from the checked radio
267 * button, thus setting the option for this background. The background is
268 * passed as argument to the @p data parameter of this callback, and is
269 * referenced here as @c o_bg.
271 * Later we set the default value for this radio button:
273 * @skipline elm_radio_value_set
275 * Then we add a checkbox for the elm_bg_overlay_set() function:
278 * @until evas_object_show
280 * Now look at the code of the @c _cb_overlay_changed again. If the checkbox
281 * state is checked, an overlay will be added to the background. It's done by
282 * creating an Edje object, and setting it with elm_bg_overlay_set() to the
283 * background object. For information about what are and how to set Edje
284 * object, look at the Edje documentation.
286 * Finally we add a spinner object (elm_spinner_add()) to be used to select
287 * the color of our background. In its callback it's possible to see the call
288 * to elm_bg_color_set(), which will change the color of this background.
289 * This color is used by the background to fill areas where the image doesn't
290 * cover (in this case, where we have an image background). The spinner is
291 * also packed into the @c hbox :
293 * @skip elm_spinner_add
294 * @until evas_object_show
296 * Then we just have to pack the @c hbox inside the @c box, set some size
297 * hints, and show our window:
302 * Now to see this code in action, open elementary_test, and go to the "Bg
303 * Options" test. It should demonstrate what was implemented here.
307 * @page actionslider_example_page Actionslider usage
308 * @dontinclude actionslider_example_01.c
310 * For this example we are going to assume knowledge of evas smart callbacks
311 * and some basic evas object functions. Elementary is not meant to be used
312 * without evas, if you're not yet familiar with evas it probably is worth
315 * And now to the example, when using Elementary we start by including
319 * Next we define some callbacks, they all share the same signature because
320 * they are all to be used with evas_object_smart_callback_add().
321 * The first one just prints the selected label(in two different ways):
324 * This next callback is a little more interesting, it makes the selected
325 * label magnetic(except if it's the center label):
328 * This callback enables or disables the magnetic propertty of the center
332 * And finally a callback to stop the main loop when the window is closed:
335 * To be able to create our actionsliders we need to do some setup, but this
336 * isn't really relevant here, so if you want to know about that go @ref
339 * With all that boring stuff out of the way we can proceed to creating some
341 * All actionsliders are created the same way:
342 * @skipline actionslider_add
343 * Next we must choose where the indicator starts, and for this one we choose
344 * the right, and set the right as magnetic:
345 * @skipline indicator_pos_set
346 * @until magnet_pos_set
348 * We then set the labels for the left and right, passing NULL as an argument
349 * to any of the labels makes that position have no label.
352 * Furthermore we mark both left and right as enabled positions, if we didn't
353 * do this all three positions would be enabled:
356 * Having the the enabled positions we now add a smart callback to change
357 * which position is magnetic, so that only the last selected position is
361 * And finally we set our printing callback and show the actionslider:
365 * For our next actionslider we are going to do much as we did for the
366 * previous except we are going to have the center as the magnet(and not
368 * @skipline actionslider_add
369 * @skipline indicator_pos_set
372 * And another actionslider, in this one the indicator starts on the left.
373 * It has labels only in the center and right, and both bositions are
374 * magnetic. Because the left doesn't have a label and is not magnetic once
375 * the indicator leaves it can't return:
376 * @skipline actionslider_add
377 * @skipline indicator_pos_set
379 * @note The greyed out area is a @ref Styles "style".
381 * And now an actionslider with a label in the indicator, and whose magnet
382 * properties change based on what was last selected:
383 * @skipline actionslider_add
384 * @skipline indicator_pos_set
386 * @note The greyed out area is a @ref Styles "style".
388 * We are almost done, this next one is just an actionslider with all
389 * positions magnetized and having every possible label:
390 * @skipline actionslider_add
391 * @skipline indicator_pos_set
394 * And for our last actionslider we have one that turns the magnetic property
396 * @skipline actionslider_add
397 * @skipline indicator_pos_set
400 * The example will look like this:
402 * @image html screenshots/actionslider_01.png
403 * @image latex screenshots/actionslider_01.eps width=\textwidth
405 * See the full source code @ref actionslider_example_01 "here"
409 * @page elm_animator_example_page_01 Animator usage
410 * @dontinclude animator_example_01.c
412 * For this example we will be using a bit of evas, you could animate a
413 * elementary widget in much the same way, but to keep things simple we use
414 * an evas_object_rectangle.
416 * As every other example we start with our include and a simple callback to
417 * exit the app when the window is closed:
421 * This next callback is the one that actually creates our animation, it
422 * changes the size, position and color of a rectangle given to it in @a
426 * Next we have a callback that prints a string, nothing special:
429 * This next callback is a little more interesting, it has a state variable
430 * to know if the animation is currently paused or running, and it toogles
431 * the state of the animation accordingly:
436 * Finally we have a callback to stop the animation:
439 * As with every example we need to do a bit of setup before we can actually
440 * use an animation, but for the purposes of this example that's not relevant
441 * so let's just skip to the good stuff, creating an animator:
442 * @skipline animator_add
443 * @note Since elm_animator is not a widget we can give it a NULL parent.
445 * Now that we have an elm_animator we set it's duration to 1 second:
448 * We would also like our animation to be reversible, so:
451 * We also set our animation to repeat as many times as possible, which will
452 * mean that _end_cb will only be called after UINT_MAX * 2 seconds(UINT_MAX
453 * for the animation running forward and UNIT_MAX for the animation running
457 * To add some fun to our animation we will use the IN_OUT curve style:
460 * To actually animate anything we need an operation callback:
461 * @line operation_callback
463 * Even though we set our animation to repeat for a very long time we are
464 * going to set a end callback to it:
465 * @line completion_callback
466 * @note Notice that stoping the animation with the stop button will not make
469 * Now that we have fully set up our animator we can tell it to start
473 * There's a bit more of code that doesn't really matter to use so we skip
474 * right down to our last interesting point:
475 * @skipline animator_del
476 * @note Because we created our animator with no parent we need to delete it
479 * The example should look like this:
481 * @image html screenshots/animator_example_01.png
482 * @image latex screenshots/animator_example_01.eps width=\textwidth
484 * @image html screenshots/animator_example_02.png
485 * @image latex screenshots/animator_example_02.eps width=\textwidth
487 * @image html screenshots/animator_example_03.png
488 * @image latex screenshots/animator_example_03.eps width=\textwidth
490 * The full source code for this example can be found @ref
491 * animator_example_01_c "here"
495 * @page transit_example_03_c elm_transit - Combined effects and options.
497 * This example shows how to apply the following transition effects:
505 * It allows you to apply more than one effect at once, and also allows to
506 * set properties like event_enabled, auto_reverse, repeat_times and
509 * @include transit_example_03.c
513 * @page transit_example_04_c elm_transit - Combined effects over two objects.
515 * This example shows how to apply the transition effects:
520 * over two objects. This kind of transition effect is used to make one
521 * object disappear and another one appear on its place.
523 * You can mix more than one effect of this type on the same objects, and the
524 * transition will apply both.
526 * @include transit_example_04.c
530 * @page transit_example_01_explained elm_transit - Basic transit usage.
531 * @dontinclude transit_example_01.c
533 * The full code for this example can be found at @ref transit_example_01_c.
535 * This example shows the simplest way of creating a transition and applying
536 * it to an object. Similarly to every other elementary example, we create a
537 * window, set its title, size, autodel property, and setup a callback to
538 * exit the program when finished:
541 * @until evas_object_resize
543 * We also add a resizeable white background to use behind our animation:
546 * @until evas_object_show
548 * And then we add a button that we will use to demonstrate the effects of
552 * @until evas_object_show(win)
554 * Notice that we are not adding the button with elm_win_resize_object_add()
555 * because we don't want the window to control the size of the button. We
556 * will use the transition to change the button size, so it could conflict
557 * with something else trying to control that size.
559 * Now, the simplest code possible to create the resize animation:
564 * As you can see, this code is very easy to understand. First, we create the
565 * transition itself with elm_transit_add(). Then we add the button to this
566 * transition with elm_transit_object_add(), which means that the transition
567 * will operate over this button. The effect that we want now is changing the
568 * object size from 100x50 to 300x150, and can be achieved by adding the
569 * resize effect with elm_transit_effect_resizing_add().
571 * Finally, we set the transition time to 5 seconds and start the transition
572 * with elm_transit_go(). If we wanted more effects applied to this
573 * button, we could add them to the same transition. See the
574 * @ref transit_example_03_c to watch many transitions being applied to an
579 * @page transit_example_02_explained elm_transit - Chained transitions.
580 * @dontinclude transit_example_02.c
582 * The full code for this example can be found at @ref transit_example_02_c.
584 * This example shows how to implement a chain of transitions. This chain is
585 * used to start a transition just after another transition ended. Similarly
586 * to every other elementary example, we create a window, set its title,
587 * size, autodel property, and setup a callback to exit the program when
591 * @until evas_object_resize
593 * We also add a resizeable white background to use behind our animation:
596 * @until evas_object_show
598 * This example will have a chain of 4 transitions, each of them applied to
599 * one button. Thus we create 4 different buttons:
602 * @until evas_object_show(bt4)
604 * Now we create a simple translation transition that will be started as soon
605 * as the program loads. It will be our first transition, and the other
606 * transitions will be started just after this transition ends:
611 * The code displayed until now has nothing different from what you have
612 * already seen in @ref transit_example_01_explained, but now comes the new
613 * part: instead of creating a second transition that will start later using
614 * a timer, we create the it normally, and use
615 * elm_transit_chain_transit_add() instead of elm_transit_go. Since we are
616 * adding it in a chain after the first transition, it will start as soon as
617 * the first transition ends:
620 * @until transit_chain_transit_add
622 * Finally we add the 2 other transitions to the chain, and run our program.
623 * It will make one transition start after the other finish, and there is the
628 * @page general_functions_example_page General (top-level) functions example
629 * @dontinclude general_funcs_example.c
631 * As told in their documentation blocks, the
632 * elm_app_compile_*_dir_set() family of functions have to be called
633 * before elm_app_info_set():
634 * @skip tell elm about
635 * @until elm_app_info_set
637 * We are here setting the fallback paths to the compiling time target
638 * paths, naturally. If you're building the example out of the
639 * project's build system, we're assuming they are the canonical ones.
641 * After the program starts, elm_app_info_set() will actually run and
642 * then you'll see an intrincasy: Elementary does the prefix lookup @b
643 * twice. This is so because of the quicklaunch infrastructure in
644 * Elementary (@ref Start), which will register a predefined prefix
645 * for possible users of the launch schema. We're not hooking into a
646 * quick launch, so this first call can't be avoided.
648 * If you ran this example from your "bindir" installation
649 * directiory, no output will emerge from these both attempts -- it
650 * will find the "magic" file there registered and set the prefixes
651 * silently. Otherwise, you could get something like:
653 WARNING: Could not determine its installed prefix for 'ELM'
654 so am falling back on the compiled in default:
656 implied by the following:
659 datadir = usr/share/elementary
660 localedir = usr/share/locale
661 Try setting the following environment variables:
662 ELM_PREFIX - points to the base prefix of install
663 or the next 4 variables
664 ELM_BIN_DIR - provide a specific binary directory
665 ELM_LIB_DIR - provide a specific library directory
666 ELM_DATA_DIR - provide a specific data directory
667 ELM_LOCALE_DIR - provide a specific locale directory
669 * if you also didn't change those environment variables (remember
670 * they are also a valid way of communicating your prefix to the
671 * binary) - this is the scenario where it fallbacks to the paths set
674 * Then, you can check the prefixes set on the standard output:
675 * @skip prefix was set to
676 * @until locale directory is
679 * @skip by using this policy
680 * @until elm_win_autodel_set
681 * we demonstrate the use of Elementary policies. The policy defining
682 * under which circunstances our application should quit automatically
683 * is set to when its last window is closed (this one has just one
684 * window, though). This will save us from having to set a callback
685 * ourselves on the window, like done in @ref bg_example_01_c "this"
686 * example. Note that we need to tell the window to delete itself's
687 * object on a request to destroy the canvas coming, with
688 * elm_win_autodel_set().
690 * What follows is some boilerplate code, creating a frame with a @b
691 * button, our object of interest, and, below, widgets to change the
692 * button's behavior and exemplify the group of functions in question.
694 * @dontinclude general_funcs_example.c
695 * We enabled the focus highlight object for this window, so that you
696 * can keep track of the current focused object better:
697 * @skip elm_win_focus_highlight_enabled_set
698 * @until evas_object_show
699 * Use the tab key to navigate through the focus chain.
701 * @dontinclude general_funcs_example.c
702 * While creating the button, we exemplify how to use Elementary's
703 * finger size information to scale our UI:
704 * @skip fprintf(stdout, "Elementary
705 * @until evas_object_show
707 * @dontinclude general_funcs_example.c
708 * The first checkbox's callback is:
711 * When unsetting the checkbox, we disable the button, which will get a new
712 * decoration (greyed out) and stop receiving events. The focus chain
713 * will also ignore it.
715 * Following, there are 2 more buttons whose actions are focus/unfocus
716 * the top button, respectively:
717 * @skip focus callback
720 * @skip unfocus callback
722 * Note the situations in which they won't take effect:
723 * - the button is not allowed to get focus or
724 * - the button is disabled
726 * The first restriction above you'll get by a second checkbox, whose
728 * @skip focus allow callback
730 * Note that the button will still get mouse events, though.
732 * Next, there's a slider controlling the button's scale:
733 * @skip scaling callback
736 * Experiment with it, so you understand the effect better. If you
737 * change its value, it will mess with the button's original size,
740 * The full code for this example can be found
741 * @ref general_functions_example_c "here".
745 * @page theme_example_01 Theme - Using extensions
747 * @dontinclude theme_example_01.c
749 * Using extensions is extremely easy, discarding the part where you have to
750 * write the theme for them.
752 * In the following example we'll be creating two buttons, one to load or
753 * unload our extension theme and one to cycle around three possible styles,
754 * one of which we created.
756 * After including our one and only header we'll jump to the callback for
757 * the buttons. First one takes care of loading or unloading our extension
758 * file, relative to the default theme set (thus the @c NULL in the
759 * functions first parameter).
760 * @skipline Elementary.h
766 * The second button, as we said before, will just switch around different
767 * styles. In this case we have three of them. The first one is our custom
768 * style, named after something very unlikely to find in the default theme.
769 * The other two styles are the standard and one more, anchor, which exists
770 * in the default and is similar to the default, except the button vanishes
771 * when the mouse is not over it.
776 * So what happens if the style switches to our custom one when the
777 * extension is loaded? Elementary falls back to the default for the
780 * And the main function, simply enough, will create the window, set the
781 * buttons and their callbacks, and just to begin with our button styled
782 * we're also loading our extension at the beginning.
786 * In this case we wanted to easily remove extensions, but all adding an
787 * extension does is tell Elementary where else it should look for themes
788 * when it can't find them in the default theme. Another way to do this
789 * is to set the theme search order using elm_theme_set(), but this requires
790 * that the developer is careful not to override any user configuration.
791 * That can be helped by adding our theme to the end of whatver is already
792 * set, like in the following snippet.
795 * snprintf(buf, sizeof(buf), "%s:./theme_example.edj", elme_theme_get(NULL);
796 * elm_theme_set(NULL, buf);
799 * If we were using overlays instead of extensions, the same thing applies,
800 * but the custom theme must be added to the front of the search path.
802 * In the end, we should be looking at something like this:
804 * @image html screenshots/theme_example_01.png
805 * @image latex screenshots/theme_example_01.eps width=\textwidth
807 * That's all. Boringly simple, and the full code in one piece can be found
808 * @ref theme_example_01.c "here".
810 * And the code for our extension is @ref theme_example.edc "here".
812 * @example theme_example_01.c
813 * @example theme_example.edc
817 * @page theme_example_02 Theme - Using overlays
819 * @dontinclude theme_example_02.c
821 * Overlays are like extensions in that you tell Elementary that some other
822 * theme contains the styles you need for your program. The difference is that
823 * they will be look in first, so they can override the default style of any
826 * There's not much to say about them that hasn't been said in our previous
827 * example about @ref theme_example_01 "extensions", so going quickly through
828 * the code we have a function to load or unload the theme, which will be
829 * called when we click any button.
830 * @skipline Elementary.h
834 * And the main function, creating the window and adding some buttons to it.
835 * We load our theme as an overlay and nothing else. Notice there's no style
836 * set for any button there, which means they should be using the default
841 * That's pretty much it. The full code is @ref theme_example_02.c "here" and
842 * the definition of the theme is the same as before, and can be found in
843 * @ref theme_example.edc "here".
845 * @example theme_example_02.c
849 * @page button_example_01 Button - Complete example
851 * @dontinclude button_example_01.c
853 * A button is simple, you click on it and something happens. That said,
854 * we'll go through an example to show in detail the button API less
857 * In the end, we'll be presented with something that looks like this:
859 * @image html screenshots/button_01.png
860 * @image latex screenshots/button_01.eps width=\textwidth
862 * The full code of the example is @ref button_example_01.c "here" and we
863 * will follow here with a rundown of it.
866 * @until Elementary.h
870 * We have several buttons to set different times for the autorepeat timeouts
871 * of the buttons that use it and a few more that we keep track of in our
872 * data struct. The mid button doesn't do much, just moves around according
873 * to what other buttons the user presses. Then four more buttons to move the
874 * central one, and we're also keeping track of the icon set in the middle
875 * button, since when this one moves, we change the icon, and when movement
876 * is finished (by releasing one of the four arrow buttons), we set back the
881 * Keeping any of those four buttons pressed will trigger their autorepeat
882 * callback, where we move the button doing some size hint magic. To
883 * understand how that works better, refer to the @ref Box documentation.
884 * Also, the first time the function is called, we change the icon in the
885 * middle button, using elm_button_icon_unset() first to keep the reference
886 * to the previous one, so we don't need to recreate it when we are done
890 * @until size_hint_align_set
893 * One more callback for the option buttons, that just sets the timeouts for
894 * the different autorepeat options.
901 * And the main function, which does some setting up of the buttons in boxes
902 * to make things work. Here we'll go through some snippets only.
904 * For the option buttons, it's just the button with its label and callback.
905 * @skip elm_button_add
906 * @until smart_callback_add
908 * For the ones that move the central button, we have no labels. There are
909 * icons instead, and the autorepeat option is toggled.
911 * @skip elm_button_add
912 * @until data.cursors.up
914 * And just to show the mid button, which doesn't have anything special.
915 * @skip data.cursors.left
916 * @skip elm_button_add
921 * @example button_example_01.c
925 * @page bubble_01_example_page elm_bubble - Simple use.
926 * @dontinclude bubble_example_01.c
928 * This example shows a bubble with all fields set(label, info, content and
929 * icon) and the selected corner changing when the bubble is clicked. To be
930 * able use a bubble we need to do some setup and create a window, for this
931 * example we are going to ignore that part of the code since it isn't
932 * relevant to the bubble.
934 * To have the selected corner change in a clockwise motion we are going to
935 * use the following callback:
940 * Here we are creating an elm_label that is going to be used as the content
942 * @skipline elm_label
944 * @note You could use any evas_object for this, we are using an elm_label
947 * Despite it's name the bubble's icon doesn't have to be an icon, it can be
948 * any evas_object. For this example we are going to make the icon a simple
952 * And finally we have the actual bubble creation and the setting of it's
953 * label, info and content:
956 * @note Because we didn't set a corner, the default("top_left") will be
959 * Now that we have our bubble all that is left is connecting the "clicked"
960 * signals to our callback:
961 * @line smart_callback
963 * This last bubble we created was very complete, so it's pertinent to show
964 * that most of that stuff is optional a bubble can be created with nothing
969 * Our example will look like this:
971 * @image html screenshots/bubble_example_01.png
972 * @image latex screenshots/bubble_example_01.eps width=\textwidth
974 * See the full source code @ref bubble_example_01.c here.
975 * @example bubble_example_01.c
979 * @page box_example_01 Box - Basic API
981 * @dontinclude button_example_01.c
983 * As a special guest tonight, we have the @ref button_example_01 "simple
984 * button example". There are plenty of boxes in it, and to make the cursor
985 * buttons that moved a central one around when pressed, we had to use a
986 * variety of values for their hints.
988 * To start, let's take a look at the handling of the central button when
989 * we were moving it around. To achieve this effect without falling back to
990 * a complete manual positioning of the @c Evas_Object in our canvas, we just
991 * put it in a box and played with its alignment within it, as seen in the
992 * following snippet of the callback for the pressed buttons.
993 * @skip evas_object_size_hint_align_get
994 * @until evas_object_size_hint_align_set
996 * Not much to it. We get the current alignment of the object and change it
997 * by just a little, depending on which button was pressed, then set it
998 * again, making sure we stay within the 0.0-1.0 range so the button moves
999 * inside the space it has, instead of disappearing under the other objects.
1001 * But as useful as an example as that may have been, the usual case with boxes
1002 * is to set everything at the moment they are created, like we did for
1003 * everything else in our main function.
1005 * The entire layout of our program is made with boxes. We have one set as the
1006 * resize object for the window, which means it will always be resized with
1007 * the window. The weight hints set to @c EVAS_HINT_EXPAND will tell the
1008 * window that the box can grow past it's minimum size, which allows resizing
1012 * @until evas_object_show
1014 * Two more boxes, set to horizontal, hold the buttons to change the autorepeat
1015 * configuration used by the buttons. We create each to take over all the
1016 * available space horizontally, but we don't want them to grow vertically,
1017 * so we keep that axis of the weight with 0.0. Then it gets packed in the
1020 * @until evas_object_show
1022 * The buttons in each of those boxes have nothing special, they are just packed
1023 * in with their default values and the box will use their minimum size, as set
1024 * by Elementary itself based on the label, icon, finger size and theme.
1026 * But the buttons used to move the central one have a special disposition.
1027 * The top one first, is placed right into the main box like our other smaller
1028 * boxes. Set to expand horizontally and not vertically, and in this case we
1029 * also tell it to fill that space, so it gets resized to take the entire
1030 * width of the window.
1032 * @skip elm_button_add
1033 * @until evas_object_show
1035 * The bottom one will be the same, but for the other two we need to use a
1036 * second box set to take as much space as we have, so we can place our side
1037 * buttons in place and have the big empty space where the central button will
1040 * @until evas_object_show
1042 * Then the buttons will have their hints inverted to the other top and bottom
1043 * ones, to expand and fill vertically and keep their minimum size horizontally.
1044 * @skip elm_button_add
1045 * @until evas_object_show
1047 * The central button takes every thing else. It will ask to be expanded in
1048 * both directions, but without filling its cell. Changing its alignment by
1049 * pressing the buttons will make it move around.
1050 * @skip elm_button_add
1051 * @until evas_object_show
1053 * To end, the rightmost button is packed in the smaller box after the central
1054 * one, and back to the main box we have the bottom button at the end.
1058 * @page box_example_02 Box - Layout transitions
1060 * @dontinclude box_example_02.c
1062 * Setting a customized layout for a box is simple once you have the layout
1063 * function, which is just like the layout function for @c Evas_Box. The new
1064 * and fancier thing we can do with Elementary is animate the transition from
1065 * one layout to the next. We'll see now how to do that through a simple
1066 * example, while also taking a look at some of the API that was left
1067 * untouched in our @ref box_example_01 "previous example".
1069 * @image html screenshots/box_example_02.png
1070 * @image latex screenshots/box_example_02.eps width=\textwidth
1072 * @skipline Elementary.h
1074 * Our application data consists of a list of layout functions, given by
1075 * @c transitions. We'll be animating through them throughout the entire run.
1076 * The box with the stuff to move around and the last layout that was set to
1077 * make things easier in the code.
1079 * @until Transitions_Data
1081 * The box starts with three buttons, clicking on any of them will take it
1082 * out of the box without deleting the object. There are also two more buttons
1083 * outside, one to add an object to the box and the other to clear it.
1084 * This is all to show how you can interact with the items in the box, add
1085 * things and even remove them, while the transitions occur.
1087 * One of the callback we'll be using creates a new button, asks the box for
1088 * the list of its children and if it's not empty, we add the new object after
1089 * the first one, otherwise just place at the end as it will not make any
1095 * The clear button is even simpler. Everything in the box will be deleted,
1096 * leaving it empty and ready to fill it up with more stuff.
1100 * And a little function to remove buttons from the box without deleting them.
1101 * This one is set for the @c clicked callback of the original buttons,
1102 * unpacking them when clicked and placing it somewhere in the screen where
1103 * they will not disturb. Once we do this, the box no longer has any control
1104 * of it, so it will be left untouched until the program ends.
1108 * If we wanted, we could just call @c evas_object_del() on the object to
1109 * destroy it. In this case, no unpack is really necessary, as the box would
1110 * be notified of a child being deleted and adjust its calculations accordingly.
1112 * The core of the program is the following function. It takes whatever
1113 * function is first on our list of layouts and together with the
1114 * @c last_layout, it creates an ::Elm_Box_Transition to use with
1115 * elm_box_layout_transition(). In here, we tell it to start from whatever
1116 * layout we last set, end with the one that was at the top of the list and
1117 * when everything is finished, call us back so we can create another
1118 * transition. Finally, move the new layout to the end of the list so we
1119 * can continue running through them until the program ends.
1123 * The main function doesn't have antyhing special. Creation of box, initial
1124 * buttons and some callback setting. The only part worth mentioning is the
1125 * initialization of our application data.
1127 * @until evas_object_box_layout_stack
1129 * We have a simple static variable, set the box, the first layout we are
1130 * using as last and create the list with the different functions to go
1133 * And in the end, we set the first layout and call the same function we went
1134 * through before to start the run of transitions.
1135 * @until _test_box_transition_change
1137 * For the full code, follow @ref box_example_02.c "here".
1139 * @example box_example_02.c
1143 * @page calendar_example_01 Calendar - Simple creation.
1144 * @dontinclude calendar_example_01.c
1146 * As a first example, let's just display a calendar in our window,
1147 * explaining all steps required to do so.
1149 * First you should declare objects we intend to use:
1150 * @skipline Evas_Object
1152 * Then a window is created, a title is set and its set to be autodeleted.
1153 * More details can be found on windows examples:
1154 * @until elm_win_autodel
1156 * Next a simple background is placed on our windows. More details on
1157 * @ref bg_01_example_page:
1158 * @until evas_object_show(bg)
1160 * Now, the exciting part, let's add the calendar with elm_calendar_add(),
1161 * passing our window object as parent.
1162 * @until evas_object_show(cal);
1164 * To conclude our example, we should show the window and run elm mainloop:
1167 * Our example will look like this:
1169 * @image html screenshots/calendar_example_01.png
1170 * @image latex screenshots/calendar_example_01.eps width=\textwidth
1172 * See the full source code @ref calendar_example_01.c here.
1173 * @example calendar_example_01.c
1177 * @page calendar_example_02 Calendar - Layout strings formatting.
1178 * @dontinclude calendar_example_02.c
1180 * In this simple example, we'll explain how to format the label displaying
1181 * month and year, and also set weekday names.
1183 * To format month and year label, we need to create a callback function
1184 * to create a string given the selected time, declared under a
1185 * <tt> struct tm </tt>.
1187 * <tt> struct tm </tt>, declared on @c time.h, is a structure composed by
1189 * @li tm_sec seconds [0,59]
1190 * @li tm_min minutes [0,59]
1191 * @li tm_hour hour [0,23]
1192 * @li tm_mday day of month [1,31]
1193 * @li tm_mon month of year [0,11]
1194 * @li tm_year years since 1900
1195 * @li tm_wday day of week [0,6] (Sunday = 0)
1196 * @li tm_yday day of year [0,365]
1197 * @li tm_isdst daylight savings flag
1198 * @note glib version has 2 additional fields.
1200 * For our function, only stuff that matters are tm_mon and tm_year.
1201 * But we don't need to access it directly, since there are nice functions
1202 * to format date and time, as @c strftime.
1203 * We will get abbreviated month (%b) and year (%y) (check strftime manpage
1204 * for more) in our example:
1205 * @skipline static char
1208 * We need to alloc the string to be returned, and calendar widget will
1209 * free it when it's not needed, what is done by @c strdup.
1210 * So let's register our callback to calendar object:
1211 * @skipline elm_calendar_format_function_set
1213 * To set weekday names, we should declare them as an array of strings:
1214 * @dontinclude calendar_example_02.c
1215 * @skipline weekdays
1218 * And finally set them to calendar:
1219 * skipline weekdays_names_set
1221 * Our example will look like this:
1223 * @image html screenshots/calendar_example_02.png
1224 * @image latex screenshots/calendar_example_02.eps width=\textwidth
1226 * See the full source code @ref calendar_example_02.c here.
1227 * @example calendar_example_02.c
1231 * @page calendar_example_03 Calendar - Years restrictions.
1232 * @dontinclude calendar_example_03.c
1234 * This example explains how to set max and min year to be displayed
1235 * by a calendar object. This means that user won't be able to
1236 * see or select a date before and after selected years.
1237 * By default, limits are 1902 and maximun value will depends
1238 * on platform architecture (year 2037 for 32 bits); You can
1239 * read more about time functions on @c ctime manpage.
1241 * Straigh to the point, to set it is enough to call
1242 * elm_calendar_min_max_year_set(). First value is minimun year, second
1243 * is maximum. If first value is negative, it won't apply limit for min
1244 * year, if the second one is negative, won't apply for max year.
1245 * Setting both to negative value will clear limits (default state):
1246 * @skipline elm_calendar_min_max_year_set
1248 * Our example will look like this:
1250 * @image html screenshots/calendar_example_03.png
1251 * @image latex screenshots/calendar_example_03.eps width=\textwidth
1253 * See the full source code @ref calendar_example_03.c here.
1254 * @example calendar_example_03.c
1258 * @page calendar_example_04 Calendar - Days selection.
1259 * @dontinclude calendar_example_04.c
1261 * It's possible to disable date selection and to select a date
1262 * from your program, and that's what we'll see on this example.
1264 * If isn't required that users could select a day on calendar,
1265 * only interacting going through months, disabling days selection
1266 * could be a good idea to avoid confusion. For that:
1267 * @skipline elm_calendar_day_selection_enabled_set
1269 * Also, regarding days selection, you could be interested to set a
1270 * date to be highlighted on calendar from your code, maybe when
1271 * a specific event happens, or after calendar creation. Let's select
1272 * two days from current day:
1273 * @dontinclude calendar_example_04.c
1274 * @skipline SECS_DAY
1275 * @skipline current_time
1276 * @until elm_calendar_selected_time_set
1278 * Our example will look like this:
1280 * @image html screenshots/calendar_example_04.png
1281 * @image latex screenshots/calendar_example_04.eps width=\textwidth
1283 * See the full source code @ref calendar_example_04.c here.
1284 * @example calendar_example_04.c
1288 * @page calendar_example_05 Calendar - Signal callback and getters.
1289 * @dontinclude calendar_example_05.c
1291 * Most of setters explained on previous examples have associated getters.
1292 * That's the subject of this example. We'll add a callback to display
1293 * all calendar information every time user interacts with the calendar.
1295 * Let's check our callback function:
1296 * @skipline static void
1297 * @until double interval;
1299 * To get selected day, we need to call elm_calendar_selected_time_get(),
1300 * but to assure nothing wrong happened, we must check for function return.
1301 * It'll return @c EINA_FALSE if fail. Otherwise we can use time set to
1302 * our structure @p stime.
1303 * @skipline elm_calendar_selected_time_get
1306 * Next we'll get information from calendar and place on declared vars:
1307 * @skipline interval
1308 * @until elm_calendar_weekdays_names_get
1310 * The only tricky part is that last line gets an array of strings
1311 * (char arrays), one for each weekday.
1313 * Then we can simple print that to stdin:
1317 * <tt> struct tm </tt> is declared on @c time.h. You can check @c ctime
1318 * manpage to read about it.
1320 * To register this callback, that will be called every time user selects
1321 * a day or goes to next or previous month, just add a callback for signal
1323 * @skipline evas_object_smart_callback_add
1325 * Our example will look like this:
1327 * @image html screenshots/calendar_example_05.png
1328 * @image latex screenshots/calendar_example_05.eps width=\textwidth
1330 * See the full source code @ref calendar_example_05.c here.
1331 * @example calendar_example_05.c
1335 * @page calendar_example_06 Calendar - Calendar marks.
1336 * @dontinclude calendar_example_06.c
1338 * On this example marks management will be explained. Functions
1339 * elm_calendar_mark_add(), elm_calendar_mark_del() and
1340 * elm_calendar_marks_clear() will be covered.
1342 * To add a mark, will be required to choose three things:
1344 * @li mark date, or start date if it will be repeated
1345 * @li mark periodicity
1347 * Style defines the kind of mark will be displayed over marked day,
1348 * on caledar. Default theme supports @b holiday and @b checked.
1349 * If more is required, is possible to set a new theme to calendar
1350 * widget using elm_object_style_set(), and use
1351 * the signal that will be used by such marks.
1353 * Date is a <tt> struct tm </tt>, as defined by @c time.h. More can
1354 * be read on @c ctime manpage.
1355 * If a date relative from current is required, this struct can be set
1357 * @skipline current_time
1358 * @until localtime_r
1360 * Or if it's an absolute date, you can just declare the struct like:
1361 * @dontinclude calendar_example_06.c
1363 * @until christmas.tm_mon
1365 * Periodicity is how frequently the mark will be displayed over the
1366 * calendar. Can be a unique mark (that don't repeat), or it can repeat
1367 * daily, weekly, monthly or annually. It's enumerated by
1368 * @c Elm_Calendar_Mark_Repeat.
1370 * So let's add some marks to our calendar. We will add christmas holiday,
1371 * set Sundays as holidays, and check current day and day after that.
1372 * @dontinclude calendar_example_06.c
1374 * @until christmas.tm_mon
1375 * @skipline current_time
1376 * @until ELM_CALENDAR_WEEKLY
1378 * We kept the return of first mark add, because we don't really won't it
1379 * to be checked, so let's remove it:
1380 * @skipline elm_calendar_mark_del
1382 * After all marks are added and removed, is required to draw them:
1383 * @skipline elm_calendar_marks_draw
1385 * Finally, to clear all marks, let's set a callback for our button:
1386 * @skipline elm_button_add
1387 * @until evas_object_show(bt);
1389 * This callback will receive our calendar object, and should clear it:
1390 * @dontinclude calendar_example_06.c
1393 * @note Remember to draw marks after clear the calendar.
1395 * Our example will look like this:
1397 * @image html screenshots/calendar_example_06.png
1398 * @image latex screenshots/calendar_example_06.eps width=\textwidth
1400 * See the full source code @ref calendar_example_06.c here.
1401 * @example calendar_example_06.c
1405 * @page spinner_example Spinner widget example
1407 * This code places seven Elementary spinner widgets on a window, each of
1408 * them exemplifying a part of the widget's API.
1410 * The first of them is the default spinner:
1411 * @dontinclude spinner_example.c
1412 * @skipline elm_spinner_add
1413 * @until evas_object_show
1414 * As you see, the defaults for a spinner are:
1416 * @li min value set to 0
1417 * @li max value set to 100
1418 * @li step value set to 1
1419 * @li label format set to "%0.f"
1421 * If another format is required, see the second spinner. It will put a text
1422 * before and after the value, and also format value to display two decimals:
1423 * @skipline format_set
1425 * The third one will use a customized step, define new minimum and maximum
1426 * values and enable wrap, so when value reaches minimum it jumps to maximum,
1427 * or jumps to minimum after maximum value is reached. Format is set to display
1429 * @skipline elm_spinner_add
1430 * @until evas_object_show
1432 * The fourth uses @c vertical style, so instead of left and right arrows,
1433 * top and bottom are displayed. Also the change interval is reduced, so
1434 * user can change value faster.
1436 * @skipline interval
1438 * In the fifth the user won't be allowed to set value directly, i.e., will
1439 * be obligate change value only using arrows:
1440 * @skipline editable
1442 * The sixth widget will receive a lot of special values, so
1443 * instead of reading numeric values, user will see labels for each one.
1444 * Also direct edition is disabled, otherwise users would see the numeric
1445 * value on edition mode. User will be able to select a month in this widget:
1446 * @skipline elm_spinner_add
1447 * @until evas_object_show
1449 * Finally the last widget will exemplify how to listen to widget's signals,
1450 * <tt> changed </tt> and <tt> delay,changed </tt>. First we need to
1451 * implement callback functions that will simply print spinner's value:
1452 * @dontinclude spinner_example.c
1459 * The first callback function should be called everytime value changes,
1460 * the second one only after user stops to increment or decrement. Try
1461 * to keep arrows pressed and check the difference.
1462 * @skip smart_callback
1463 * @skipline smart_callback
1464 * @skipline smart_callback
1466 * See the full @ref spinner_example.c "example", whose window should
1467 * look like this picture:
1469 * @image html screenshots/spinner_example.png
1470 * @image latex screenshots/spinner_example.eps width=\textwidth
1472 * See the full @ref spinner_example_c "source code" for this example.
1474 * @example spinner_example.c
1478 * @page clock_example Clock widget example
1480 * This code places five Elementary clock widgets on a window, each of
1481 * them exemplifying a part of the widget's API.
1483 * The first of them is the pristine clock:
1484 * @dontinclude clock_example.c
1486 * @until evas_object_show
1487 * As you see, the defaults for a clock are:
1489 * - no seconds shown
1491 * For am/pm time, see the second clock:
1492 * @dontinclude clock_example.c
1494 * @until evas_object_show
1496 * The third one will show the seconds digits, which will flip in
1497 * synchrony with system time. Note, besides, that the time itself is
1498 * @b different from the system's -- it was customly set with
1499 * elm_clock_time_set():
1500 * @dontinclude clock_example.c
1501 * @skip with seconds
1502 * @until evas_object_show
1504 * In both fourth and fifth ones, we turn on the <b>edition
1505 * mode</b>. See how you can change each of the sheets on it, and be
1506 * sure to try holding the mouse pressed over one of the sheet
1507 * arrows. The forth one also starts with a custom time set:
1508 * @dontinclude clock_example.c
1510 * @until evas_object_show
1512 * The fifth, besides editable, has only the time @b units editable,
1513 * for hours, minutes and seconds. This exemplifies
1514 * elm_clock_digit_edit_set():
1515 * @dontinclude clock_example.c
1517 * @until evas_object_show
1519 * See the full @ref clock_example.c "example", whose window should
1520 * look like this picture:
1522 * @image html screenshots/clock_example.png
1523 * @image latex screenshots/clock_example.eps width=\textwidth
1525 * See the full @ref clock_example_c "source code" for this example.
1527 * @example clock_example.c
1531 * @page diskselector_example_01 Diskselector widget example
1533 * This code places 4 Elementary diskselector widgets on a window, each of
1534 * them exemplifying a part of the widget's API.
1536 * All of them will have weekdays as items, since we won't focus
1537 * on items management on this example. For an example about this subject,
1538 * check @ref diskselector_example_02.
1540 * The first of them is a default diskselector.
1541 * @dontinclude diskselector_example_01.c
1544 * @skipline elm_diskselector_add
1545 * @until evas_object_show
1547 * We are just adding the diskselector, so as you can see, defaults for it are:
1548 * @li Only 3 items visible each time.
1549 * @li Only 3 characters are displayed for labels on side positions.
1550 * @li The first added item remains centeres, i.e., it's the selected item.
1552 * To add items, we are just appending it on a loop, using function
1553 * elm_diskselector_item_append(), that will be better exaplained on
1554 * items management example.
1556 * For a circular diskselector, check the second widget. A circular
1557 * diskselector will display first item after last, and last previous to
1558 * the first one. So, as you can see, @b Sa will appears on left side
1559 * of selected @b Sunday. This property is set with
1560 * elm_diskselector_round_set().
1562 * Also, we decide to display only 2 character for side labels, instead of 3.
1563 * For this we call elm_diskselector_side_label_length_set(). As result,
1564 * we'll see @b Mo displayed instead of @b Mon, when @b Monday is on a
1567 * @skipline elm_diskselector_add
1568 * @until evas_object_show
1570 * But so far, we are only displaying 3 items at once. If more are wanted,
1571 * is enough to call elm_diskselector_display_item_num_set(), as you can
1573 * @skipline elm_diskselector_add
1574 * @until evas_object_show
1576 * @note You can't set less than 3 items to be displayed.
1578 * Finally, if a bounce effect is required, or you would like to see
1579 * scrollbars, it is possible. But, for default theme, diskselector
1580 * scrollbars will be invisible anyway.
1581 * @skipline elm_diskselector_add
1582 * @until evas_object_show
1584 * See the full @ref diskselector_example_01.c "diskselector_example_01.c"
1585 * code, whose window should look like this picture:
1587 * @image html screenshots/diskselector_example_01.png
1588 * @image latex screenshots/diskselector_example_01.eps width=\textwidth
1590 * @example diskselector_example_01.c
1594 * @page diskselector_example_02 Diskselector - Items management
1596 * This code places a Elementary diskselector widgets on a window,
1597 * along with some buttons trigerring actions on it (though its API).
1598 * It covers most of Elm_Diskselector_Item functions.
1600 * On our @c main function, we are adding a default diskselector with
1601 * 3 items. We are only setting their labels (second parameter of function
1602 * elm_diskselector_item_append):
1603 * @dontinclude diskselector_example_02.c
1604 * @skipline elm_diskselector_add
1607 * Next we are adding lots of buttons, each one for a callback function
1608 * that will realize a task covering part of diskselector items API.
1609 * Lets check the first one:
1610 * @skipline elm_button_add
1611 * @until evas_object_show
1613 * We are labeling the button with a task description with
1614 * elm_object_text_set() and setting a callback
1615 * function evas_object_smart_callback_add().
1616 * Each callback function will have the signature:
1617 * <tt> static void _task_cb(void *data, Evas_Object *obj,
1618 * void *event_info)</tt> with the function name varying for each task.
1620 * Now let's cover all of them.
1622 * <b> Appending an item: </b>
1623 * @dontinclude diskselector_example_02.c
1627 * All items are included on diskselector after last one. You @b can't
1630 * The first parameter of elm_diskselector_item_append() is the diskselector
1631 * object, that we are receiving as data on our callback function.
1632 * The second one is a label, the string that will be placed in the center
1633 * of our item. As we don't wan't icons or callback functions, we can
1634 * send NULL as third, fourth and fifth parameters.
1636 * <b> Appending an item with icon: </b>
1637 * @dontinclude diskselector_example_02.c
1638 * @skipline _add_ic_cb
1641 * If an icon is required, you can pass it as third paramenter on our
1642 * elm_diskselector_item_append() function. It will be place on the
1643 * left side of item's label, that will be shifted to right a bit.
1645 * For more details about how to create icons, look for elm_icon examples.
1647 * <b> Appending an item with callback function for selected: </b>
1648 * @dontinclude diskselector_example_02.c
1653 * To set a callback function that will be called every time an item is
1654 * selected, i.e., everytime the diskselector stops with this item in
1655 * center position, just pass the function as fourth paramenter.
1657 * <b> Appending an item with callback function for selected with data: </b>
1658 * @dontinclude diskselector_example_02.c
1659 * @skipline _sel_data_cb
1665 * If the callback function request an extra data, it can be attached to our
1666 * item passing a pointer for data as fifth parameter.
1667 * Our function _sel_data_cb will receive it as <tt> void *data </tt>.
1669 * If you want to free this data, or handle that the way you need when the
1670 * item is deleted, set a callback function for that, with
1671 * elm_diskselector_item_del_cb_set().
1673 * As you can see we check if @c it is not @c NULL after appending it.
1674 * If an error happens, we won't try to set a function for it.
1676 * <b> Deleting an item: </b>
1677 * @dontinclude diskselector_example_02.c
1682 * To delete an item we simple need to call elm_diskselector_item_del() with
1683 * a pointer for such item.
1685 * If you need, you can get selected item with
1686 * elm_diskselector_selected_item_get(), that will return a pointer for it.
1688 * <b> Unselecting an item: </b>
1689 * @dontinclude diskselector_example_02.c
1690 * @skipline _unselect_cb
1693 * To select an item, you should call elm_diskselector_item_selected_set()
1694 * passing @c EINA_TRUE, and to unselect it, @c EINA_FALSE.
1696 * If you unselect the selected item, diskselector will automatically select
1699 * <b> Printing all items: </b>
1700 * @dontinclude diskselector_example_02.c
1701 * @skipline _print_cb
1704 * <b> Clearing the diskselector: </b>
1705 * @dontinclude diskselector_example_02.c
1706 * @skipline _clear_cb
1709 * <b> Selecting the first item: </b>
1710 * @dontinclude diskselector_example_02.c
1711 * @skipline _select_first_cb
1714 * <b> Selecting the last item: </b>
1715 * @dontinclude diskselector_example_02.c
1716 * @skipline _select_last_cb
1719 * <b> Selecting the next item: </b>
1720 * @dontinclude diskselector_example_02.c
1721 * @skipline _select_next_cb
1724 * <b> Selecting the previous item: </b>
1725 * @dontinclude diskselector_example_02.c
1726 * @skipline _select_prev_cb
1729 * See the full @ref diskselector_example_02.c "diskselector_example_02.c"
1730 * code, whose window should look like this picture:
1732 * @image html screenshots/diskselector_example_02.png
1733 * @image latex screenshots/diskselector_example_02.eps width=\textwidth
1735 * @example diskselector_example_02.c
1739 * @page list_example_01 List widget example
1741 * This code places a single Elementary list widgets on a window, just
1742 * to exemplify the more simple and common use case: a list will be created
1743 * and populated with a few items.
1745 * To keep it simple, we won't show how to customize the list, for this check
1746 * @ref list_example_02. Also, we won't focus
1747 * on items management on this example. For an example about this subject,
1748 * check @ref list_example_03.
1750 * To add a list widget.
1751 * @dontinclude list_example_01.c
1752 * @skipline elm_list_add
1754 * We are just adding the list, so as you can see, defaults for it are:
1755 * @li Items are displayed vertically.
1756 * @li Only one item can be selected.
1757 * @li The list doesn't bouce.
1759 * To add items, we are just appending it on a loop, using function
1760 * elm_list_item_append(), that will be better exaplained on
1761 * items management example.
1762 * @dontinclude list_example_01.c
1766 * @skipline elm_list_item_append
1768 * After we just want to show the list. But first we need to start the widget.
1769 * It was done this way to improve widget's performance. So, always remember
1771 * @warning Call elm_list_go before showing the object
1772 * @skipline elm_list_go
1775 * See the full @ref list_example_01.c "list_example_01.c"
1776 * code, whose window should look like this picture:
1778 * @image html screenshots/list_example_01.png
1779 * @image latex screenshots/list_example_01.eps width=\textwidth
1781 * @example list_example_01.c
1785 * @page list_example_02 List widget example
1787 * This code places a single Elementary list widgets on a window,
1788 * exemplifying a part of the widget's API.
1790 * First, we will just create a simple list, as done on @ref list_example_01 :
1791 * @dontinclude list_example_02.c
1794 * @skipline elm_list_add
1795 * @until elm_list_item_append
1797 * Now, let's customize this list a bit. First we will display items
1799 * @skipline horizontal_set
1801 * Then we will choose another list mode. There are four of them, and
1802 * the default #Elm_List_Mode is #ELM_LIST_SCROLL. Let's set compress mode:
1803 * @skipline mode_set
1805 * To enable multiple items selection, we need to enable it, since only one
1806 * selected item is allowed by default:
1807 * @skipline elm_list_multi_select_set
1809 * We are not adding items with callback functions here,
1810 * since we'll explain it better on @ref list_example_03. But if the callback
1811 * need to be called everytime user clicks an item, even if already selected,
1812 * it's required to enable this behavior:
1813 * @skipline elm_list_always_select_mode_set
1815 * Finally, if a bounce effect is required, or you would like to see
1816 * scrollbars, it is possible. But, for default theme, list
1817 * scrollbars will be invisible anyway.
1818 * @skipline bounce_set
1819 * @until SCROLLER_POLICY_ON
1821 * See the full @ref list_example_02.c "list_example_02.c"
1822 * code, whose window should look like this picture:
1824 * @image html screenshots/list_example_02.png
1825 * @image latex screenshots/list_example_02.eps width=\textwidth
1827 * @example list_example_02.c
1831 * @page list_example_03 List - Items management
1833 * This code places a Elementary list widgets on a window,
1834 * along with some buttons trigerring actions on it (though its API).
1835 * It covers most of Elm_List_Item functions.
1837 * On our @c main function, we are adding a default list with
1838 * 3 items. We are only setting their labels (second parameter of function
1839 * elm_list_item_append):
1840 * @dontinclude list_example_03.c
1841 * @skipline elm_list_add
1844 * Next we are adding lots of buttons, each one for a callback function
1845 * that will realize a task covering part of list items API.
1846 * Lets check the first one:
1847 * @skipline elm_button_add
1848 * @until evas_object_show
1850 * We are labeling the button with a task description with
1851 * elm_object_text_set() and setting a callback
1852 * function evas_object_smart_callback_add().
1853 * Each callback function will have the signature:
1854 * <tt> static void _task_cb(void *data, Evas_Object *obj,
1855 * void *event_info)</tt> with the function name varying for each task.
1857 * Now let's cover all of them.
1859 * <b> Prepending an item: </b>
1860 * @dontinclude list_example_03.c
1861 * @skipline _prepend_cb
1864 * The item will be placed on the begining of the list,
1865 * i.e. it will be the first one.
1867 * The first parameter of elm_list_item_prepend() is the list
1868 * object, that we are receiving as data on our callback function.
1869 * The second one is a label, the string that will be placed in the center
1870 * of our item. As we don't wan't icons or callback functions, we can
1871 * send NULL as third, fourth, fifth and sixth parameters.
1873 * <b> Appending an item: </b>
1874 * @dontinclude list_example_03.c
1878 * Items included with append will be inserted inserted after the last one.
1880 * <b> Appending an item with icon: </b>
1881 * @dontinclude list_example_03.c
1882 * @skipline _add_ic_cb
1885 * If an icon is required, you can pass it as third paramenter on our
1886 * elm_list_item_append() function. It will be place on the
1887 * left side of item's label. If an icon is wanted on the right side,
1888 * it should be passed as fourth parameter.
1890 * For more details about how to create icons, look for elm_icon examples
1891 * @ref tutorial_icon.
1893 * <b> Appending an item with callback function for selected: </b>
1894 * @dontinclude list_example_03.c
1899 * To set a callback function that will be called every time an item is
1900 * selected, i.e., everytime the list stops with this item in
1901 * center position, just pass the function as fifth paramenter.
1903 * <b> Appending an item with callback function for selected with data: </b>
1904 * @dontinclude list_example_03.c
1905 * @skipline _sel_data_cb
1911 * If the callback function request an extra data, it can be attached to our
1912 * item passing a pointer for data as sixth parameter.
1913 * Our function _sel_data_cb will receive it as <tt> void *data </tt>.
1915 * If you want to free this data, or handle that the way you need when the
1916 * item is deleted, set a callback function for that, with
1917 * elm_list_item_del_cb_set().
1919 * As you can see we check if @c it is not @c NULL after appending it.
1920 * If an error happens, we won't try to set a function for it.
1922 * <b> Deleting an item: </b>
1923 * @dontinclude list_example_03.c
1924 * @skipline _del_cb(
1927 * To delete an item we simple need to call elm_list_item_del() with
1928 * a pointer for such item.
1930 * If you need, you can get selected item with
1931 * elm_list_selected_item_get(), that will return a pointer for it.
1933 * <b> Unselecting an item: </b>
1934 * @dontinclude list_example_03.c
1935 * @skipline _unselect_cb
1938 * To select an item, you should call elm_list_item_selected_set()
1939 * passing @c EINA_TRUE, and to unselect it, @c EINA_FALSE.
1941 * <b> Printing all items: </b>
1942 * @dontinclude list_example_03.c
1943 * @skipline _print_cb
1946 * <b> Clearing the list: </b>
1947 * @dontinclude list_example_03.c
1948 * @skipline _clear_cb
1951 * <b> Selecting the next item: </b>
1952 * @dontinclude list_example_03.c
1953 * @skipline _select_next_cb
1956 * <b> Inserting after an item: </b>
1957 * @dontinclude list_example_03.c
1958 * @skipline _insert_after_cb
1961 * <b> Selecting the previous item: </b>
1962 * @dontinclude list_example_03.c
1963 * @skipline _select_prev_cb
1966 * <b> Inserting before an item: </b>
1967 * @dontinclude list_example_03.c
1968 * @skipline _insert_before_cb
1971 * If a separator is required, just set an item as such:
1972 * @dontinclude list_example_03.c
1973 * @skipline _set_separator_cb
1976 * Also an item can be disabled, and the user won't be allowed to (un)select it:
1977 * @dontinclude list_example_03.c
1978 * @skipline _disable_cb
1981 * See the full @ref list_example_03.c "list_example_03.c"
1982 * code, whose window should look like this picture:
1984 * @image html screenshots/list_example_03.png
1985 * @image latex screenshots/list_example_03.eps width=\textwidth
1987 * @example list_example_03.c
1991 * @page flipselector_example Flip selector widget example
1993 * This code places an Elementary flip selector widget on a window,
1994 * along with two buttons trigerring actions on it (though its API).
1996 * The selector is being populated with the following items:
1997 * @dontinclude flipselector_example.c
2001 * Next, we create it, populating it with those items and registering
2002 * two (smart) callbacks on it:
2003 * @dontinclude flipselector_example.c
2004 * @skip fp = elm_flipselector_add
2005 * @until object_show
2007 * Those two callbacks will take place whenever one of those smart
2008 * events occur, and they will just print something to @c stdout:
2009 * @dontinclude flipselector_example.c
2010 * @skip underflow callback
2011 * @until static void
2012 * Flip the sheets on the widget while looking at the items list, in
2013 * the source code, and you'll get the idea of those events.
2015 * The two buttons below the flip selector will take the actions
2016 * described in their labels:
2017 * @dontinclude flipselector_example.c
2018 * @skip bt = elm_button_add
2019 * @until callback_add(win
2021 * @dontinclude flipselector_example.c
2022 * @skip unselect the item
2025 * Click on them to exercise those flip selector API calls. To
2026 * interact with the other parts of this API, there's a command line
2027 * interface, whose help string can be asked for with the 'h' key:
2028 * @dontinclude flipselector_example.c
2032 * The 'n' and 'p' keys will exemplify elm_flipselector_flip_next()
2033 * and elm_flipselector_flip_prev(), respectively. 'f' and 'l' account
2034 * for elm_flipselector_first_item_get() and
2035 * elm_flipselector_last_item_get(), respectively. Finally, 's' will
2036 * issue elm_flipselector_selected_item_get() on our example flip
2039 * See the full @ref flipselector_example.c "example", whose window should
2040 * look like this picture:
2042 * @image html screenshots/flipselector_example.png
2043 * @image latex screenshots/flipselector_example.eps width=\textwidth
2045 * See the full @ref flipselector_example_c "source code" for this example.
2047 * @example flipselector_example.c
2051 * @page fileselector_example File selector widget example
2053 * This code places two Elementary file selector widgets on a window.
2054 * The one on the left is layouting file system items in a @b list,
2055 * while the the other is layouting them in a @b grid.
2057 * The one having the majority of hooks of interest is on the left,
2058 * which we create as follows:
2059 * @dontinclude fileselector_example.c
2060 * @skip first file selector
2061 * @until object_show
2063 * Note that we enable custom edition of file/directory selection, via
2064 * the text entry it has on its bottom, via
2065 * elm_fileselector_is_save_set(). It starts with the list view, which
2066 * is the default, and we make it not expandable in place
2067 * (elm_fileselector_expandable_set()), so that it replaces its view's
2068 * contents with the current directory's entries each time one
2069 * navigates to a different folder. For both of file selectors we are
2070 * starting to list the contents found in the @c "/tmp" directory
2071 * (elm_fileselector_path_set()).
2073 * Note the code setting it to "grid mode" and observe the differences
2074 * in the file selector's views, in the example. We also hide the
2075 * second file selector's Ok/Cancel buttons -- since it's there just
2076 * to show the grid view (and navigation) -- via
2077 * elm_fileselector_buttons_ok_cancel_set().
2079 * The @c "done" event, which triggers the callback below
2080 * @dontinclude fileselector_example.c
2083 * will be called at the time one clicks the "Ok"/"Cancel" buttons of
2084 * the file selector (on the left). Note that it will print the path
2085 * to the current selection, if any.
2087 * The @c "selected" event, which triggers the callback below
2088 * @dontinclude fileselector_example.c
2089 * @skip bt = 'selected' cb
2091 * takes place when one selects a file (if the file selector is @b not
2092 * under folders-only mode) or when one selects a folder (when in
2093 * folders-only mode). Experiment it by selecting different file
2096 * What comes next is the code creating the three check boxes and two
2097 * buttons below the file selector in the right. They will exercise a
2098 * bunch of functions on the file selector's API, for the instance on
2099 * the left. Experiment with them, specially the buttons, to get the
2100 * difference between elm_fileselector_path_get() and
2101 * elm_fileselector_selected_get().
2103 * Finally, there's the code adding the second file selector, on the
2105 * @dontinclude fileselector_example.c
2106 * @skip second file selector
2107 * @until object_show
2109 * Pay attention to the code setting it to "grid mode" and observe the
2110 * differences in the file selector's views, in the example. We also
2111 * hide the second file selector's Ok/Cancel buttons -- since it's
2112 * there just to show the grid view (and navigation) -- via
2113 * elm_fileselector_buttons_ok_cancel_set().
2115 * See the full @ref fileselector_example.c "example", whose window
2116 * should look like this picture:
2118 * @image html screenshots/fileselector_example.png
2119 * @image latex screenshots/fileselector_example.eps width=\textwidth
2121 * See the full @ref fileselector_example_c "source code" for this example.
2123 * @example fileselector_example.c
2127 * @page fileselector_button_example File selector button widget example
2129 * This code places an Elementary file selector button widget on a
2130 * window, along with some other checkboxes and a text entry. Those
2131 * are there just as knobs on the file selector button's state and to
2132 * display information from it.
2134 * Here's how we instantiate it:
2135 * @dontinclude fileselector_button_example.c
2136 * @skip ic = elm_icon_add
2137 * @until evas_object_show
2139 * Note that we set on it both icon and label decorations. It's set to
2140 * list the contents of the @c "/tmp" directory, too, with
2141 * elm_fileselector_button_path_set(). What follows are checkboxes to
2142 * exercise some of its API funtions:
2143 * @dontinclude fileselector_button_example.c
2144 * @skip ck = elm_check_add
2145 * @until evas_object_show(en)
2147 * The checkboxes will toggle whether the file selector button's
2148 * internal file selector:
2149 * - must have an editable text entry for file names (thus, be in
2150 * "save dialog mode")
2151 * - is to be raised as an "inner window" (note it's the default
2152 * behavior) or as a dedicated window
2153 * - is to populate its view with folders only
2154 * - is to expand its folders, in its view, <b>in place</b>, and not
2155 * repainting it entirely just with the contents of a sole
2158 * The entry labeled @c "Last selection" will exercise the @c
2159 * "file,chosen" smart event coming from the file selector button:
2160 * @dontinclude fileselector_button_example.c
2162 * @until toggle inwin
2164 * Whenever you dismiss or acknowledges the file selector, after it's
2165 * raised, the @c event_info string will contain the last selection on
2166 * it (if any was made).
2168 * This is how the example, just after called, should look like:
2170 * @image html screenshots/fileselector_button_example_00.png
2171 * @image latex screenshots/fileselector_button_example_00.eps width=\textwidth
2173 * Click on the file selector button to raise its internal file
2174 * selector, which will be contained on an <b>"inner window"</b>:
2176 * @image html screenshots/fileselector_button_example_01.png
2177 * @image latex screenshots/fileselector_button_example_01.eps width=\textwidth
2179 * Toggle the "inwin mode" switch off and, if you click on the file
2180 * selector button again, you'll get @b two windows, the original one
2181 * (note the last selection there!)
2183 * @image html screenshots/fileselector_button_example_02.png
2184 * @image latex screenshots/fileselector_button_example_02.eps width=\textwidth
2186 * and the file selector's new one
2188 * @image html screenshots/fileselector_button_example_03.png
2189 * @image latex screenshots/fileselector_button_example_03.eps width=\textwidth
2191 * Play with the checkboxes to get the behavior changes on the file
2192 * selector button. The respective API calls on the widget coming from
2193 * those knobs where shown in the code already.
2195 * See the full @ref fileselector_button_example_c "source code" for
2198 * @example fileselector_button_example.c
2202 * @page fileselector_entry_example File selector entry widget example
2204 * This code places an Elementary file selector entry widget on a
2205 * window, along with some other checkboxes. Those are there just as
2206 * knobs on the file selector entry's state.
2208 * Here's how we instantiate it:
2209 * @dontinclude fileselector_entry_example.c
2210 * @skip ic = elm_icon_add
2211 * @until evas_object_show
2213 * Note that we set on it's button both icon and label
2214 * decorations. It's set to exhibit the path of (and list the contents
2215 * of, when internal file selector is launched) the @c "/tmp"
2216 * directory, also, with elm_fileselector_entry_path_set(). What
2217 * follows are checkboxes to exercise some of its API funtions:
2218 * @dontinclude fileselector_entry_example.c
2219 * @skip ck = elm_check_add
2220 * @until callback_add(fs_entry
2222 * The checkboxes will toggle whether the file selector entry's
2223 * internal file selector:
2224 * - must have an editable text entry for file names (thus, be in
2225 * "save dialog mode")
2226 * - is to be raised as an "inner window" (note it's the default
2227 * behavior) or as a dedicated window
2228 * - is to populate its view with folders only
2229 * - is to expand its folders, in its view, <b>in place</b>, and not
2230 * repainting it entirely just with the contents of a sole
2233 * Observe how the entry's text will match the string coming from the
2234 * @c "file,chosen" smart event:
2235 * @dontinclude fileselector_entry_example.c
2238 * Whenever you dismiss or acknowledges the file selector, after it's
2239 * raised, the @c event_info string will contain the last selection on
2240 * it (if any was made).
2242 * Try, also, to type in a valid system path and, then, open the file
2243 * selector's window: it will start the file browsing there, for you.
2245 * This is how the example, just after called, should look like:
2247 * @image html screenshots/fileselector_entry_example_00.png
2248 * @image latex screenshots/fileselector_entry_example_00.eps width=\textwidth
2250 * Click on the file selector entry to raise its internal file
2251 * selector, which will be contained on an <b>"inner window"</b>:
2253 * @image html screenshots/fileselector_entry_example_01.png
2254 * @image latex screenshots/fileselector_entry_example_01.eps width=\textwidth
2256 * Toggle the "inwin mode" switch off and, if you click on the file
2257 * selector entry again, you'll get @b two windows, the original one
2258 * (note the last selection there!)
2260 * @image html screenshots/fileselector_entry_example_02.png
2261 * @image latex screenshots/fileselector_entry_example_02.eps width=\textwidth
2263 * and the file selector's new one
2265 * @image html screenshots/fileselector_entry_example_03.png
2266 * @image latex screenshots/fileselector_entry_example_03.eps width=\textwidth
2268 * Play with the checkboxes to get the behavior changes on the file
2269 * selector entry. The respective API calls on the widget coming from
2270 * those knobs where shown in the code already.
2272 * See the full @ref fileselector_entry_example_c "source code" for
2275 * @example fileselector_entry_example.c
2279 * @page layout_example_01 Layout - Content, Table and Box
2281 * This example shows how one can use the @ref Layout widget to create a
2282 * customized distribution of widgets on the screen, controled by an Edje theme.
2283 * The full source code for this example can be found at @ref
2284 * layout_example_01_c.
2286 * Our custom layout is defined by a file, @ref layout_example_edc, which is an
2287 * Edje theme file. Look for the Edje documentation to understand it. For now,
2288 * it's enough to know that we describe some specific parts on this layout
2290 * @li a title text field;
2291 * @li a box container;
2292 * @li a table container;
2293 * @li and a content container.
2295 * Going straight to the code, the following snippet instantiates the layout
2298 * @dontinclude layout_example_01.c
2299 * @skip elm_layout_add
2300 * @until evas_object_show(layout)
2302 * As any other widget, we set some properties for the size calculation. But
2303 * notice on this piece of code the call to the function elm_layout_file_set().
2304 * Here is where the theme file is loaded, and particularly the specific group
2305 * from this theme file. Also notice that the theme file here is referenced as
2306 * an .edj, which is a .edc theme file compiled to its binary form. Again, look
2307 * for the Edje documentation for more information about theme files.
2309 * Next, we fetch from our theme a data string referenced by the key "title".
2310 * This data was defined in the theme, and can be used as parameters which the
2311 * program get from the specific theme that it is using. In this case, we store
2312 * the title of this window and program in the theme, as a "data" entry, just
2313 * for demonstration purposes:
2317 * This call elm_layout_data_get() is used to fetch the string based on the key,
2318 * and elm_object_text_part_set() will set the part defined in the theme as
2319 * "example/title" to contain this string. This key "example/title" has nothing
2320 * special. It's just an arbitrary convention that we are using in this example.
2321 * Every string in this example referencing a part of this theme will be of the
2322 * form "example/<something>".
2324 * Now let's start using our layout to distribute things on the window space.
2325 * Since the layout was added as a resize object to the elementary window, it
2326 * will always occupy the entire space available for this window.
2328 * The theme already has a title, and it also defines a table element which is
2329 * positioned approximately between 50% and 70% of the height of this window,
2330 * and has 100% of the width. We create some widgets (two icons, a clock and a
2331 * button) and pack them inside the table, in a distribution similar to a HTML
2334 * @until evas_object_show(bt)
2336 * Notice that we just set size hints for every object, and call the function
2337 * elm_layout_table_pack(), which does all the work. It will place the elements
2338 * in the specified row/column, with row and column span if required, and then
2339 * the object's size and position will be controled by the layout widget. It
2340 * will also respect size hints, alignments and weight properties set to these
2341 * widgets. The resulting distribution on the screen depends on the table
2342 * properties (described in the theme), the size hints set on each widget, and
2343 * on the cells of the table that are being used.
2345 * For instance, we add the two icons and the clock on the first, second and
2346 * third cells of the first row, and add the button the second row, making it
2347 * span for 3 columns (thus having the size of the entire table width). This
2348 * will result in a table that has 2 rows and 3 columns.
2350 * Now let's add some widgets to the box area of our layout. This box is around
2351 * 20% and 50% of the vertical size of the layout, and 100% of its width. The
2352 * theme defines that it will use an "horizontal flow" distribution to its
2353 * elements. Unlike the table, a box will distribute elements without knowing
2354 * about rows and columns, and the distribution function selected will take care
2355 * of putting them in row, column, both, or any other available layout. This is
2356 * also described in the Edje documentation.
2358 * This box area is similar to the @ref Box widget of elementary, with the
2359 * difference that its position and properties are controled by the theme of the
2360 * layout. It also contains more than one API to add items to it, since the
2361 * items position now is defined in terms of a list of items, not a matrix.
2362 * There's the first position (can have items added to it with
2363 * elm_layout_box_prepend()), the last position (elm_layout_box_append()), the
2364 * nth position (elm_layout_box_insert_at()) and the position right before an
2365 * element (elm_layout_box_insert_before()). We use insert_at and prepend
2366 * functions to add the first two buttons to this box, and insert_before on the
2367 * callback of each button. The callback code will be shown later, but it
2368 * basically adds a button just before the clicked button using the
2369 * elm_layout_box_insert_before() function. Here's the code for adding the first
2372 * @until evas_object_show(item)
2373 * @until evas_object_show(item)
2375 * Finally, we have an area in this layout theme, in the bottom part of it,
2376 * reserved for adding an specific widget. Differently from the 2 parts
2377 * described until now, this one can only receive one widget with the call
2378 * elm_layout_content_set(). If there was already an item on this specific part,
2379 * it will be deleted (one can use elm_layout_content_unset() in order to remove
2380 * it without deleting). An example of removing it without deleting, but
2381 * manually deleting this widget just after that, can be seen on the callback
2382 * for this button. Actually, the callback defined for this button will clean
2383 * the two other parts (deleting all of their elements) and then remove and
2384 * delete this button.
2386 * @until _swallow_btn_cb
2388 * Also notice that, for this last added button, we don't have to call
2389 * evas_object_show() on it. This is a particularity of the theme for layouts,
2390 * that will have total control over the properties like size, position,
2391 * visibility and clipping of a widget added with elm_layout_content_set().
2392 * Again, read the Edje documentation to understand this better.
2394 * Now we just put the code for the different callbacks specified for each kind
2395 * of button and make simple comments about them:
2397 * @dontinclude layout_example_01.c
2399 * @until evas_object_del(item)
2402 * The first callback is used for the button in the table, and will just remove
2403 * itself from the table with elm_layout_table_unpack(), which remove items
2404 * without deleting them, and then calling evas_object_del() on itself.
2406 * The second callback is for buttons added to the box. When clicked, these
2407 * buttons will create a new button, and add them to the same box, in the
2408 * position just before the clicked button.
2410 * And the last callback is for the button added to the "content" area. It will
2411 * clear both the table and the box, passing @c EINA_TRUE to their respective @c
2412 * clear parameters, which will imply on the items of these containers being
2415 * A screenshot of this example can be seen on:
2417 * @image html screenshots/layout_example_01.png
2418 * @image latex screenshots/layout_example_01.eps width=\textwidth
2423 * @page layout_example_02 Layout - Predefined Layout
2425 * This example shows how one can use the @ref Layout with a predefined theme
2426 * layout to add a back and next button to a simple window. The full source code
2427 * for this example can be found at @ref layout_example_02_c.
2429 * After setting up the window and background, we add the layout widget to the
2430 * window. But instead of using elm_layout_file_set() to load its theme from a
2431 * custom theme file, we can use elm_layout_theme_set() to load one of the
2432 * predefined layouts that come with elementary. Particularly on this example,
2433 * we load the them of class "layout", group "application" and style
2434 * "content-back-next" (since we want the back and next buttons).
2436 * @dontinclude layout_example_02.c
2437 * @skip elm_layout_add
2438 * @until evas_object_show(layout)
2440 * This default theme contains only a "content" area named
2441 * "elm.swallow.content", where we can add any widget (it can be even a
2442 * container widget, like a box, frame, list, or even another layout). Since we
2443 * just want to show the resulting layout, we add a simple icon to it:
2445 * @until layout_content_set
2447 * This default layout also provides some signals when the next and prev buttons
2448 * are clicked. We can register callbacks to them with the
2449 * elm_object_signal_callback_add() function:
2451 * @until elm,action,next
2453 * In the @ref layout_example_03 you can see how to send signals to the layout with
2454 * elm_object_signal_emit().
2456 * Now our callback just changes the picture being displayed when one of the
2457 * buttons are clicked:
2459 * @dontinclude layout_example_02.c
2461 * @until standard_set
2464 * It's possible to see that it gets the name of the image being shown from the
2465 * array of image names, going forward on this array when "next" is clicked and
2466 * backward when "back" is clicked.
2468 * A screenshot of this example can be seen on:
2470 * @image html screenshots/layout_example_02.png
2471 * @image latex screenshots/layout_example_02.eps width=\textwidth
2475 * @page layout_example_03 Layout - Signals and Size Changed
2477 * This example shows how one can send and receive signals to/from the layout,
2478 * and what to do when the layout theme has its size changed. The full source
2479 * code for this example can be found at @ref layout_example_03_c.
2481 * In this exmaple we will use another group from the same layout theme file
2482 * used in @ref layout_example_01. Its instanciation and loading happens in the
2485 * @dontinclude layout_example_03.c
2486 * @skip elm_layout_add
2487 * @until evas_object_show
2489 * This time we register a callback to be called whenever we receive a signal
2490 * after the end of the animation that happens in this layout:
2492 * @until signal_callback_add
2494 * We also add a button that will send signals to the layout:
2496 * @until callback_add
2498 * The callback for this button will check what type of signal it should send,
2499 * and then emit it. The code for this callback follows:
2501 * @dontinclude layout_exmaple_03.c
2502 * @skip static Eina_Bool
2507 * As we said before, we are receiving a signal whenever the animation started
2508 * by the button click ends. This is the callback for that signal:
2512 * Notice from this callback that the elm_layout_sizing_eval() function must be
2513 * called if we want our widget to update its size after the layout theme having
2514 * changed its minimum size. This happens because the animation specified in the
2515 * theme increases the size of the content area to a value higher than the
2516 * widget size, thus requiring more space. But the elementary layout widget
2517 * has no way to know this, thus needing the elm_layout_sizing_eval() to
2518 * be called on the layout, informing that this size has changed.
2520 * A screenshot of this example can be seen on:
2522 * @image html screenshots/layout_example_03.png
2523 * @image latex screenshots/layout_example_03.eps width=\textwidth
2527 * @page tutorial_hover Hover example
2528 * @dontinclude hover_example_01.c
2530 * On this example we are going to have a button that when clicked will show our
2531 * hover widget, this hover will have content set on it's left, top, right and
2532 * middle positions. In the middle position we are placing a button that when
2533 * clicked will hide the hover. We are also going to use a non-default theme
2534 * for our hover. We won't explain the functioning of button for that see @ref
2537 * We start our example with a couple of callbacks that show and hide the data
2538 * they're given(which we'll see later on is the hover widget):
2543 * In our main function we'll do some initialization and then create 3
2544 * rectangles, one red, one green and one blue to use in our hover. We'll also
2545 * create the 2 buttons that will show and hide the hover:
2548 * With all of that squared away we can now get to the heart of the matter,
2549 * creating our hover widget, which is easy as pie:
2552 * Having created our hover we now need to set the parent and target. Which if
2553 * you recall from the function documentations are going to tell the hover which
2554 * area it should cover and where it should be centered:
2557 * Now we set the theme for our hover. We're using the popout theme which gives
2558 * our contents a white background and causes their appearance to be animated:
2561 * And finally we set the content for our positions:
2564 * So far so good? Great 'cause that's all there is too it, what is left now is
2565 * just connecting our buttons to the callbacks we defined at the beginning of
2566 * the example and run the main loop:
2569 * Our example will initially look like this:
2571 * @image html screenshots/hover_example_01.png
2572 * @image latex screenshots/hover_example_01.eps width=\textwidth
2574 * And after you click the "Show hover" button it will look like this:
2576 * @image html screenshots/hover_example_01_a.png
2577 * @image latex screenshots/hover_example_01_a.eps width=\textwidth
2579 * @example hover_example_01.c
2583 * @page tutorial_flip Flip example
2584 * @dontinclude flip_example_01.c
2586 * This example will show a flip with two rectangles on it(one blue, one
2587 * green). Our example will allow the user to choose the animation the flip
2588 * uses and to interact with it. To allow the user to choose the interaction
2589 * mode we use radio buttons, we will however not explain them, if you would
2590 * like to know more about radio buttons see @ref radio.
2592 * We start our example with the usual setup and then create the 2 rectangles
2593 * we will use in our flip:
2594 * @until show(rect2)
2596 * The next thing to do is to create our flip and set it's front and back
2600 * The next thing we do is set the interaction mode(which the user can later
2601 * change) to the page animation:
2604 * Setting a interaction mode however is not sufficient, we also need to
2605 * choose which directions we allow interaction from, for this example we
2606 * will use all of them:
2609 * We are also going to set the hitsize to the entire flip(in all directions)
2610 * to make our flip very easy to interact with:
2613 * After that we create our radio buttons and start the main loop:
2616 * When the user clicks a radio button a function that changes the
2617 * interaction mode and animates the flip is called:
2619 * @note The elm_flip_go() call here serves no purpose other than to
2620 * ilustrate that it's possible to animate the flip programmatically.
2622 * Our example will look like this:
2624 * @image html screenshots/flip_example_01.png
2625 * @image latex screenshots/flip_example_01.eps width=\textwidth
2627 * @note Since this is an animated example the screenshot doesn't do it
2628 * justice, it is a good idea to compile it and see the animations.
2630 * @example flip_example_01.c
2634 * @page tutorial_label Label example
2635 * @dontinclude label_example_01.c
2637 * In this example we are going to create 6 labels, set some properties on
2638 * them and see what changes in appearance those properties cause.
2640 * We start with the setup code that by now you should be familiar with:
2643 * For our first label we have a moderately long text(that doesn't fit in the
2644 * label's width) so we will make it a sliding label. Since the text isn't
2645 * too long we don't need the animation to be very long, 3 seconds should
2646 * give us a nice speed:
2649 * For our second label we have the same text, but this time we aren't going
2650 * to have it slide, we're going to ellipsize it. Because we ask our label
2651 * widget to ellipsize the text it will first diminsh the fontsize so that it
2652 * can show as much of the text as possible:
2655 * For the third label we are going to ellipsize the text again, however this
2656 * time to make sure the fontsize isn't diminshed we will set a line wrap.
2657 * The wrap won't actually cause a line break because we set the label to
2661 * For our fourth label we will set line wrapping but won't set ellipsis, so
2662 * that our text will indeed be wrapped instead of ellipsized. For this label
2663 * we choose character wrap:
2666 * Just two more, for our fifth label we do the same as for the fourth
2667 * except we set the wrap to word:
2670 * And last but not least for our sixth label we set the style to "marker" and
2671 * the color to red(the default color is white which would be hard to see on
2672 * our white background):
2675 * Our example will look like this:
2677 * @image html screenshots/label_example_01.png
2678 * @image latex screenshots/label_example_01.eps width=\textwidth
2680 * @example label_example_01.c
2684 * @page tutorial_image Image example
2685 * @dontinclude image_example_01.c
2687 * This example is as simple as possible. An image object will be added to the
2688 * window over a white background, and set to be resizeable together with the
2689 * window. All the options set through the example will affect the behavior of
2692 * We start with the code for creating a window and its background, and also
2693 * add the code to write the path to the image that will be loaded:
2698 * Now we create the image object, and set that file to be loaded:
2702 * We can now go setting our options.
2704 * elm_image_no_scale_set() is used just to set this value to true (we
2705 * don't want to scale our image anyway, just resize it).
2707 * elm_image_scale_set() is used to allow the image to be resized to a size
2708 * smaller than the original one, but not to a size bigger than it.
2710 * elm_elm_image_smooth_set() will disable the smooth scaling, so the scale
2711 * algorithm used to scale the image to the new object size is going to be
2712 * faster, but with a lower quality.
2714 * elm_image_orient_set() is used to flip the image around the (1, 0) (0, 1)
2717 * elm_image_aspect_ratio_retained_set() is used to keep the original aspect
2718 * ratio of the image, even when the window is resized to another aspect ratio.
2720 * elm_image_fill_outside_set() is used to ensure that the image will fill the
2721 * entire area available to it, even if keeping the aspect ratio. The image
2722 * will overflow its width or height (any of them that is necessary) to the
2723 * object area, instead of resizing the image down until it can fit entirely in
2726 * elm_image_editable_set() is used just to cover the API, but won't affect
2727 * this example since we are not using any copy & paste property.
2729 * This is the code for setting these options:
2733 * Now some last touches in our object size hints, window and background, to
2734 * display this image properly:
2738 * This example will look like this:
2740 * @image html screenshots/image_example_01.png
2741 * @image latex screenshots/image_example_01.eps width=\textwidth
2743 * @example image_example_01.c
2747 * @page tutorial_icon Icon example
2748 * @dontinclude icon_example_01.c
2750 * This example is as simple as possible. An icon object will be added to the
2751 * window over a white background, and set to be resizeable together with the
2752 * window. All the options set through the example will affect the behavior of
2755 * We start with the code for creating a window and its background:
2760 * Now we create the icon object, and set lookup order of the icon, and choose
2765 * An intersting thing is that after setting this, it's possible to check where
2766 * in the filesystem is the theme used by this icon, and the name of the group
2771 * We can now go setting our options.
2773 * elm_icon_no_scale_set() is used just to set this value to true (we
2774 * don't want to scale our icon anyway, just resize it).
2776 * elm_icon_scale_set() is used to allow the icon to be resized to a size
2777 * smaller than the original one, but not to a size bigger than it.
2779 * elm_elm_icon_smooth_set() will disable the smooth scaling, so the scale
2780 * algorithm used to scale the icon to the new object size is going to be
2781 * faster, but with a lower quality.
2783 * elm_icon_fill_outside_set() is used to ensure that the icon will fill the
2784 * entire area available to it, even if keeping the aspect ratio. The icon
2785 * will overflow its width or height (any of them that is necessary) to the
2786 * object area, instead of resizing the icon down until it can fit entirely in
2789 * This is the code for setting these options:
2791 * @until fill_outside
2793 * However, if you try this example you may notice that this image is not being
2794 * affected by all of these options. This happens because the used icon will be
2795 * from elementary theme, and thus it has its own set of options like smooth
2796 * scaling and fill_outside options. You can change the "home" icon to use some
2797 * image (from your system) and see that then those options will be respected.
2799 * Now some last touches in our object size hints, window and background, to
2800 * display this icon properly:
2804 * This example will look like this:
2806 * @image html screenshots/icon_example_01.png
2807 * @image latex screenshots/icon_example_01.eps width=\textwidth
2809 * @example icon_example_01.c
2813 * @page tutorial_hoversel Hoversel example
2814 * @dontinclude hoversel_example_01.c
2816 * In this example we will create a hoversel with 3 items, one with a label but
2817 * no icon and two with both a label and an icon. Every item that is clicked
2818 * will be deleted, but everytime the hoversel is activated we will also add an
2819 * item. In addition our first item will print all items when clicked and our
2820 * third item will clear all items in the hoversel.
2822 * We will start with the normal creation of window stuff:
2825 * Next we will create a red rectangle to use as the icon of our hoversel:
2828 * And now we create our hoversel and set some of it's properties. We set @p win
2829 * as its parent, ask it to not be horizontal(be vertical) and give it a label
2833 * Next we will add our three items, setting a callback to be called for the
2837 * We also set a pair of callbacks to be called whenever any item is selected or
2838 * when the hoversel is activated:
2841 * And then ask that our hoversel be shown and run the main loop:
2844 * We now have the callback for our first item which prints all items in the
2848 * Next we have the callback for our third item which removes all items from the
2852 * Next we have the callback that is called whenever an item is clicked and
2853 * deletes that item:
2856 * And the callback that is called when the hoversel is activated and adds an
2857 * item to the hoversel. Note that since we allocate memory for the item we need
2858 * to know when the item dies so we can free that memory:
2861 * And finally the callback that frees the memory we allocated for items created
2862 * in the @p _add_item callback:
2865 * Our example will initially look like this:
2867 * @image html screenshots/hoversel_example_01.png
2868 * @image latex screenshots/hoversel_example_01.eps width=\textwidth
2870 * And when the hoversel is clicked it will look like this:
2872 * @image html screenshots/hoversel_example_01_a.png
2873 * @image latex screenshots/hoversel_example_01_a.eps width=\textwidth
2875 * @example hoversel_example_01.c
2879 * @page conformant_example Conformant Example.
2881 * In this example we'll explain how to create applications to work
2882 * with illume, considering space required for virtual keyboards, indicator
2885 * Illume is a module for Enlightenment that modifies the user interface
2886 * to work cleanly and nicely on a mobile device. It has support for
2887 * virtual keyboard, among other nice features.
2889 * Let's start creating a very simple window with a vertical box
2890 * with multi-line entry between two buttons.
2891 * This entry will expand filling all space on window not used by buttons.
2893 * @dontinclude conformant_example_01.c
2894 * @skipline elm_main
2897 * For information about how to create windows, boxes, buttons or entries,
2898 * look for documentation for these widgets.
2900 * It will looks fine when you don't need a virtual keyboard, as you
2901 * can see on the following image:
2903 * @image html screenshots/conformant_example_01.png
2904 * @image latex screenshots/conformant_example_01.eps width=\textwidth
2906 * But if you call a virtual keyboard, the window will resize, changing
2907 * widgets size and position. All the content will shrink.
2909 * If you don't want such behaviour, you
2910 * will need a conformant to account for space taken up by the indicator,
2911 * virtual keyboard and softkey.
2913 * In this case, using the conformant in a proper way, you will have
2914 * a window like the following:
2916 * @image html screenshots/conformant_example_02.png
2917 * @image latex screenshots/conformant_example_02.eps width=\textwidth
2919 * As you can see, it guess the space that will be required by the keyboard,
2920 * indicator and softkey bars.
2922 * So, let's study each step required to transform our initial example on
2925 * First of all, we need to set the window as an illume conformant window:
2926 * @dontinclude conformant_example_02.c
2927 * @skipline elm_win_conformant_set
2929 * Next, we'll add a conformant widget, and set it to resize with the window,
2930 * instead of the box.
2932 * @until evas_object_show
2934 * Finally, we'll set the box as conformant's content, just like this:
2935 * @skipline elm_conformant_content_set
2937 * Compare both examples code:
2938 * @ref conformant_example_01.c "conformant_example_01.c"
2939 * @ref conformant_example_02.c "conformant_example_02.c"
2941 * @example conformant_example_01.c
2942 * @example conformant_example_02.c
2946 * @page index_example_01 Index widget example 1
2948 * This code places an Elementary index widget on a window, which also
2949 * has a very long list of arbitrary strings on it. The list is
2950 * sorted alphabetically and the index will be used to index the first
2951 * items of each set of strings beginning with an alphabet letter.
2953 * Below the list are some buttons, which are there just to exercise
2954 * some index widget's API.
2956 * Here's how we instantiate it:
2957 * @dontinclude index_example_01.c
2958 * @skip elm_list_add
2959 * @until evas_object_show(d.index)
2960 * where we're showing also the list being created. Note that we issue
2961 * elm_win_resize_object_add() on the index, so that it's set to have
2962 * the whole window as its container. Then, we have to populate both
2963 * list and index widgets:
2964 * @dontinclude index_example_01.c
2965 * @skip for (i = 0; i < (sizeof(dict) / sizeof(dict[0])); i++)
2969 * The strings populating the list come from a file
2970 * @dontinclude index_example_01.c
2971 * @skip static const char *dict
2974 * We use the @c curr char variable to hold the last initial letter
2975 * seen on that ordered list of strings, so that we're able to have an
2976 * index item pointing to each list item starting a new letter
2977 * "section". Note that our index item data pointers will be the list
2978 * item handles. We are also setting a callback function to index
2979 * items deletion events:
2980 * @dontinclude index_example_01.c
2984 * There, we show you that the @c event_info pointer will contain the
2985 * item in question's data, i.e., a given list item's pointer. Because
2986 * item data is also returned in the @c data argument on
2987 * @c Evas_Smart_Cb functions, those two pointers must have the same
2988 * values. On this deletion callback, we're deleting the referred list
2989 * item too, just to exemplify that anything could be done there.
2991 * Next, we hook to two smart events of the index object:
2992 * @dontinclude index_example_01.c
2993 * @skip smart_callback_add(d.index
2994 * @until _index_selected
2995 * @dontinclude index_example_01.c
2996 * @skip "delay,changed" hook
3000 * Check that, whenever one holds the mouse pressed over a given index
3001 * letter for some time, the list beneath it will roll down to the
3002 * item pointed to by that index item. When one releases the mouse
3003 * button, the second callback takes place. There, we check that the
3004 * reported item data, on @c event_info, is the same reported by
3005 * elm_index_item_selected_get(), which gives the last selection's
3006 * data on the index widget.
3008 * The first of the three buttons that follow will call
3009 * elm_index_active_set(), thus showing the index automatically for
3010 * you, if it's not already visible, what is checked with
3011 * elm_index_active_get(). The second button will exercise @b deletion
3012 * of index item objects, by the following code:
3013 * @dontinclude index_example_01.c
3014 * @skip delete an index item
3017 * It will get the last index item selected's data and find the
3018 * respective #Elm_Index_Item handle with elm_index_item_find(). We
3019 * need the latter to query the indexing letter string from, with
3020 * elm_index_item_letter_get(). Next, comes the delition, itself,
3021 * which will also trigger the @c _index_item_del callback function,
3024 * The third button, finally, will exercise elm_index_item_clear(),
3025 * which will delete @b all of the index's items.
3027 * This is how the example program's window looks like with the index
3029 * @image html screenshots/index_example_00.png
3030 * @image latex screenshots/index_example_00.eps
3032 * When it's shown, it's like the following figure:
3033 * @image html screenshots/index_example_01.png
3034 * @image latex screenshots/index_example_01.eps
3036 * See the full @ref index_example_01_c "source code" for
3039 * @example index_example_01.c
3043 * @page index_example_02 Index widget example 2
3045 * This code places an Elementary index widget on a window, indexing
3046 * grid items. The items are placed so that their labels @b don't
3047 * follow any order, but the index itself is ordered (through
3048 * elm_index_item_sorted_insert()). This is a complement to to @ref
3049 * index_example_01 "the first example on indexes".
3051 * Here's the list of item labels to be used on the grid (in that
3053 * @dontinclude index_example_02.c
3054 * @skip static const char *items
3057 * In the interesting part of the code, here, we first instantiate the
3058 * grid (more on grids on their examples) and, after creating our
3059 * index, for each grid item we also create an index one to reference
3061 * @dontinclude index_example_02.c
3062 * @skip grid = elm_gengrid_add
3064 * @until smart_callback_add
3066 * The order in which they'll appear in the index, though, is @b
3067 * alphabetical, becase of elm_index_item_sorted_insert() usage
3068 * together with the comparing function, where we take the letters of
3069 * each index item to base our ordering on. The parameters on
3070 * @c _index_cmp have to be declared as void pointers because of the
3071 * @c Eina_Compare_Cb prototype requisition, but in this case we know
3072 * they'll be #Elm_Index_Item's:
3073 * @dontinclude index_example_02.c
3074 * @skip ordering alphabetically
3077 * The last interesting bit is the callback in the @c "delay,changed"
3078 * smart event, which will bring the given grid item to the grid's
3080 * @dontinclude index_example_02.c
3084 * Note how the grid will move kind of randomly while you move your
3085 * mouse pointer held over the index from top to bottom -- that's
3086 * because of the the random order the items have in the grid itself.
3088 * This is how the example program's window looks like:
3089 * @image html screenshots/index_example_03.png
3090 * @image latex screenshots/index_example_03.eps
3092 * See the full @ref index_example_c "source code" for
3095 * @example index_example_02.c
3099 * @page tutorial_ctxpopup Ctxpopup example
3100 * @dontinclude ctxpopup_example_01.c
3102 * In this example we have a list with two items, when either item is clicked
3103 * a ctxpopup for it will be shown. Our two ctxpopups are quite different, the
3104 * one for the first item is a vertical and it's items contain both labels and
3105 * icons, the one for the second item is horizontal and it's items have icons
3108 * We will begin examining our example code by looking at the callback we'll use
3109 * when items in the ctxpopup are clicked. It's very simple, all it does is
3110 * print the label present in the ctxpopup item:
3113 * Next we examine a function that creates ctxpopup items, it was created to
3114 * avoid repeating the same code whenever we needed to add an item to our
3115 * ctxpopup. Our function creates an icon from the standard set of icons, and
3116 * then creates the item, with the label received as an argument. We also set
3117 * the callback to be called when the item is clicked:
3120 * Finally we have the function that will create the ctxpopup for the first item
3121 * in our list. This one is somewhat more complex though, so let's go through it
3122 * in parts. First we declare our variable and add the ctxpopup:
3123 * @until ctxpopup_add
3125 * Next we create a bunch of items for our ctxpopup, marking two of them as
3126 * disabled just so we can see what that will look like:
3127 * @until disabled_set
3128 * @until disabled_set
3130 * Then we ask evas where the mouse pointer was so that we can have our ctxpopup
3131 * appear in the right place, set a maximum size for the ctxpopup, move it and
3135 * And last we mark the list item as not selected:
3138 * Our next function is the callback that will create the ctxpopup for the
3139 * second list item, it is very similar to the previous function. A couple of
3140 * interesting things to note is that we ask our ctxpopup to be horizontal, and
3141 * that we pass NULL as the label for every item:
3144 * And with all of that in place we can now get to our main function where we
3145 * create the window, the list, the list items and run the main loop:
3148 * The example will initially look like this:
3150 * @image html screenshots/ctxpopup_example_01.png
3151 * @image latex screenshots/ctxpopup_example_01.eps width=\textwidth
3153 * @note This doesn't show the ctxpopup tough, since it will only appear when
3154 * we click one of the list items.
3156 * Here is what our first ctxpopup will look like:
3158 * @image html screenshots/ctxpopup_example_01_a.png
3159 * @image latex screenshots/ctxpopup_example_01_a.eps width=\textwidth
3161 * And here the second ctxpopup:
3163 * @image html screenshots/ctxpopup_example_01_b.png
3164 * @image latex screenshots/ctxpopup_example_01_b.eps width=\textwidth
3166 * @example ctxpopup_example_01.c
3170 * @page tutorial_pager
3171 * @dontinclude pager_example_01.c
3173 * In this example we'll have a pager with 3 rectangles on it, one blue, one
3174 * green and one blue, we'll also have 1 button for each rectangle. Pressing a
3175 * button will bring the associated rectangle to the front of the pager(promote
3178 * We start our example with some run of the mill code that you've seen in other
3182 * And then we get right to creating our pager, setting a style and some basic
3186 * Well a pager without any content is not of much use, so let's create the
3187 * first of our rectangles, add it to the pager and create the button for it:
3188 * @until smart_callback
3189 * @note The only line of above code that directly relates to our pager is the
3190 * call to elm_pager_content_push().
3192 * And now we will do the same thing again twice for our next two rectangles:
3193 * @until smart_callback
3194 * @until smart_callback
3196 * Now that we haver our widgets create we can get to running the main loop:
3199 * We also have the callback that is called when any of the buttons is pressed,
3200 * this callback is receiving the rectangle in it's @p data argument, so we
3201 * check if it's already on top and if not move it there:
3204 * Our example will look like this:
3206 * @image html screenshots/pager_example_01.png
3207 * @image latex screenshots/pager_example_01.eps width=\textwidth
3208 * @note Like all examples that involve animations the screenshot doesn't do it
3209 * justice, seeing it in action is a must.
3211 * @example pager_example_01.c
3215 * @page tutorial_separator Separator example
3216 * @dontinclude separator_example_01.c
3218 * In this example we are going to pack two rectangles in a box, and have a
3219 * separator in the middle.
3221 * So we start we the window, background, box and rectangle creation, all pretty
3225 * Once we have our first rectangle in the box we create and add our separator:
3227 * @note Since our box is in horizontal mode it's a good idea to set the
3228 * separator to be horizontal too.
3230 * And now we add our second rectangle and run the main loop:
3233 * This example will look like this:
3235 * @image html screenshots/separator_example_01.png
3236 * @image eps screenshots/separator_example_01.eps width=\textwidth
3238 * @example separator_example_01.c
3242 * @page tutorial_radio Radio example
3243 * @dontinclude radio_example_01.c
3245 * In this example we will create 4 radio buttons, three of them in a group and
3246 * another one not in the group. We will also have the radios in the group
3247 * change the value of a variable directly and have then print it when the value
3248 * changes. The fourth button is in the example just to make clear that radios
3249 * outside the group don't affect the group.
3251 * We'll start with the usual includes:
3254 * And move right to declaring a static variable(the one whose value the radios
3258 * We now need to have a window and all that good stuff to be able to place our
3262 * And now we create a radio button, since this is the first button in our group
3263 * we set the group to be the radio(so we can set the other radios in the same
3264 * group). We also set the state value of this radio to 1 and the value pointer
3265 * to @p val, since val is @p 1 this has the additional effect of setting the
3266 * radio value to @p 1. For this radio we choose the default home icon:
3269 * To check that our radio buttons are working we'll add a callback to the
3270 * "changed" signal of the radio:
3271 * @until smart_callback
3273 * The creation of our second radio button is almost identical, the 2
3274 * differences worth noting are, the value of this radio 2 and that we add this
3275 * radio to the group of the first radio:
3276 * @until smart_callback
3278 * For our third callback we'll omit the icon and set the value to 3, we'll also
3279 * add it to the group of the first radio:
3280 * @until smart_callback
3282 * Our fourth callback has a value of 4, no icon and most relevantly is not a
3283 * member of the same group as the other radios:
3286 * We finally run the main loop:
3289 * And the last detail in our example is the callback that prints @p val so that
3290 * we can see that the radios are indeed changing its value:
3293 * The example will look like this:
3295 * @image html screenshots/radio_example_01.png
3296 * @image latex screenshots/radio_example_01.epx width=\textwidth
3298 * @example radio_example_01.c
3302 * @page tutorial_toggle Toggle example
3303 * @dontinclude toggle_example_01.c
3305 * In this example we'll create 2 toggle widgets. The first will have an icon
3306 * and the state names will be the default "on"/"off", it will also change the
3307 * value of a variable directly. The second won't have a icon, the state names
3308 * will be "Enabled"/"Disabled", it will start "Enabled" and it won't set the
3309 * value of a variable.
3311 * We start with the usual includes and prototype for callback which will be
3312 * implemented and detailed later on:
3315 * We then declare a static global variable(the one whose value will be changed
3316 * by the first toggle):
3319 * We now have to create our window and all that usual stuff:
3322 * The creation of a toggle is no more complicated than that of any other
3326 * For our first toggle we don't set the states labels so they will stay the
3327 * default, however we do set a label for the toggle, an icon and the variable
3328 * whose value it should change:
3331 * We also set the callback that will be called when the toggles value changes:
3332 * @until smart_callback
3334 * For our second toggle it important to note that we set the states labels,
3335 * don't set an icon or variable, but set the initial state to
3336 * EINA_TRUE("Enabled"):
3339 * For the second toggle we will use a different callback:
3340 * @until smart_callback
3342 * We then ask the main loop to start:
3345 * The callback for our first toggle will look the value of @p val and print it:
3348 * For our second callback we need to do a little bit more, since the second
3349 * toggle doesn't change the value of a variable we have to ask it what its
3353 * This example will look like this:
3355 * @image html screenshots/toggle_example_01.png
3356 * @image latex screenshots/toggle_example_01.eps width=\textwidth
3358 * @example toggle_example_01.c
3362 * @page tutorial_panel Panel example
3363 * @dontinclude panel_example_01.c
3365 * In this example will have 3 panels, one for each possible orientation. Two of
3366 * our panels will start out hidden, the third will start out expanded. For each
3367 * of the panels we will use a label as the content, it's however possible to
3368 * have any widget(including containers) as the content of panels.
3370 * We start by doing some setup, code you should be familiar with from other
3374 * And move right to creating our first panel, for this panel we are going to
3375 * choose the orientation as TOP and toggle it(tell it to hide itself):
3378 * For the second panel we choose the RIGHT orientation and explicitly set the
3382 * For our third and last panel we won't set the orientation(which means it will
3383 * use the default: LEFT):
3386 * All that is left is running the main loop:
3389 * This example will look like this;
3391 * @image html screenshots/panel_example_01.png
3392 * @image latex screenshots/panel_example_01.epx width=\textwidth
3393 * @note The buttons with arrow allow the user to hide/show the panels.
3395 * @example panel_example_01.c
3399 * @page gengrid_example Gengrid widget example
3401 * This application is a thorough exercise on the gengrid widget's
3402 * API. We place an Elementary gengrid widget on a window, with
3403 * various knobs below its viewport, each one acting on it somehow.
3405 * The code's relevant part begins at the grid's creation. After
3406 * instantiating it, we set its items sizes, so that we don't end with
3407 * items one finger size wide, only. We're setting them to fat, 150
3408 * pixel wide ones, for this example. We give it some size hints, not
3409 * to be discussed in this context and, than, we register a callback
3410 * on one of its smart events -- the one coming each time an item gets
3411 * doubly clicked. There, we just print the item handle's value.
3412 * @dontinclude gengrid_example.c
3413 * @skip grid = elm_gengrid_add
3414 * @until evas_object_sho
3415 * @dontinclude gengrid_example.c
3416 * @skip item double click callback
3419 * Before we actually start to deal with the items API, let's show
3420 * some things items will be using throughout all the code. The first
3421 * of them is a struct to be used as item data, for all of them:
3422 * @dontinclude gengrid_example.c
3423 * @skip typedef struct
3426 * That path will be used to index an image, to be swallowed into one
3427 * of the item's icon spots. The imagens themselves are distributed
3429 * @dontinclude gengrid_example.c
3430 * @skip static const char *imgs
3433 * We also have an (unique) gengrid item class we'll be using for
3434 * items in the example:
3435 * @dontinclude gengrid_example.c
3436 * @skip static Elm_Gengrid_Item_Class
3437 * @until static Elm_Gengrid_Item_Class
3438 * @dontinclude gengrid_example.c
3439 * @skip item_style =
3442 * As you see, our items will follow the default theme on gengrid
3443 * items. For the label fetching code, we return a string composed of
3444 * the item's image path:
3445 * @dontinclude gengrid_example.c
3446 * @skip label fetching callback
3449 * For item icons, we'll be populating the item default theme's two
3450 * icon spots, @c "elm.swallow.icon" and @c "elm.swallow.end". The
3451 * former will receive one of the images in our list (in the form of
3452 * a @ref bg_02_example_page "background"), while the latter will be
3453 * a check widget. Note that we prevent the check to propagate click
3454 * events, so that the user can toggle its state without messing with
3455 * the respective item's selection in the grid:
3456 * @dontinclude gengrid_example.c
3457 * @skip icon fetching callback
3458 * @until return NULL
3461 * As the default gengrid item's theme does not have parts
3462 * implementing item states, we'll be just returning false for every
3464 * @dontinclude gengrid_example.c
3465 * @skip state fetching callback
3468 * Finally, the deletion callback on gengrid items takes care of
3469 * freeing the item's label string and its data struct:
3470 * @dontinclude gengrid_example.c
3471 * @skip deletion callback
3474 * Let's move to item insertion/deletion knobs, them. They are four
3475 * buttons, above the grid's viewport, namely
3476 * - "Append" (to append an item to the grid),
3477 * - "Prepend" (to prepend an item to the grid),
3478 * - "Insert before" (to insert an item before the selection, on the
3480 * - "Insert after" (to insert an item after the selection, on the
3482 * - "Clear" (to delete all items in the grid),
3483 * - "Bring in 1st" (to make the 1st item visible, by scrolling),
3484 * - "Show last" (to directly show the last item),
3486 * which are displaced and declared in that order. We're not dealing
3487 * with the buttons' creation code (see @ref button_example_01
3488 * "a button example", for more details on it), but with their @c
3489 * "clicked" registered callbacks. For all of them, the grid's handle
3490 * is passed as @c data. The ones creating new items use a common
3491 * code, which just gives a new @c Example_Item struct, with @c path
3492 * filled with a random image in our images list:
3493 * @dontinclude gengrid_example.c
3494 * @skip new item with random path
3497 * Moreover, that ones will set a common function to be issued on the
3498 * selection of the items. There, we print the item handle's value,
3499 * along with the callback function data. The latter will be @c NULL,
3500 * always, because it's what we pass when adding all icons. By using
3501 * elm_gengrid_item_data_get(), we can have the item data back and,
3502 * with that, we're priting the item's path string. Finally, we
3503 * exemplify elm_gengrid_item_pos_get(), printing the item's position
3505 * @dontinclude gengrid_example.c
3506 * @skip item selection callback
3509 * The appending button will exercise elm_gengrid_item_append(), simply:
3510 * @dontinclude gengrid_example.c
3511 * @skip append an item
3514 * The prepending, naturally, is analogous, but exercising
3515 * elm_gengrid_item_prepend(), on its turn. The "Insert before" one
3516 * will expect an item to be selected in the grid, so that it will
3517 * insert a new item just before it:
3518 * @dontinclude gengrid_example.c
3519 * @skip "insert before" callback
3522 * The "Insert after" is analogous, just using
3523 * elm_gengrid_item_insert_after(), instead. The "Clear" button will,
3524 * as expected, just issue elm_gengrid_clear():
3525 * @dontinclude gengrid_example.c
3526 * @skip delete items
3529 * The "Bring in 1st" button is there exercise two gengrid functions
3530 * -- elm_gengrid_first_item_get() and elm_gengrid_item_bring_in().
3531 * With the former, we get a handle to the first item and, with the
3532 * latter, you'll see that the widget animatedly scrolls its view
3533 * until we can see that item:
3534 * @dontinclude gengrid_example.c
3535 * @skip bring in 1st item
3538 * The "Show last", in its turn, will use elm_gengrid_last_item_get()
3539 * and elm_gengrid_item_show(). The latter differs from
3540 * elm_gengrid_item_bring_in() in that it immediately replaces the
3541 * contents of the grid's viewport with the region containing the item
3543 * @dontinclude gengrid_example.c
3544 * @skip show last item
3547 * To change the grid's cell (items) size, we've placed a spinner,
3548 * which has the following @c "changed" smart callback:
3549 * @dontinclude gengrid_example.c
3550 * @skip change items' size
3553 * Experiment with it and see how the items are affected. The "Disable
3554 * item" button will, as the name says, disable the currently selected
3556 * @dontinclude gengrid_example.c
3557 * @skip disable selected item
3559 * Note that we also make use of elm_gengrid_item_selected_set(),
3560 * there, thus making the item unselected before we actually disable
3563 * To toggle between horizontal and vertical layouting modes on the
3564 * grid, use the "Horizontal mode" check, which will call the
3565 * respective API function on the grid:
3566 * @dontinclude gengrid_example.c
3567 * @skip change layouting mode
3570 * If you toggle the check right after that one, "Always select",
3571 * you'll notice all subsequent clicks on the @b same grid item will
3572 * still issue the selection callback on it, what is different from
3573 * when it's not checked. This is the
3574 * elm_gengrid_always_select_mode_set() behavior:
3575 * @dontinclude gengrid_example.c
3576 * @skip "always select" callback
3579 * One more check follows, "Bouncing", which will turn on/off the
3580 * bouncing animations on the grid, when one scrolls past its
3581 * borders. Experiment with scrolling the grid to get the idea, having
3582 * it turned on and off:
3583 * @dontinclude gengrid_example.c
3584 * @skip "bouncing mode" callback
3587 * The next two checks will affect items selection on the grid. The
3588 * first, "Multi-selection", will make it possible to select more the
3589 * one item on the grid. Because it wouldn't make sense to fetch for
3590 * an unique selected item on this case, we also disable two of the
3591 * buttons, which insert items relatively, if multi-selection is on:
3592 * @dontinclude gengrid_example.c
3593 * @skip multi-selection callback
3596 * Note that we also @b unselect all items in the grid, when returning
3597 * from multi-selection mode, making use of
3598 * elm_gengrid_item_selected_set().
3600 * The second check acting on selection, "No selection", is just what
3601 * its name depicts -- no selection will be allowed anymore, on the
3602 * grid, while it's on. Check it out for yourself, interacting with
3604 * @dontinclude gengrid_example.c
3605 * @skip no selection callback
3608 * We have, finally, one more line of knobs, now sliders, to change
3609 * the grids behavior. The two first will change the horizontal @b
3610 * alignment of the whole actual grid of items within the gengrid's
3612 * @dontinclude gengrid_example.c
3613 * @skip items grid horizontal alignment change
3616 * Naturally, the vertical counterpart just issues
3617 * elm_gengrid_align_set() changing the second alignment component,
3620 * The last slider will change the grid's <b>page size</b>, relative
3621 * to its own one. Try to change those values and, one manner of
3622 * observing the paging behavior, is to scroll softly and release the
3623 * mouse button, with different page sizes, at different grid
3624 * positions, while having lots of items in it -- you'll see it
3625 * snapping to page boundaries differenty, for each configuration:
3626 * @dontinclude gengrid_example.c
3627 * @skip page relative size change
3630 * This is how the example program's window looks like:
3631 * @image html screenshots/gengrid_example.png
3632 * @image latex screenshots/gengrid_example.eps
3634 * Note that it starts with three items which we included at will:
3635 * @dontinclude gengrid_example.c
3636 * @skip _clicked(grid,
3637 * @until _clicked(grid,
3638 * @until _clicked(grid,
3639 * @until _clicked(grid,
3641 * See the full @ref gengrid_example_c "source code" for
3644 * @example gengrid_example.c
3648 * @page bg_example_01_c bg_example_01.c
3649 * @include bg_example_01.c
3650 * @example bg_example_01.c
3654 * @page bg_example_02_c bg_example_02.c
3655 * @include bg_example_02.c
3656 * @example bg_example_02.c
3660 * @page bg_example_03_c bg_example_03.c
3661 * @include bg_example_03.c
3662 * @example bg_example_03.c
3666 * @page actionslider_example_01 Actionslider example
3667 * @include actionslider_example_01.c
3668 * @example actionslider_example_01.c
3672 * @page animator_example_01_c Animator example 01
3673 * @include animator_example_01.c
3674 * @example animator_example_01.c
3678 * @page transit_example_01_c Transit example 1
3679 * @include transit_example_01.c
3680 * @example transit_example_01.c
3684 * @page transit_example_02_c Transit example 2
3685 * @include transit_example_02.c
3686 * @example transit_example_02.c
3690 * @page general_functions_example_c General (top-level) functions example
3691 * @include general_funcs_example.c
3692 * @example general_funcs_example.c
3696 * @page clock_example_c Clock example
3697 * @include clock_example.c
3698 * @example clock_example.c
3702 * @page flipselector_example_c Flipselector example
3703 * @include flipselector_example.c
3704 * @example flipselector_example.c
3708 * @page fileselector_example_c Fileselector example
3709 * @include fileselector_example.c
3710 * @example fileselector_example.c
3714 * @page fileselector_button_example_c Fileselector button example
3715 * @include fileselector_button_example.c
3716 * @example fileselector_button_example.c
3720 * @page fileselector_entry_example_c Fileselector entry example
3721 * @include fileselector_entry_example.c
3722 * @example fileselector_entry_example.c
3726 * @page index_example_01_c Index example
3727 * @include index_example_01.c
3728 * @example index_example_01.c
3732 * @page index_example_02_c Index example
3733 * @include index_example_02.c
3734 * @example index_example_02.c
3738 * @page layout_example_01_c layout_example_01.c
3739 * @include layout_example_01.c
3740 * @example layout_example_01.c
3744 * @page layout_example_02_c layout_example_02.c
3745 * @include layout_example_02.c
3746 * @example layout_example_02.c
3750 * @page layout_example_03_c layout_example_03.c
3751 * @include layout_example_03.c
3752 * @example layout_example_03.c
3756 * @page layout_example_edc An example of layout theme file
3758 * This theme file contains two groups. Each of them is a different theme, and
3759 * can be used by an Elementary Layout widget. A theme can be used more than
3760 * once by many different Elementary Layout widgets too.
3762 * @include layout_example.edc
3763 * @example layout_example.edc
3766 * @page gengrid_example_c Gengrid example
3767 * @include gengrid_example.c
3768 * @example gengrid_example.c