You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

6880 lines
242 KiB

/**
* @page Examples Examples
*
* Here is a list of all Elementary examples.
*
* @ref bg_01_example_page
*
* @ref bg_02_example_page
*
* @ref bg_03_example_page
*
* @ref actionslider_example_page
*
* @ref transit_example_01_explained
*
* @ref transit_example_02_explained
*
* @ref general_functions_example_page
*
* @ref calendar_example_01
*
* @ref calendar_example_02
*
* @ref calendar_example_03
*
* @ref calendar_example_04
*
* @ref calendar_example_05
*
* @ref calendar_example_06
*
* @ref combobox_example_01
*
* @ref spinner_example
*
* @ref slider_example
*
* @ref panes_example
*
* @ref clock_example
*
* @ref datetime_example
*
* @ref dayselector_example
*
* @ref mapbuf_example
*
* @ref map_example_01
*
* @ref map_example_02
*
* @ref map_example_03
*
* @ref diskselector_example_01
*
* @ref diskselector_example_02
*
* @ref entry_example
*
* @ref list_example_01
*
* @ref list_example_02
*
* @ref list_example_03
*
* @ref toolbar_example_01
*
* @ref toolbar_example_02
*
* @ref toolbar_example_03
*
* @ref segment_control_example
*
* @ref flipselector_example
*
* @ref fileselector_example
*
* @ref fileselector_button_example
*
* @ref fileselector_entry_example
*
* @ref index_example_01
*
* @ref index_example_02
*
* @ref gengrid_example
*
* @ref genlist_example_01
*
* @ref genlist_example_02
*
* @ref genlist_example_03
*
* @ref genlist_example_04
*
* @ref genlist_example_05
*
* @ref glview_example_01_page
*
* @ref thumb_example_01
*
* @ref progressbar_example
*
* @ref slideshow_example
*
* @ref efl_thread_1
*
* @ref efl_thread_2
*
* @ref efl_thread_3
*
* @ref efl_thread_4
*
* @ref efl_thread_5
*
* @ref efl_thread_6
*
* @ref prefs_example_01
*
* @ref prefs_example_02
*
* @ref prefs_example_03
*/
/**
* @page bg_01_example_page elm_bg - Plain color background.
* @dontinclude bg_example_01.c
*
* The full code for this example can be found at @ref bg_example_01_c,
* in the function @c test_bg_plain. It's part of the @c elementary_test
* suite, and thus has the code for the three examples referenced by this
* documentation.
*
* This first example just sets a default background with a plain color. The
* first part consists of creating an Elementary window. It's the common
* piece of code that you'll see everywhere in Elementary: @skip elm_main
* @until autodel_set
*
* Now we really create our background object, using the window object as
* its parent:
*
* @skipline bg_add
*
* Then we set the size hints of the background object so that it will use
* all space available for it, and then add it as a resize object to the
* window, making it visible in the end:
*
* @skip size_hint_weight_set
* @until resize_object_add
*
* See evas_object_size_hint_weight_set() and elm_win_resize_object_add()
* for more detailed info about these functions.
*
* The end of the example is quite simple, just setting the minimum and
* maximum size of the background, so the Elementary window knows that it
* has to have at least the minimum size. The background also won't scale to
* a size above its maximum. Then we resize the window and show it in the
* end:
*
* @skip set size hints
* @until }
*
* And here we finish our very simple background object usage example.
*/
/**
* @page bg_02_example_page elm_bg - Image background.
* @dontinclude bg_example_02.c
*
* The full code for this example can be found at @ref bg_example_02_c,
* in the function @c test_bg_image. It's part of the @c elementary_test
* suite, and thus has the code for the three examples referenced by this
* documentation.
*
* This is the second example, and shows how to use the Elementary
* background object to set an image as background of your application.
*
* We start this example exactly in the same way as the previous one, even
* when creating the background object:
*
* @skip elm_main
* @until bg_add
*
* Now it's the different part.
*
* Our background will have an image, that will be displayed over the
* background color. Before loading the image, we set the load size of the
* image. The load size is a hint about the size that we want the image
* displayed in the screen. It's not the exact size that the image will have,
* but usually a bit bigger. The background object can still be scaled to a
* size bigger than the one set here. Setting the image load size to
* something smaller than its real size will reduce the memory used to keep
* the pixmap representation of the image, and the time to load it. Here we
* set the load size to 20x20 pixels, but the image is loaded with a size
* bigger than that (since it's just a hint):
*
* @skipline load_size_set
*
* And set our background image to be centered, instead of stretched or
* scaled, so the effect of the elm_bg_load_size_set() can be easily
* understood:
*
* @skipline option_set
*
* We need a filename to set, so we get one from the previous installed
* images in the @c PACKAGE_DATA_DIR, and write its full path to a buffer.
* Then we use this buffer to set the filename in the background object:
*
* @skip snprintf
* @until bg_file_set
*
* Notice that the third argument of the elm_bg_file_set() function is @c
* NULL, since we are setting an image to this background. This function
* also supports setting an edje group as background, in which case the @c
* group parameter wouldn't be @c NULL, but be the name of the group
* instead.
*
* Finally, we can set the size hints, add the background as a resize
* object, and resize the window, exactly the same thing we do in the @ref
* bg_01_example_page example:
*
* @skip size_hint
* @until }
*
* And this is the end of this example.
*
* This example will look like this:
*
* @image html screenshots/bg_01.png
* @image latex screenshots/bg_01.eps width=\textwidth
*/
/**
* @page bg_03_example_page elm_bg - Background properties.
* @dontinclude bg_example_03.c
*
* The full code for this example can be found at @ref bg_example_03_c, in the
* function @c test_bg_options, with the callbacks @c _cb_overlay_changed, @c
* _cb_color_changed and @c _cb_radio_changed defined in the beginning of the
* file. It's part of the @c elementary_test suite, and thus has the code for
* the three examples referenced by this documentation.
*
* This example will show the properties available for the background object,
* and will use of some more widgets to set them.
*
* In order to do this, we will set some callbacks for these widgets. The
* first is for the radio buttons that will be used to choose the option
* passed as argument to elm_bg_option_set():
*
* @skip _cb_radio_changed
* @until }
*
* The next callback will be used when setting the overlay (using
* elm_object_content_set()):
*
* @skip _cb_overlay_changed
* @until }
* @until }
*
* And the last one, used to set the color (with elm_bg_color_set()):
*
* @skip _cb_color_changed
* @until }
*
* We will get back to what these functions do soon. If you want to know more
* about how to set these callbacks and what these widgets are, look for:
* @li elm_radio_add()
* @li elm_check_add()
* @li elm_spinner_add()
*
* Now going to the main function, @c test_bg_options, we have the common
* code with the other examples:
*
* @skip bg-options
* @until autodel_set
*
* We add a plain background to this window, so it will have the default
* background color behind everything:
*
* @skip bg = elm_bg_add
* @until evas_object_show(bg)
*
* Then we add a vertical box (elm_box_add()) that will hold the background
* object that we are going to play with, as well as a horizontal box that
* will hold widgets:
*
* @skip elm_box_add
* @until evas_object_show
*
* Now we add the background object that is going to be of use for our
* example. It is an image background, as used in @ref bg_02_example_page ,
* so the code should be familiar:
*
* @skip elm_bg_add
* @until evas_object_show
*
* Notice the call to elm_box_pack_end(): it will pack the background object
* in the end of the Elementary box declared above. Just refer to that
* documentation for more info.
*
* Since this Elementary background is already an image background, we are
* going to play with its other properties. We will change its option
* (CENTER, SCALE, STRETCH, TILE), its color (RGB), and add an overlay to it.
* For all of these properties, we are going to add widgets that will
* configure them.
*
* First, lets add the horizontal box that will hold these widgets:
* @skip hbox
* @until align_set
*
* For now, just consider this @c hbox as a rectangle that will contain the
* widgets, and will distribute them horizontally inside its content. Then we
* add radio buttons that will allow us to choose the property to use with
* this background:
*
* @skip radio_add
* @until evas_object_show
*
* Again, I won't give details about the use of these widgets, just look for
* their documentation if necessary. It's enough to know for now that we are
* packing them in the @c hbox, setting a label for them, and the most
* important parts: setting its value to @c ELM_BG_OPTION_CENTER and its
* callback to @c _cb_radio_changed (the function defined in the beginning of
* this example). We do this for the next 3 radio buttons added after this
* one, each of them with a different value.
*
* Now taking a look at the code of the callback @c _cb_radio_changed again,
* it will call elm_bg_option_set() with the value set from the checked radio
* button, thus setting the option for this background. The background is
* passed as argument to the @p data parameter of this callback, and is
* referenced here as @c o_bg.
*
* Later we set the default value for this radio button:
*
* @skipline elm_radio_value_set
*
* Then we add a checkbox for the elm_object_content_set() function for the bg:
*
* @skip check_add
* @until evas_object_show
*
* Now look at the code of the @c _cb_overlay_changed again. If the checkbox
* state is checked, an overlay will be added to the background. It's done by
* creating an Edje object, and setting it with elm_object_content_set() to the
* background object. For information about what are and how to set Edje
* object, look at the Edje documentation.
*
* Finally we add a spinner object (elm_spinner_add()) to be used to select
* the color of our background. In its callback it's possible to see the call
* to elm_bg_color_set(), which will change the color of this background.
* This color is used by the background to fill areas where the image doesn't
* cover (in this case, where we have an image background). The spinner is
* also packed into the @c hbox :
*
* @skip elm_spinner_add
* @until evas_object_show
*
* Then we just have to pack the @c hbox inside the @c box, set some size
* hints, and show our window:
*
* @skip pack_end
* @until }
*
* Now to see this code in action, open elementary_test, and go to the "Bg
* Options" test. It should demonstrate what was implemented here.
*/
/**
* @page actionslider_example_page Actionslider usage
* @dontinclude actionslider_example_01.c
*
* For this example we are going to assume knowledge of evas smart callbacks
* and some basic evas object functions. Elementary is not meant to be used
* without evas, if you're not yet familiar with evas it probably is worth
* checking that out.
*
* And now to the example, when using Elementary we start by including
* Elementary.h:
* @skipline #include
*
* Next we define some callbacks, they all share the same signature because
* they are all to be used with evas_object_smart_callback_add().
* The first one just prints the selected label(in two different ways):
* @until }
*
* This next callback is a little more interesting, it makes the selected
* label magnetic(except if it's the center label):
* @until }
*
* This callback enables or disables the magnetic property of the center
* label:
* @until }
*
* And finally a callback to stop the main loop when the window is closed:
* @until }
*
* To be able to create our actionsliders we need to do some setup, but this
* isn't really relevant here, so if you want to know about that go @ref
* Elm_Win "here".
*
* With all that boring stuff out of the way we can proceed to creating some
* actionsliders.@n
* All actionsliders are created the same way:
* @skipline actionslider_add
* Next we must choose where the indicator starts, and for this one we choose
* the right, and set the right as magnetic:
* @skipline indicator_pos_set
* @until magnet_pos_set
*
* We then set the labels for the left and right, passing NULL as an argument
* to any of the labels makes that position have no label.
* @until Stop
*
* Furthermore we mark both left and right as enabled positions, if we didn't
* do this all three positions would be enabled:
* @until RIGHT
*
* Having the enabled positions we now add a smart callback to change
* which position is magnetic, so that only the last selected position is
* magnetic:
* @until NULL
*
* And finally we set our printing callback and show the actionslider:
* @until object_show
* @skip pack_end
*
* For our next actionslider we are going to do much as we did for the
* previous except we are going to have the center as the magnet(and not
* change it):
* @skipline actionslider_add
* @skipline indicator_pos_set
* @until object_show
*
* And another actionslider, in this one the indicator starts on the left.
* It has labels only in the center and right, and both positions are
* magnetic. Because the left doesn't have a label and is not magnetic once
* the indicator leaves it can't return:
* @skipline actionslider_add
* @skipline indicator_pos_set
* @until object_show
* @note The greyed out area is a @ref Styles "style".
*
* And now an actionslider with a label in the indicator, and whose magnet
* properties change based on what was last selected:
* @skipline actionslider_add
* @skipline indicator_pos_set
* @until object_show
* @note The greyed out area is a @ref Styles "style".
*
* We are almost done, this next one is just an actionslider with all
* positions magnetized and having every possible label:
* @skipline actionslider_add
* @skipline indicator_pos_set
* @until object_show
*
* And for our last actionslider we have one that turns the magnetic property
* on and off:
* @skipline actionslider_add
* @skipline indicator_pos_set
* @until object_show
*
* The example will look like this:
*
* @image html screenshots/actionslider_01.png
* @image latex screenshots/actionslider_01.eps width=\textwidth
*
* See the full source code @ref actionslider_example_01 "here"
*/
/**
* @page transit_example_03_c elm_transit - Combined effects and options.
*
* This example shows how to apply the following transition effects:
* @li translation
* @li color
* @li rotation
* @li wipe
* @li zoom
* @li resizing
*
* It allows you to apply more than one effect at once, and also allows to
* set properties like event_enabled, auto_reverse, repeat_times and
* tween_mode.
*
* @include transit_example_03.c
* @example transit_example_03.c
*/
/**
* @page transit_example_04_c elm_transit - Combined effects over two objects.
*
* This example shows how to apply the transition effects:
* @li flip
* @li resizable_flip
* @li fade
* @li blend
* over two objects. This kind of transition effect is used to make one
* object disappear and another one appear on its place.
*
* You can mix more than one effect of this type on the same objects, and the
* transition will apply both.
*
* @include transit_example_04.c
* @example transit_example_04.c
*/
/**
* @page transit_example_01_explained elm_transit - Basic transit usage.
* @dontinclude transit_example_01.c
*
* The full code for this example can be found at @ref transit_example_01_c.
*
* This example shows the simplest way of creating a transition and applying
* it to an object. Similarly to every other elementary example, we create a
* window, set its title, size, autodel property, and setup a callback to
* exit the program when finished:
*
* @skip on_done
* @until evas_object_resize
*
* We also add a resizable white background to use behind our animation:
*
* @skip bg_add
* @until evas_object_show
*
* And then we add a button that we will use to demonstrate the effects of
* our animation:
*
* @skip button_add
* @until evas_object_show(win)
*
* Notice that we are not adding the button with elm_win_resize_object_add()
* because we don't want the window to control the size of the button. We
* will use the transition to change the button size, so it could conflict
* with something else trying to control that size.
*
* Now, the simplest code possible to create the resize animation:
*
* @skip transit_add
* @until transit_go
*
* As you can see, this code is very easy to understand. First, we create the
* transition itself with elm_transit_add(). Then we add the button to this
* transition with elm_transit_object_add(), which means that the transition
* will operate over this button. The effect that we want now is changing the
* object size from 100x50 to 300x150, and can be achieved by adding the
* resize effect with elm_transit_effect_resizing_add().
*
* Finally, we set the transition time to 5 seconds and start the transition
* with elm_transit_go(). If we wanted more effects applied to this
* button, we could add them to the same transition. See the
* @ref transit_example_03_c to watch many transitions being applied to an
* object.
*/
/**
* @page transit_example_02_explained elm_transit - Chained transitions.
* @dontinclude transit_example_02.c
*
* The full code for this example can be found at @ref transit_example_02_c.
*
* This example shows how to implement a chain of transitions. This chain is
* used to start a transition just after another transition ended. Similarly
* to every other elementary example, we create a window, set its title,
* size, autodel property, and setup a callback to exit the program when
* finished:
*
* @skip on_done
* @until evas_object_resize
*
* We also add a resizable white background to use behind our animation:
*
* @skip bg_add
* @until evas_object_show
*
* This example will have a chain of 4 transitions, each of them applied to
* one button. Thus we create 4 different buttons:
*
* @skip button_add
* @until evas_object_show(bt4)
*
* Now we create a simple translation transition that will be started as soon
* as the program loads. It will be our first transition, and the other
* transitions will be started just after this transition ends:
*
* @skip transit_add
* @until transit_go
*
* The code displayed until now has nothing different from what you have
* already seen in @ref transit_example_01_explained, but now comes the new
* part: instead of creating a second transition that will start later using
* a timer, we create the it normally, and use
* elm_transit_chain_transit_add() instead of elm_transit_go. Since we are
* adding it in a chain after the first transition, it will start as soon as
* the first transition ends:
*
* @skip transit_add
* @until transit_chain_transit_add
*
* Finally we add the 2 other transitions to the chain, and run our program.
* It will make one transition start after the other finish, and there is the
* transition chain.
*/
/**
* @page general_functions_example_page General (top-level) functions example
* @dontinclude general_funcs_example.c
*
* As told in their documentation blocks, the
* elm_app_compile_*_dir_set() family of functions have to be called
* before elm_app_info_set():
* @skip tell elm about
* @until elm_app_info_set
*
* We are here setting the fallback paths to the compiling time target
* paths, naturally. If you're building the example out of the
* project's build system, we're assuming they are the canonical ones.
*
* After the program starts, elm_app_info_set() will actually run and
* then you'll see a problem: Elementary does the prefix lookup @b
* twice. This is so because of the quicklaunch infrastructure in
* Elementary (@ref Start), which will register a predefined prefix
* for possible users of the launch schema. We're not hooking into a
* quick launch, so this first call can't be avoided.
*
* If you ran this example from your "bindir" installation
* directory, no output will emerge from these both attempts -- it
* will find the "magic" file there registered and set the prefixes
* silently. Otherwise, you could get something like:
@verbatim
WARNING: Could not determine its installed prefix for 'ELM'
so am falling back on the compiled in default:
usr
implied by the following:
bindir = usr/lib
libdir = usr/lib
datadir = usr/share/elementary
localedir = usr/share/locale
Try setting the following environment variables:
ELM_PREFIX - points to the base prefix of install
or the next 4 variables
ELM_BIN_DIR - provide a specific binary directory
ELM_LIB_DIR - provide a specific library directory
ELM_DATA_DIR - provide a specific data directory
ELM_LOCALE_DIR - provide a specific locale directory
@endverbatim
* if you also didn't change those environment variables (remember
* they are also a valid way of communicating your prefix to the
* binary) - this is the scenario where it fallbacks to the paths set
* for compile time.
*
* Then, you can check the prefixes set on the standard output:
* @skip prefix was set to
* @until locale directory is
*
* In the fragment
* @skip by using this policy
* @until elm_win_autodel_set
* we demonstrate the use of Elementary policies. The policy defining
* under which circumstances our application should quit automatically
* is set to when its last window is closed (this one has just one
* window, though). This will save us from having to set a callback
* ourselves on the window, like done in @ref bg_example_01_c "this"
* example. Note that we need to tell the window to delete itself's
* object on a request to destroy the canvas coming, with
* elm_win_autodel_set().
*
* What follows is some boilerplate code, creating a frame with a @b
* button, our object of interest, and, below, widgets to change the
* button's behavior and exemplify the group of functions in question.
*
* @dontinclude general_funcs_example.c
* We enabled the focus highlight object for this window, so that you
* can keep track of the current focused object better:
* @skip elm_win_focus_highlight_enabled_set
* @until evas_object_show
* Use the tab key to navigate through the focus chain.
*
* @dontinclude general_funcs_example.c
* While creating the button, we exemplify how to use Elementary's
* finger size information to scale our UI:
* @skip fprintf(stdout, "Elementary
* @until evas_object_show
*
* @dontinclude general_funcs_example.c
* The first checkbox's callback is:
* @skip static void
* @until }
* When unsetting the checkbox, we disable the button, which will get a new
* decoration (greyed out) and stop receiving events. The focus chain
* will also ignore it.
*
* Following, there are 2 more buttons whose actions are focus/unfocus
* the top button, respectively:
* @skip focus callback
* @until }
* and
* @skip unfocus callback
* @until }
* Note the situations in which they won't take effect:
* - the button is not allowed to get focus or
* - the button is disabled
*
* The first restriction above you'll get by a second checkbox, whose
* callback is:
* @skip focus allow callback
* @until }
* Note that the button will still get mouse events, though.
*
* Next, there's a slider controlling the button's scale:
* @skip scaling callback
* @until }
*
* Experiment with it, so you understand the effect better. If you
* change its value, it will mess with the button's original size,
* naturally.
*
* The full code for this example can be found
* @ref general_functions_example_c "here".
*/
/**
* @page theme_example_01 Theme - Using extensions
*
* @dontinclude theme_example_01.c
*
* Using extensions is extremely easy, discarding the part where you have to
* write the theme for them.
*
* In the following example we'll be creating two buttons, one to load or
* unload our extension theme and one to cycle around three possible styles,
* one of which we created.
*
* After including our one and only header we'll jump to the callback for
* the buttons. First one takes care of loading or unloading our extension
* file, relative to the default theme set (thus the @c NULL in the
* functions first parameter).
* @skipline Elementary.h
* @skip static void
* @until }
* @until }
* @until }
*
* The second button, as we said before, will just switch around different
* styles. In this case we have three of them. The first one is our custom
* style, named after something very unlikely to find in the default theme.
* The other two styles are the standard and one more, anchor, which exists
* in the default and is similar to the default, except the button vanishes
* when the mouse is not over it.
* @skip static void
* @until }
* @until }
*
* So what happens if the style switches to our custom one when the
* extension is loaded? Elementary falls back to the default for the
* widget.
*
* And the main function, simply enough, will create the window, set the
* buttons and their callbacks, and just to begin with our button styled
* we're also loading our extension at the beginning.
* @skip int
* @until ELM_MAIN
*
* In this case we wanted to easily remove extensions, but all adding an
* extension does is tell Elementary where else it should look for themes
* when it can't find them in the default theme. Another way to do this
* is to set the theme search order using elm_theme_set(), but this requires
* that the developer is careful not to override any user configuration.
* That can be helped by adding our theme to the end of whatever is already
* set, like in the following snippet.
* @code
* char buf[4096];
* snprintf(buf, sizeof(buf), "%s:./theme_example.edj", elme_theme_get(NULL);
* elm_theme_set(NULL, buf);
* @endcode
*
* If we were using overlays instead of extensions, the same thing applies,
* but the custom theme must be added to the front of the search path.
*
* In the end, we should be looking at something like this:
*
* @image html screenshots/theme_example_01.png
* @image latex screenshots/theme_example_01.eps width=\textwidth
*
* That's all. Boringly simple, and the full code in one piece can be found
* @ref theme_example_01.c "here".
*
* And the code for our extension is @ref theme_example.edc "here".
*
* @example theme_example_01.c
* @example theme_example.edc
*/
/**
* @page theme_example_02 Theme - Using overlays
*
* @dontinclude theme_example_02.c
*
* Overlays are like extensions in that you tell Elementary that some other
* theme contains the styles you need for your program. The difference is that
* they will be look in first, so they can override the default style of any
* widget.
*
* There's not much to say about them that hasn't been said in our previous
* example about @ref theme_example_01 "extensions", so going quickly through
* the code we have a function to load or unload the theme, which will be
* called when we click any button.
* @skipline Elementary.h
* @skip static void
* @until }
*
* And the main function, creating the window and adding some buttons to it.
* We load our theme as an overlay and nothing else. Notice there's no style
* set for any button there, which means they should be using the default
* that we override.
* @skip int
* @until ELM_MAIN
*
* That's pretty much it. The full code is @ref theme_example_02.c "here" and
* the definition of the theme is the same as before, and can be found in
* @ref theme_example.edc "here".
*
* @example theme_example_02.c
*/
/**
* @page button_example_00 Button - Hello, Button!
*
* @dontinclude button_example_00.c
*
* Keeping the tradition, this is a simple "Hello, World" button example. We
* will show how to create a button and associate and action to be performed
* when you click on it.
*
* In the end, we'll be presented with something that looks like this:
*
* @image html screenshots/button_00.png
* @image latex screenshots/button_00.eps width=\textwidth
*
* The full code of the example is @ref button_example_00.c "here" and we
* will follow here with a rundown of it.
*
*
* There is only one button on the interface which performs a basic action:
* close the application. This behavior is described by on_click() function,
* that interrupt the program invoking elm_exit().
* @skip static void
* @until }
*
*
* On the main() function, we set the basic characteristics of the user
* interface. First we use the Elementary library to create a window and
* set its policies (such as close when the user click on the window close
* icon).
*
* @skip elm_win_add
* @until elm_policy_set
*
* In order to turn it visible on the WM (Window Manager), we also have to
* associate it to a canvas through Evas library, and set its dimensions.
*
* @skip evas_object_resize
* @until evas_object_show(win)
*
* Then we create a background associated to the window, define its dimensions,
* and turn it visible on the canvas.
* @skip elm_bg_add
* @until evas_object_show(bg)
*
*
* Finally we use Elementary to create a button and Evas to set its
* proprieties. Here we have not only to give the button dimensions, but also
* its coordinates and the action to be performed on the click event.
* @skip elm_button_add
* @until evas_object_show(btn)
*
*
* And we are done.
*
* @example button_example_00.c
*/
/**
* @page button_example_01 Button - Complete example
*
* @dontinclude button_example_01.c
*
* A button is simple, you click on it and something happens. That said,
* we'll go through an example to show in detail the button API less
* commonly used.
*
* In the end, we'll be presented with something that looks like this:
*
* @image html screenshots/button_01.png
* @image latex screenshots/button_01.eps width=\textwidth
*
* The full code of the example is @ref button_example_01.c "here" and we
* will follow here with a rundown of it.
*
* @skip Elementary.h
* @until Elementary.h
* @skip struct
* @until App_Data
*
* We have several buttons to set different times for the autorepeat timeouts
* of the buttons that use it and a few more that we keep track of in our
* data struct. The mid button doesn't do much, just moves around according
* to what other buttons the user presses. Then four more buttons to move the
* central one, and we're also keeping track of the icon set in the middle
* button, since when this one moves, we change the icon, and when movement
* is finished (by releasing one of the four arrow buttons), we set back the
* normal icon.
* @skip static void
* @until }
*
* Keeping any of those four buttons pressed will trigger their autorepeat
* callback, where we move the button doing some size hint magic. To
* understand how that works better, refer to the @ref Elm_Box documentation.
* Also, the first time the function is called, we change the icon in the
* middle button, using elm_object_content_unset() first to keep the reference
* to the previous one, so we don't need to recreate it when we are done
* moving it.
* @skip static void
* @until }
* @until size_hint_align_set
* @until }
*
* One more callback for the option buttons, that just sets the timeouts for
* the different autorepeat options.
*
* @skip static void
* @until }
* @until }
* @until }
*
* And the main function, which does some setting up of the buttons in boxes
* to make things work. Here we'll go through some snippets only.
*
* For the option buttons, it's just the button with its label and callback.
* @skip elm_button_add
* @until smart_callback_add
*
* For the ones that move the central button, we have no labels. There are
* icons instead, and the autorepeat option is toggled.
* @skip Gap: 1.0
* @skip elm_button_add
* @until data.cursors.up
*
* And just to show the mid button, which doesn't have anything special.
* @skip data.cursors.left
* @skip elm_button_add
* @until data.mid
*
* And we are done.
*
* @example button_example_01.c
*/
/**
* @page bubble_01_example_page elm_bubble - Simple use.
* @dontinclude bubble_example_01.c
*
* This example shows a bubble with all fields set(label, info, content and
* icon) and the selected corner changing when the bubble is clicked. To be
* able use a bubble we need to do some setup and create a window, for this
* example we are going to ignore that part of the code since it isn't
* relevant to the bubble.
*
* To have the selected corner change in a clockwise motion we are going to
* use the following callback:
* @skip static
* @until }
* @until }
*
* Here we are creating an elm_label that is going to be used as the content
* for our bubble:
* @skipline elm_label
* @until show
* @note You could use any evas_object for this, we are using an elm_label
* for simplicity.
*
* Despite it's name the bubble's icon doesn't have to be an icon, it can be
* any evas_object. For this example we are going to make the icon a simple
* blue rectangle:
* @until show
*
* And finally we have the actual bubble creation and the setting of it's
* label, info and content:
* @until content
* @skipline show
* @note Because we didn't set a corner, the default("top_left") will be
* used.
*
* Now that we have our bubble all that is left is connecting the "clicked"
* signals to our callback:
* @line smart_callback
*
* This last bubble we created was very complete, so it's pertinent to show
* that most of that stuff is optional a bubble can be created with nothing
* but content:
* @until content
* @skipline show
*
* Our example will look like this:
*
* @image html screenshots/bubble_example_01.png
* @image latex screenshots/bubble_example_01.eps width=\textwidth
*
* See the full source code @ref bubble_example_01.c here.
* @example bubble_example_01.c
*/
/**
* @page box_example_01 Box - Basic API
*
* @dontinclude button_example_01.c
*
* As a special guest tonight, we have the @ref button_example_01 "simple
* button example". There are plenty of boxes in it, and to make the cursor
* buttons that moved a central one around when pressed, we had to use a
* variety of values for their hints.
*
* To start, let's take a look at the handling of the central button when
* we were moving it around. To achieve this effect without falling back to
* a complete manual positioning of the @c Evas_Object in our canvas, we just
* put it in a box and played with its alignment within it, as seen in the
* following snippet of the callback for the pressed buttons.
* @skip evas_object_size_hint_align_get
* @until evas_object_size_hint_align_set
*
* Not much to it. We get the current alignment of the object and change it
* by just a little, depending on which button was pressed, then set it
* again, making sure we stay within the 0.0-1.0 range so the button moves
* inside the space it has, instead of disappearing under the other objects.
*
* But as useful as an example as that may have been, the usual case with boxes
* is to set everything at the moment they are created, like we did for
* everything else in our main function.
*
* The entire layout of our program is made with boxes. We have one set as the
* resize object for the window, which means it will always be resized with
* the window. The weight hints set to @c EVAS_HINT_EXPAND will tell the
* window that the box can grow past it's minimum size, which allows resizing
* of it.
* @skip elm_main
* @skip elm_box_add
* @until evas_object_show
*
* Two more boxes, set to horizontal, hold the buttons to change the autorepeat
* configuration used by the buttons. We create each to take over all the
* available space horizontally, but we don't want them to grow vertically,
* so we keep that axis of the weight with 0.0. Then it gets packed in the
* main box.
* @skip box2
* @until evas_object_show
*
* The buttons in each of those boxes have nothing special, they are just packed
* in with their default values and the box will use their minimum size, as set
* by Elementary itself based on the label, icon, finger size and theme.
*
* But the buttons used to move the central one have a special disposition.
* The top one first, is placed right into the main box like our other smaller
* boxes. Set to expand horizontally and not vertically, and in this case we
* also tell it to fill that space, so it gets resized to take the entire
* width of the window.
* @skip Gap: 1.0
* @skip elm_button_add
* @until evas_object_show
*
* The bottom one will be the same, but for the other two we need to use a
* second box set to take as much space as we have, so we can place our side
* buttons in place and have the big empty space where the central button will
* move.
* @skip elm_box_add
* @until evas_object_show
*
* Then the buttons will have their hints inverted to the other top and bottom
* ones, to expand and fill vertically and keep their minimum size horizontally.
* @skip elm_button_add
* @until evas_object_show
*
* The central button takes every thing else. It will ask to be expanded in
* both directions, but without filling its cell. Changing its alignment by
* pressing the buttons will make it move around.
* @skip elm_button_add
* @until evas_object_show
*
* To end, the rightmost button is packed in the smaller box after the central
* one, and back to the main box we have the bottom button at the end.
*/
/**
* @page box_example_02 Box - Layout transitions
*
* @dontinclude box_example_02.c
*
* Setting a customized layout for a box is simple once you have the layout