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.
6811 lines
240 KiB
6811 lines
240 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 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 |
|
* 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 an intrincasy: 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 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 |
|
* function, which is just like the layout function for @c Evas_Box. The new |
|
* and fancier thing we can do with Elementary is animate the transition from |
|
* one layout to the next. We'll see now how to do that through a simple |
|
* example, while also taking a look at some of the API that was left |
|
* untouched in our @ref box_example_01 "previous example". |
|
* |
|
* @image html screenshots/box_example_02.png |
|
* @image latex screenshots/box_example_02.eps width=\textwidth |
|
* |
|
* @skipline Elementary.h |
|
* |
|
* Our application data consists of a list of layout functions, given by |
|
* @c transitions. We'll be animating through them throughout the entire run. |
|
* The box with the stuff to move around and the last layout that was set to |
|
* make things easier in the code. |
|
* @skip typedef |
|
* @until Transitions_Data |
|
* |
|
* The box starts with three buttons, clicking on any of them will take it |
|
* out of the box without deleting the object. There are also two more buttons |
|
* outside, one to add an object to the box and the other to clear it. |
|
* This is all to show how you can interact with the items in the box, add |
|
* things and even remove them, while the transitions occur. |
|
* |
|
* One of the callback we'll be using creates a new button, asks the box for |
|
* the list of its children and if it's not empty, we add the new object after |
|
* the first one, otherwise just place at the end as it will not make any |
|
* difference. |
|
* @skip static void |
|
* @until } |
|
* @until } |
|
* |
|
* The clear button is even simpler. Everything in the box will be deleted, |
|
* leaving it empty and ready to fill it up with more stuff. |
|
* @skip static void |
|
* @until } |
|
* |
|
* And a little function to remove buttons from the box without deleting them. |
|
* This one is set for the @c clicked callback of the original buttons, |
|
* unpacking them when clicked and placing it somewhere in the screen where |
|
* they will not disturb. Once we do this, the box no longer has any control |
|
* of it, so it will be left untouched until the program ends. |
|
* @skip static void |
|
* @until } |
|
* |
|
* If we wanted, we could just call @c evas_object_del() on the object to |
|
* destroy it. In this case, no unpack is really necessary, as the box would |
|
* be notified of a child being deleted and adjust its calculations accordingly. |
|
* |
|
* The core of the program is the following function. It takes whatever |
|
* function is first on our list of layouts and together with the |
|
* @c last_layout, it creates an ::Elm_Box_Transition to use with |
|
* elm_box_layout_transition(). In here, we tell it to start from whatever |
|
* layout we last set, end with the one that was at the top of the list and |
|
* when everything is finished, call us back so we can create another |
|
* transition. Finally, move the new layout to the end of the list so we |
|
* can continue running through them until the program ends. |
|
* @skip static void |
|
* @until } |
|
* |
|
* The main function doesn't have anything special. Creation of box, initial |
|
* buttons and some callback setting. The only part worth mentioning is the |
|
* initialization of our application data. |
|
* @skip tdata.box |
|
* @until evas_object_box_layout_stack |
|
* |
|
* We have a simple static variable, set the box, the first layout we are |
|
* using as last and create the list with the different functions to go |
|
* through. |
|
* |
|
* And in the end, we set the first layout and call the same function we went |
|
* through before to start the run of transitions. |
|
* @until _test_box_transition_change |
|
* |
|
* For the full code, follow @ref box_example_02.c "here". |
|
* |
|
* @example box_example_02.c |
|
*/ |
|
|
|
/** |
|
* @page calendar_example_01 Calendar - Simple creation. |
|
* @dontinclude calendar_example_01.c |
|
* |
|
* As a first example, let's just display a calendar in our window, |
|
* explaining all steps required to do so. |
|
* |
|
* First you should declare objects we intend to use: |
|
* @skipline Evas_Object |
|
* |
|
* Then a window is created, a title is set and its set to be autodeleted. |
|
* More details can be found on windows examples: |
|
* @until elm_win_autodel |
|
* |
|
* Next a simple background is placed on our windows. More details on |
|
* @ref bg_01_example_page : |
|
* @until evas_object_show(bg) |
|
* |
|
* Now, the exciting part, let's add the calendar with elm_calendar_add(), |
|
* passing our window object as parent. |
|
* @until evas_object_show(cal); |
|
* |
|
* To conclude our example, we should show the window and run elm mainloop: |
|
* @until ELM_MAIN |
|
* |
|
* Our example will look like this: |
|
* |
|
* @image html screenshots/calendar_example_01.png |
|
* @image latex screenshots/calendar_example_01.eps width=\textwidth |
|
* |
|
* See the full source code @ref calendar_example_01.c here. |
|
* @example calendar_example_01.c |
|
*/ |
|
|
|
/** |
|
* @page calendar_example_02 Calendar - Layout strings formatting. |
|
* @dontinclude calendar_example_02.c |
|
* |
|
* In this simple example, we'll explain how to format the label displaying |
|
* month and year, and also set weekday names. |
|
* |
|
* To format month and year label, we need to create a callback function |
|
* to create a string given the selected time, declared under a |
|
* <tt> struct tm </tt>. |
|
* |
|
* <tt> struct tm </tt>, declared on @c time.h, is a structure composed by |
|
* nine integers: |
|
* @li tm_sec seconds [0,59] |
|
* @li tm_min minutes [0,59] |
|
* @li tm_hour hour [0,23] |
|
* @li tm_mday day of month [1,31] |
|
* @li tm_mon month of year [0,11] |
|
* @li tm_year years since 1900 |
|
* @li tm_wday day of week [0,6] (Sunday = 0) |
|
* @li tm_yday day of year [0,365] |
|
* @li tm_isdst daylight savings flag |
|
* @note glib version has 2 additional fields. |
|
* |
|
* For our function, only stuff that matters are tm_mon and tm_year. |
|
* But we don't need to access it directly, since there are nice functions |
|
* to format date and time, as @c strftime. |
|
* We will get abbreviated month (%b) and year (%y) (check strftime manpage |
|
* for more) in our example: |
|
* @skipline static char |
|
* @until } |
|
* |
|
* We need to alloc the string to be returned, and calendar widget will |
|
* free it when it's not needed, what is done by @c strdup. |
|
* So let's register our callback to calendar object: |
|
* @skipline elm_calendar_format_function_set |
|
* |
|
* To set weekday names, we should declare them as an array of strings: |
|
* @dontinclude calendar_example_02.c |
|
* @skipline weekdays[] |
|
* @until } |
|
* |
|
* And finally set them to calendar: |
|
* @skipline weekdays_names_set |
|
* |
|
* Our example will look like this: |
|
* |
|
* @image html screenshots/calendar_example_02.png |
|
* @image latex screenshots/calendar_example_02.eps width=\textwidth |
|
* |
|
* See the full source code @ref calendar_example_02.c here. |
|
* @example calendar_example_02.c |
|
*/ |
|
|
|
/** |
|
* @page calendar_example_03 Calendar - Years restrictions. |
|
* @dontinclude calendar_example_03.c |
|
* |
|
* This example explains how to set max and min year to be displayed |
|
* by a calendar object. This means that user won't be able to |
|
* see or select a date before and after selected years. |
|
* By default, limits are 1902 and maximum value will depends |
|
* on platform architecture (year 2037 for 32 bits); You can |
|
* read more about time functions on @c ctime manpage. |
|
* |
|
* Straigh to the point, to set it is enough to call |
|
* elm_calendar_min_max_year_set(). First value is minimum year, second |
|
* is maximum. If first value is negative, it won't apply limit for min |
|
* year, if the second one is negative, won't apply for max year. |
|
* Setting both to negative value will clear limits (default state): |
|
* @skipline elm_calendar_min_max_year_set |
|
* |
|
* Our example will look like this: |
|
* |
|
* @image html screenshots/calendar_example_03.png |
|
* @image latex screenshots/calendar_example_03.eps width=\textwidth |
|
* |
|
* See the full source code @ref calendar_example_03.c here. |
|
* @example calendar_example_03.c |
|
*/ |
|
|
|
/** |
|
* @page calendar_example_04 Calendar - Days selection. |
|
* @dontinclude calendar_example_04.c |
|
* |
|
* It's possible to disable date selection and to select a date |
|
* from your program, and that's what we'll see on this example. |
|
* |
|
* If isn't required that users could select a day on calendar, |
|
* only interacting going through months, disabling days selection |
|
* could be a good idea to avoid confusion. For that: |
|
* @skipline elm_calendar_select_mode_set |
|
* |
|
* Also, regarding days selection, you could be interested to set a |
|
* date to be highlighted on calendar from your code, maybe when |
|
* a specific event happens, or after calendar creation. As @c time output is |
|
* in seconds, we define the number of seconds contained within a day as a |
|
* constant: |
|
* @dontinclude calendar_example_04.c |
|
* @skipline SECS_DAY |
|
* |
|
* Now let's select two days from current day: |
|
* @skipline time(NULL) |
|
* @until elm_calendar_selected_time_set |
|
* |
|
* Our example will look like this: |
|
* |
|
* @image html screenshots/calendar_example_04.png |
|
* @image latex screenshots/calendar_example_04.eps width=\textwidth |
|
* |
|
* See the full source code @ref calendar_example_04.c here. |
|
* @example calendar_example_04.c |
|
*/ |
|
|
|
/** |
|
* @page calendar_example_05 Calendar - Signal callback and getters. |
|
* @dontinclude calendar_example_05.c |
|
* |
|
* Most of setters explained on previous examples have associated getters. |
|
* That's the subject of this example. We'll add a callback to display |
|
* all calendar information every time user interacts with the calendar. |
|
* |
|
* Let's check our callback function: |
|
* @skipline static void |
|
* @until double interval; |
|
* |
|
* To get selected day, we need to call elm_calendar_selected_time_get(), |
|
* but to assure nothing wrong happened, we must check for function return. |
|
* It'll return @c EINA_FALSE if fail. Otherwise we can use time set to |
|
* our structure @p stime. |
|
* @skipline elm_calendar_selected_time_get |
|
* @until return |
|
* |
|
* Next we'll get information from calendar and place on declared vars: |
|
* @skipline interval |
|
* @until elm_calendar_weekdays_names_get |
|
* |
|
* The only tricky part is that last line gets an array of strings |
|
* (char arrays), one for each weekday. |
|
* |
|
* Then we can simple print that to stdin: |
|
* @skipline printf |
|
* @until } |
|
* |
|
* <tt> struct tm </tt> is declared on @c time.h. You can check @c ctime |
|
* manpage to read about it. |
|
* |
|
* To register this callback, that will be called every time user selects |
|
* a day or goes to next or previous month, just add a callback for signal |
|
* @b changed. |
|
* @skipline evas_object_smart_callback_add |
|
* |
|
* Our example will look like this: |
|
* |
|
* @image html screenshots/calendar_example_05.png |
|
* @image latex screenshots/calendar_example_05.eps width=\textwidth |
|
* |
|
* See the full source code @ref calendar_example_05.c here. |
|
* @example calendar_example_05.c |
|
*/ |
|
|
|
/** |
|
* @page calendar_example_06 Calendar - Calendar marks. |
|
* @dontinclude calendar_example_06.c |
|
* |
|
* On this example marks management will be explained. Functions |
|
* elm_calendar_mark_add(), elm_calendar_mark_del() and |
|
* elm_calendar_marks_clear() will be covered. |
|
* |
|
* To add a mark, will be required to choose three things: |
|
* @li mark style |
|
* @li mark date, or start date if it will be repeated |
|
* @li mark periodicity |
|
* |
|
* Style defines the kind of mark will be displayed over marked day, |
|
* on calendar. Default theme supports @b holiday and @b checked. |
|
* If more is required, is possible to set a new theme to calendar |
|
* widget using elm_object_style_set(), and use |
|
* the signal that will be used by such marks. |
|
* |
|
* Date is a <tt> struct tm </tt>, as defined by @c time.h. More can |
|
* be read on @c ctime manpage. |
|
* If a date relative from current is required, this struct can be set |
|
* as: |
|
* @skipline time(NULL) |
|
* @until localtime_r |
|
* |
|
* Or if it's an absolute date, you can just declare the struct like: |
|
* @dontinclude calendar_example_06.c |
|
* @skipline sunday |
|
* @until christmas.tm_mon |
|
* |
|
* Periodicity is how frequently the mark will be displayed over the |
|
* calendar. Can be a unique mark (that don't repeat), or it can repeat |
|
* daily, weekly, monthly or annually. It's enumerated by |
|
* @c Elm_Calendar_Mark_Repeat_Type. |
|
* |
|
* So let's add some marks to our calendar. We will add christmas holiday, |
|
* set Sundays as holidays, and check current day and day after that. |
|
* @dontinclude calendar_example_06.c |
|
* @skipline sunday |
|
* @until christmas.tm_mon |
|
* @skipline current_time |
|
* @until ELM_CALENDAR_WEEKLY |
|
* |
|
* We kept the return of first mark add, because we don't really won't it |
|
* to be checked, so let's remove it: |
|
* @skipline elm_calendar_mark_del |
|
* |
|
* After all marks are added and removed, is required to draw them: |
|
* @skipline elm_calendar_marks_draw |
|
* |
|
* Finally, to clear all marks, let's set a callback for our button: |
|
* @skipline elm_button_add |
|
* @until evas_object_show(bt); |
|
* |
|
* This callback will receive our calendar object, and should clear it: |
|
* @dontinclude calendar_example_06.c |
|
* @skipline static |
|
* @until } |
|
* @note Remember to draw marks after clear the calendar. |
|
* |
|
* Our example will look like this: |
|
* |
|
* @image html screenshots/calendar_example_06.png |
|
* @image latex screenshots/calendar_example_06.eps width=\textwidth |
|
* |
|
* See the full source code @ref calendar_example_06.c here. |
|
* @example calendar_example_06.c |
|
*/ |
|
|
|
/** |
|
* @page spinner_example Spinner widget example |
|
* |
|
* This code places seven Elementary spinner widgets on a window, each of |
|
* them exemplifying a part of the widget's API. |
|
* |
|
* The first of them is the default spinner: |
|
* @dontinclude spinner_example.c |
|
* @skipline elm_spinner_add |
|
* @until evas_object_show |
|
* As you see, the defaults for a spinner are: |
|
* @li no wrap |
|
* @li min value set to 0 |
|
* @li max value set to 100 |
|
* @li step value set to 1 |
|
* @li label format set to "%0.f" |
|
* |
|
* If another format is required, see the second spinner. It will put a text |
|
* before and after the value, and also format value to display two decimals: |
|
* @skipline format_set |
|
* |
|
* The third one will use a customized step, define new minimum and maximum |
|
* values and enable wrap, so when value reaches minimum it jumps to maximum, |
|
* or jumps to minimum after maximum value is reached. Format is set to display |
|
* a decimal: |
|
* @skipline elm_spinner_add |
|
* @until evas_object_show |
|
* |
|
* The fourth uses @c vertical style, so instead of left and right arrows, |
|
* top and bottom are displayed. Also the change interval is reduced, so |
|
* user can change value faster. |
|
* @skipline style |
|
* @skipline interval |
|
* |
|
* In the fifth the user won't be allowed to set value directly, i.e., will |
|
* be obligate change value only using arrows: |
|
* @skipline editable |
|
* |
|
* The sixth widget will receive a lot of special values, so |
|
* instead of reading numeric values, user will see labels for each one. |
|
* Also direct edition is disabled, otherwise users would see the numeric |
|
* value on edition mode. User will be able to select a month in this widget: |
|
* @skipline elm_spinner_add |
|
* @until evas_object_show |
|
* |
|
* Finally the last widget will exemplify how to listen to widget's signals, |
|
* <tt> changed </tt> and <tt> delay,changed </tt>. First we need to |
|
* implement callback functions that will simply print spinner's value: |
|
* @dontinclude spinner_example.c |
|
* @skip static |
|
* @skip } |
|
* @skipline static |
|
* @until } |
|
* @until } |
|
* |
|
* The first callback function should be called everytime value changes, |
|
* the second one only after user stops to increment or decrement. Try |
|
* to keep arrows pressed and check the difference. |
|
* @skip smart_callback |
|
* @skipline smart_callback |
|
* @skipline smart_callback |
|
* |
|
* See the full @ref spinner_example.c "example", whose window should |
|
* look like this picture: |
|
* |
|
* @image html screenshots/spinner_example.png |
|
* @image latex screenshots/spinner_example.eps width=\textwidth |
|
* |
|
* See the full @ref spinner_example.c "source code" for this example. |
|
* |
|
* @example spinner_example.c |
|
*/ |
|
|
|
/** |
|
* @page slider_example Slider widget example |
|
* |
|
* This code places seven Elementary slider widgets on a window, each of |
|
* them exemplifying a part of the widget's API. |
|
* |
|
* The first of them is the default slider: |
|
* @dontinclude slider_example.c |
|
* @skipline elm_slider_add |
|
* @until evas_object_show |
|
* |
|
* As you see, the defaults for a slider are: |
|
* @li horizontal |
|
* @li no label |
|
* @li no values (on indicator or unit labels) |
|
* |
|
* Actually it's pretty useless this way. So let's learn how to improve it. |
|
* |
|
* If some decoration is required, a label can be set, and icon before and |
|
* after the bar as well. On the second slider will add a @c home icon |
|
* and a @c folder icon at @c end. |
|
* @skip elm_object_text_set |
|
* @until elm_object_part_content_set(sl, "end", ic) |
|
* |
|
* If the bar size need to be changed, it can be done with span set function, |
|
* that doesn't accounts other widget's parts size. Also the bar can starts |
|
* with a not default value (0.0), as we done on third slider: |
|
* @skipline value_set |
|
* @skipline span_size_set |
|
* |
|
* So far, users won't be able to see the slider value. If it's required, |
|
* it can be displayed in two different areas, units label or above |
|
* the indicator. |
|
* |
|
* Let's place a units label on our widget, and also let's set minimum and |
|
* maximum value (uses 0.0 and 1.0 by default): |
|
* @skipline unit_format_set |
|
* @skipline min_max_set |
|
* |
|
* If above the indicator is the place to display the value, just set it. |
|
* Also, is possible to invert a bar, as you can see: |
|
* @skipline indicator_format_set |
|
* @skipline inverted_set |
|
* |
|
* But if you require to use a function a bit more customized to show the value, |
|
* is possible to registry a callback function that will be called |
|
* to display unit or indicator label. Only the value will be passed to this |
|
* function, that should return a string. |
|
* In this case, a function to free this string will be required. |
|
* |
|
* Let's exemplify with indicator label on our sixth slider: |
|
* @dontinclude slider_example.c |
|
* @skip static |
|
* @skip } |
|
* @skip static |
|
* @skip } |
|
* @skip static |
|
* @skip } |
|
* @skipline static |
|
* @until } |
|
* @until } |
|
* |
|
* Setting callback functions: |
|
* @skipline indicator_format_function_set |
|
* @skipline _indicator_free |
|
* |
|
* Also, a slider can be displayed vertically: |
|
* @dontinclude slider_example.c |
|
* @skipline elm_slider_horizontal_set |
|
* |
|
* Finally the last widget will exemplify how to listen to widget's signals, |
|
* <tt> changed </tt> and <tt> delay,changed </tt>. First we need to |
|
* implement callback functions that will simply print slider's value: |
|
* @dontinclude slider_example.c |
|
* @skip static |
|
* @skip } |
|
* @skipline static |
|
* @until } |
|
* @until } |
|
* |
|
* The first callback function should be called everytime value changes, |
|
* the second one only after user stops to increment or decrement. Try |
|
* to keep arrows pressed and check the difference. |
|
* @skip smart_callback |
|
* @skipline smart_callback |
|
* @skipline smart_callback |
|
* |
|
* See the full @ref slider_example.c "example", whose window should |
|
* look like this picture: |
|
* |
|
* @image html screenshots/slider_example.png |
|
* @image latex screenshots/slider_example.eps width=\textwidth |
|
* |
|
* See the full @ref slider_example.c "source code" for this example. |
|
* |
|
* @example slider_example.c |
|
*/ |
|
|
|
/** |
|
* @page panes_example Panes widget example |
|
* |
|
* This code places two Elementary panes widgets on a window, one of them |
|
* displayed vertically and the other horizontally, to exemplify |
|
* a part of the widget's API. Also, all the signals emitted by this |
|
* widget will be covered. |
|
* |
|
* Let's start adding a panes to our window: |
|
* @dontinclude panes_example.c |
|
* @skipline elm_panes_add |
|
* @until evas_object_show |
|
* |
|
* Now we will set a content (a simple button) to the left side of our |
|
* panes widget: |
|
* @skipline elm_button_add |
|
* @until content_left_set |
|
* |
|
* The content of the right side will be something a bit more elaborated, we'll |
|
* place another panes, displayed vertically (it's displayed horizontally |
|
* by default): |
|
* @skipline elm_panes_add |
|
* @until content_right_set |
|
* |
|
* When populating a panes displayed vertically, remember that left content |
|
* will be placed at top, and right content will place at bottom. Next |
|
* we will add two buttons to exemplify that: |
|
* @skipline elm_button_add |
|
* @until content_right_set |
|
* |
|
* Panes widgets emits 4 different signals, depending on users interaction |
|
* with the draggable bar. We'll add a callback function for each of them. |
|
* |
|
* <tt> "clicked" signal </tt>: |
|
* |
|
* Callback function that just print "Clicked" to stdin: |
|
* @dontinclude panes_example.c |
|
* @skip static void |
|
* @skip } |
|
* @skip static void |
|
* @skip } |
|
* @skip static void |
|
* @skip } |
|
* @skipline static void |
|
* @until } |
|
* |
|
* Also, add callback function to the panes: |
|
* @skipline "clicked" |
|
* |
|
* <tt> "press" signal </tt>: |
|
* |
|
* Callback function that just print "Pressed" to stdin: |
|
* @dontinclude panes_example.c |
|
* @skip static void |
|
* @skip } |
|
* @skipline static void |
|
* @until } |
|
* |
|
* Also, add callback function to the panes: |
|
* @skipline "press" |
|
* |
|
* Now, let's try to make our callback functions a bit more useful: |
|
* |
|
* <tt> "unpress" signal </tt>: |
|
* |
|
* Suppose we want to know the size proportion of left content after |
|
* user drags the bar. We need to listen for @c unpress signal, and |
|
* get this size from our panes widget. It's done on the following |
|
* function: |
|
* @dontinclude panes_example.c |
|
* @skip static void |
|
* @skip } |
|
* @skip static void |
|
* @skip } |
|
* @skipline static void |
|
* @until } |
|
* |
|
* Adding the callback function to the panes: |
|
* @skipline "unpress" |
|
|
|
* <tt> "clicked,double" signal </tt>: |
|
* |
|
* Now, a interesting feature that could be addded to panes widget. |
|
* Hide a content when user double click the draggable bar. It's done |
|
* using a variable to store size and content left size getter and setter |
|
* on the following function: |
|
* @dontinclude panes_example.c |
|
* @skipline static double |
|
* @skip static void |
|
* @skip } |
|
* @skip static void |
|
* @skip } |
|
* @skip static void |
|
* @skip } |
|
* @skipline static void |
|
* @until } |
|
* @until } |
|
* @until } |
|
* |
|
* Adding the callback function to the panes: |
|
* @skipline "clicked,double" |
|
* @until panes); |
|
* |
|
* See the full @ref panes_example.c "example", whose window should |
|
* look like this picture: |
|
* |
|
* @image html screenshots/panes_example.png |
|
* @image latex screenshots/panes_example.eps width=\textwidth |
|
* |
|
* @example panes_example.c |
|
*/ |
|
|
|
/** |
|
* @page clock_example Clock widget example |
|
* |
|
* This code places five Elementary clock widgets on a window, each of |
|
* them exemplifying a part of the widget's API. |
|
* |
|
* The first of them is the pristine clock: |
|
* @dontinclude clock_example.c |
|
* @skip pristine |
|
* @until evas_object_show |
|
* As you see, the defaults for a clock are: |
|
* - military time |
|
* - no seconds shown |
|
* |
|
* For am/pm time, see the second clock: |
|
* @dontinclude clock_example.c |
|
* @skip am/pm |
|
* @until evas_object_show |
|
* |
|
* The third one will show the seconds digits, which will flip in |
|
* synchrony with system time. Note, besides, that the time itself is |
|
* @b different from the system's -- it was customly set with |
|
* elm_clock_time_set(): |
|
* @dontinclude clock_example.c |
|
* @skip with seconds |
|
* @until evas_object_show |
|
* |
|
* In both fourth and fifth ones, we turn on the <b>edition |
|
* mode</b>. See how you can change each of the sheets on it, and be |
|
* sure to try holding the mouse pressed over one of the sheet |
|
* arrows. The forth one also starts with a custom time set: |
|
* @dontinclude clock_example.c |
|
* @skip in edition |
|
* @until evas_object_show |
|
* |
|
* The fifth, besides editable, has only the time @b units editable, |
|
* for hours, minutes and seconds. This exemplifies |
|
* elm_clock_edit_mode_set(): |
|
* @dontinclude clock_example.c |
|
* @skip but only |
|
* @until evas_object_show |
|
* |
|
* See the full @ref clock_example.c "example", whose window should |
|
* look like this picture: |
|
* |
|
* @image html screenshots/clock_example.png |
|
* @image latex screenshots/clock_example.eps width=\textwidth |
|
* |
|
* See the full @ref clock_example_c "source code" for this example. |
|
* |
|
*/ |
|
|
|
/** |
|
* @page datetime_example Datetime widget example |
|
* |
|
* This code places three Elementary Datetime widgets on a window, each of |
|
* them exemplifying the widget's different usage. |
|
* |
|
* The first of them is <b>"only Date display"</b>: |
|
* @dontinclude datetime_example.c |
|
* @skip only DATE |
|
* @until evas_object_show |
|
* |
|
* For <b>"only Time display"</b>, see the second datetime: |
|
* @dontinclude datetime_example.c |
|
* @skip only TIME |
|
* @until evas_object_show |
|
* |
|
* The third one will display datetime shows both <b>Date and Time</b>, corresponding format will be |
|
* taken from system @b locale. Note, besides, that the strings are different |
|
* for different language settings. |
|
* |
|
* <b>Datetime format</b> can be programmatically set by using |
|
* elm_datetime_format_set(): |
|
* @dontinclude datetime_example.c |
|
* @skip DATE and TIME |
|
* @until evas_object_show |
|
* The default format of any locale consists: |
|
* - Year Field |
|
* - Month Field |
|
* - Date Field |
|
* - Hour Field(12hr/24hr format) |
|
* - Minute Field |
|
* - AM/PM (if exists). |
|
* |
|
* This is how the example program's window looks like with the datetime widget |
|
* showing only date, only time and both date & time: |
|
* |
|
* @image html screenshots/datetime_example.png |
|
* @image latex screenshots/datetime_example.eps width=\textwidth |
|
* |
|
* See the full @ref datetime_example_c "source code" for |
|
* this example. |
|
* |
|
*/ |
|
|
|
/** |
|
* @page dayselector_example Dayselector widget example |
|
* |
|
* This code places two Elementary dayselector widgets on a window, each of |
|
* them exemplifying the different widget styles. |
|
* |
|
* The first of them is the dayselector in default style: |
|
* @dontinclude dayselector_example.c |
|
* @skip weekdays starting from Sunday |
|
* @until evas_object_show |
|
* |
|
* As you see, the default style displays the weekdays starting from Sunday. |
|
* |
|
* One can select/unselect a day just by clicking on the day object. |
|
* The selection toggles once it is being pressed. |
|
* |
|
* |
|
* For showing weekdays starting from Monday, see the second dayselector: |
|
* @dontinclude dayselector_example.c |
|
* @skip weekdays starting from Monday |
|
* @until evas_object_show |
|
* |
|
* |
|
* The following code exemplifies the selection APIs of Dayselector: |
|
* @dontinclude dayselector_example.c |
|
* @skip Callback function |
|
* @until End of clicked callback |
|
* |
|
* |
|
* See the full @ref dayselector_example.c "example", whose window should |
|
* look like this picture: |
|
* |
|
* @image html screenshots/dayselector_example.png |
|
* @image latex screenshots/dayselector_example.eps width=\textwidth |
|
* |
|
* See the full @ref dayselector_example_c "source code" for this example. |
|
* |
|
*/ |
|
|
|
/** |
|
* @page mapbuf_example Mapbuf Widget Example |
|
* |
|
* This code places an Elementary mapbuf widget on a window, |
|
* to exemplify part of the widget's API. |
|
* |
|
* First we'll add an window with a background and a vertical box to |
|
* pack our interface elements: |
|
* @dontinclude mapbuf_example.c |
|
* @skipline win_add |
|
* @until show(bx) |
|
* |
|
* Next we'll simply add the mapbuf widget to the box: |
|
* @skipline mapbuf_add |
|
* @until pack_end |
|
* |
|
* But mapbuf is a container widget, it won't do anything alone. So let's |
|
* create a table full of icons. For that we'll loop to fill each line of each |
|
* column. See @ref tutorial_table_01 "tutorial_table_01" |
|
* if you don't know how to use tables: |
|
* @skipline table_add |
|
* @until } |
|
* @until } |
|
* |
|
* Finally, setting mapbuf content: |
|
* @skipline content_set |
|
* @skipline show |
|
* |
|
* Also, would be good a horizontal box with some controls to change mapbuf |
|
* behavior: |
|
* @skipline box_add |
|
* @until show |
|
* |
|
* By default map is disabled. So just setting content isn't enough. |
|
* Alpha and smooth settings will be applied when map is enabled. |
|
* So we'll add a check for that. Everytime the map properties |
|
* are changed, map will need to be enabled again. So if you |
|
* want to play a bit with our example, remember to always enable |
|
* map again after concluding your changes. |
|
* @skipline check_add |
|
* @until show |
|
* |
|
* We have added a callback function to this check, so it will enable |
|
* or disable map: |
|
* @dontinclude mapbuf_example.c |
|
* @skip static |
|
* @skip } |
|
* @skipline static |
|
* @until } |
|
* |
|
* Let's add check boxes for alpha blending and smooth rendering: |
|
* @skipline check_add |
|
* @until show |
|
* @until show |
|
* |
|
* By default, mapbuf would enable alpha blending and smooth rendering, |
|
* so we need to check boxes to be consistent with its behavior. |
|
* |
|
* Callback functions look like the one added to the check. This way we |
|
* could enable or disable the both properties: |
|
* @dontinclude mapbuf_example.c |
|
* @skip static |
|
* @skip } |
|
* @skip static |
|
* @skip } |
|
* @skipline static |
|
* @until } |
|
* @until } |
|
* |
|
* You'll see that disabling alpha blending will set a black rectangle below |
|
* the icons. That's the reason you only should enable that when you're sure |
|
* the mapbuf content is 100% solid. |
|
* |
|
* See @ref mapbuf_example.c "mapbuf_example.c", whose window should |
|
* look like this picture: |
|
* |
|
* @image html screenshots/mapbuf_example.png |
|
* @image latex screenshots/mapbuf_example.eps width=\textwidth |
|
* |
|
* @example mapbuf_example.c |
|
*/ |
|
|
|
/** |
|
* @page map_example_01 Map Example - Creation and Zoom |
|
* |
|
* This code places an Elementary map widget on a window, |
|
* to exemplify part of the widget's API. |
|
* |
|
* Let's start adding a map to our window: |
|
* @dontinclude map_example_01.c |
|
* @skipline elm_map_add |
|
* @until evas_object_show |
|
* |
|
* It's enough to display a world map inside our window. But usually you'll |
|
* need to let user interact with the map. We need to place some buttons, |
|
* so the user could control the map. It's done on the following code. |
|
* If you don't know about boxes, or buttons, check their examples, |
|
* @ref box_example_01 "Box Example 1" and |
|
* @ref button_example_01 "Button Example 1". |
|
* @skipline elm_box_add |
|
* @until _bt_zoom_fill |
|
* |
|
* We are adding callback functions that will be called when the user clicks |
|
* over these buttons. Let's study such functions, starting from the function |
|
* that will zoom in the map: |
|
* @dontinclude map_example_01.c |
|
* @skipline static void |
|
* @until } |
|
* |
|
* First thing done is assure zoom mode is set to manual. It's the default |
|
* mode, but the other buttons will change this, so before setting a new |
|
* zoom value, we need to change the zoom mode. |
|
* |
|
* Then, we get the current zoom value, increment that, and set the new |
|
* value to the map. If it's bigger than max zoom value allowed, it will |
|
* remain on the maximum allowed, nothing bad will happen. This way we |
|
* don't need to check first if it won't be bigger than max. |
|
* |
|
* Zoom out function is basically the same thing, but zoom will be decremented |
|
* instead of incremented: |
|
* @skipline static void |
|
* @until } |
|
* |
|
* The "X" button, when pressed, will call a function that will |
|
* zoom the map until it fits |
|
* inside the scroll frame with no pixels outside this area: |
|
* @skipline static void |
|
* @until } |
|
* |
|
* And the "#" button, will call a function that will zoom until map fills |
|
* scroll, ensuring no pixels are left unfilled: |
|
* @skipline static void |
|
* @until } |
|
* |
|
* But we can also set map to show something different from default |
|
* world map, changing the zoom level and region shown. Let's pick a |
|
* wonderful city coordinates, one placed at <tt> 43 20 S, 22 90 W </tt>. |
|
* Since map uses double variables to represent latitude and longitude, |
|
* to represent north or east, we should represent it as positive values, |
|
* and south or west as negative. Also, the value will be represented as |
|
* degree.min. So, for example, our longitude <tt> 43 20 S </tt> will |
|
* be represented |
|
* by the value <tt> -43.20 </tt>. A zoom set to @c 12 should be enough |
|
* to show a city. |
|
* @skipline region_show |
|
* @until zoom_set |
|
* |
|
* See @ref map_example_01.c "map_example_01.c" for full source, |
|
* whose window should |
|
* look like this picture: |
|
* |
|
* @image html screenshots/map_example_01.png |
|
* @image latex screenshots/map_example_01.eps width=\textwidth |
|
* |
|
* @example map_example_01.c |
|
*/ |
|
|
|
/** |
|
* @page map_example_02 Map Example - Overlay Usage |
|
* |
|
* This code places an Elementary map widget on a window, |
|
* to exemplify part of the widget's API, related to overlays. |
|
* |
|
* We'll start this example in the same way as |
|
* @ref map_example_01 "Map Example 1". Adding a map with buttons to control |
|
* zoom, so if you didn't read it yet, just do it now. |
|
* @dontinclude map_example_02.c |
|
* @skipline elm_map_add |
|
* @until zoom_fill |
|
* |
|
* Overlays can be placed over the map to represent anything we want. Let's |
|
* say we want to represent some countries and cities with overlays. |
|
* |
|
* Before we create city or country overlays, let's create class overlays. |
|
* |
|
* @skipline elm_map_overlay_class_add |
|
* @until elm_map_overlay_icon_set |
|
* These lines create a class overlay which represents cities. |
|
* This class overlay will be used for grouping city overlays. |
|
* Later city overlays in the same class are appended to this class overlay. |
|
* if city overlays are near each other, they will be grouped. |
|
* |
|
* We can set the icon for the class so that the icon will be displayed |
|
* when city overlays are grouped. |
|
* We can set the zoom required to display the overlays that belongs |
|
* to this class, so if the zoom is less than this value, nothing |
|
* will be shown. |
|
* |
|
* Country class can be created in the same way. |
|
* @skipline elm_map_overlay_class_add |
|
* @until elm_map_overlay_icon_set |
|
* |
|
* Next we'll create some overlays representing cities and countries. |
|
* We set the data for the overlay so that can be used later when |
|
* clicked callback is called. |
|
* We'll append them into city class to be grouped. |
|
* We'll append them in a list, to close up them later. |
|
* To create a default overlay, we need to pass the coordinates. |
|
* @skipline elm_map_overlay_add |
|
* @until eina_list_append |
|
* |
|
* We subscribe a smart callback "overlay,clicked" to create bubble on |
|
* the clicked overlay. |
|
* @dontinclude map_example_02.c |
|
* @skipline "overlay,clicked" |
|
* |
|
* Finally, on our @c main function, we ask the map to show all the overlays |
|
* with the biggest zoom possible, passing the list of overlays added. |
|
* @skipline elm_map_overlays_show |
|
* |
|
* We have created a specific structure for this example to store the name |
|
* of the place and a path to a image file to represent it. |
|
* @dontinclude map_example_02.c |
|
* @skipline typedef |
|
* @until Overlay_Data; |
|
* |
|
* We'll create instances for each place: |
|
* @skipline argentina |
|
* @until sky_03 |
|
* |
|
* To return an icon, all we need to do is to add a elm_icon and return it: |
|
* @dontinclude map_example_02.c |
|
* @skipline _icon_get( |
|
* @until } |
|
* |
|
* For the content, let's return something more elaborate. We will return |
|
* a box with an image representing the place, and the name of this place: |
|
* @skipline _box_get( |
|
* @until } |
|
* |
|
* See @ref map_example_02.c "map_example_02.c" for full source, |
|
* whose window should |
|
* look like this picture: |
|
* |
|
* @image html screenshots/map_example_02.png |
|
* @image latex screenshots/map_example_02.eps width=\textwidth |
|
* |
|
* @example map_example_02.c |
|
*/ |
|
|
|
/** |
|
* @page map_example_03 Map Example - Route and Name Usage |
|
* |
|
* This code places an Elementary map widget on a window, |
|
* to exemplify part of the widget's API, related routes and names. |
|
* |
|
* In this example, we will suppose we need to set a route for the user |
|
* from his current point (a gps could provide us this information) |
|
* to somewhere else. So we would have coordinates of this |
|
* start point, and would like that he enters the address of his |
|
* destination in a entry, and we'll trace a route on the map. |
|
* |
|
* We'll start this example in the same way |
|
* @ref map_example_01 "Map Example 1". Adding a map with buttons to control |
|
* zoom, so if you didn't read it yet, just do it now. Actually there is |
|
* a change, that we're aligning buttons to the top, since we wan't a |
|
* vertical control box this time. |
|
* @dontinclude map_example_03.c |
|
* @skipline elm_map_add |
|
* @until zoom_fill |
|
* @until align_set |
|
* |
|
* Next we set the box to be vertical and change it's size, weight |
|
* and alignment, so it will occupy the top of the window, from left |
|
* to right: |
|
* @skipline horizontal_set |
|
* @until align_set |
|
* |
|
* We'll add an entry with a preliminar address, that I know will |
|
* find a coordinate, to examplify names work. But you can try |
|
* lots of addresses. From city or country names to pubs, or whatever |
|
* you want. To try is enough to run the example, type the address and |
|
* press "Route" button. This button will call a function that will |
|
* get the typed address and find the route. |
|
* @skipline entry_add |
|
* @until align_set |
|
* @until align_set |
|
* |
|
* The button pass an structure |
|
* instance we make for this example, with all the fields we'll need. |
|
* @dontinclude map_example_03.c |
|
* @skipline _Example_Data |
|
* @until example_data; |
|
* |
|
* Let's initialize it's fields: |
|
* @skipline example_data.map |
|
* @until example_data.start_lat |
|
* |
|
* @c map and @c entry are our elementary objects, @c route is set to @c NULL, |
|
* since we don't have one yet, and the coordinates of the start point is set |
|
* (longitude and latitude). |
|
* |
|
* Also, let's show this start point at the center of the map, and set a zoom |
|
* nice enough to close it: |
|
* @skipline region_show |
|
* @until zoom_set |
|
* |
|
* These lines were already explained on @ref map_example_02 "Map Example 2". |
|
* |
|
* Now we'll see the "Route" button callback function: |
|
* @dontinclude map_example_03.c |
|
* @skip static void |
|
* @skip } |
|
* @skipline static void |
|
* @until } |
|
* |
|
* First we get the address string from our entry. Then we use @c name |
|
* conversion |
|
* util functions, so we could get coordinates for this address. These |
|
* functions return an #Elm_Map_Name handle for us. |
|
* Function elm_map_name_geo_request() will do this job for us, |
|
* but it's an asynchronous function, since it requires this |
|
* information from the server. |
|
* |
|
* That's the reason we need to wait for |
|
* <tt> "name,loaded" </tt> signal. We add a callback function for this: |
|
* @dontinclude map_example_03.c |
|
* @skipline static void |
|
* @until } |
|
* |
|
* This function will check if a previous route was traced, and if it was, |
|
* it will remove it. Next we'll get destination coordinates from our |
|
* @c name, and use them to add a new route. |
|
* |
|
* To trace a route we need to know how the user will go through the path. |
|
* Let's suppose he'll be walking, but doesn't like to walk, so we |
|
* need to choose the shortest path instead of the route that would |
|
* made him spend less time. Coordinates of the point from where he will |
|
* start and of the destination point need to be passed as well. |
|
* |
|
* Finally we'll set a color different from solid red (default), to show |
|
* our route. We set it green. |
|
* |
|
* See @ref map_example_03.c "map_example_03.c" for full source, |
|
* whose window should |
|
* look like this picture: |
|
* |
|
* @image html screenshots/map_example_03.png |
|
* @image latex screenshots/map_example_03.eps width=\textwidth |
|
* |
|
* @example map_example_03.c |
|
*/ |
|
|
|
/** |
|
* @page diskselector_example_01 Diskselector widget example |
|
* |
|
* This code places 4 Elementary diskselector widgets on a window, each of |
|
* them exemplifying a part of the widget's API. |
|
* |
|
* All of them will have weekdays as items, since we won't focus |
|
* on items management on this example. For an example about this subject, |
|
* check @ref diskselector_example_02. |
|
* |
|
* The first of them is a default diskselector. |
|
* @dontinclude diskselector_example_01.c |
|
* @skipline lbl |
|
* @until } |
|
* @skipline elm_diskselector_add |
|
* @until evas_object_show |
|
* |
|
* We are just adding the diskselector, so as you can see, defaults for it are: |
|
* @li Only 3 items visible each time. |
|
* @li Only 3 characters are displayed for labels on side positions. |
|
* @li The first added item remains centeres, i.e., it's the selected item. |
|
* |
|
* To add items, we are just appending it on a loop, using function |
|
* elm_diskselector_item_append(), that will be better explained on |
|
* items management example. |
|
* |
|
* For a circular diskselector, check the second widget. A circular |
|
* diskselector will display first item after last, and last previous to |
|
* the first one. So, as you can see, @b Sa will appears on left side |
|
* of selected @b Sunday. This property is set with |
|
* elm_diskselector_round_enabled_set(). |
|
* |
|
* Also, we decide to display only 2 character for side labels, instead of 3. |
|
* For this we call elm_diskselector_side_text_max_length_set(). As result, |
|
* we'll see @b Mo displayed instead of @b Mon, when @b Monday is on a |
|
* side position. |
|
* |
|
* @skipline elm_diskselector_add |
|
* @until evas_object_show |
|
* |
|
* But so far, we are only displaying 3 items at once. If more are wanted, |
|
* is enough to call elm_diskselector_display_item_num_set(), as you can |
|
* see here: |
|
* @skipline elm_diskselector_add |
|
* @until elm_diskselector_display_item_num_set |
|
* |
|
* @note You can't set less than 3 items to be displayed. |
|
* |
|
* You can get the number of items in the diskselector by calling |
|
* elm_diskselector_display_item_num_get(), as you can see here: |
|
* @skipline elm_diskselector_display_item_num_get |
|
* |
|
* Finally, if a bounce effect is required, or you would like to see |
|
* scrollbars, it is possible. But, for default theme, diskselector |
|
* scrollbars will be invisible anyway. |
|
* @skipline elm_diskselector_add |
|
* @until evas_object_show |
|
* |
|
* See the full @ref diskselector_example_01.c "diskselector_example_01.c" |
|
* code, whose window should look like this picture: |
|
* |
|
* @image html screenshots/diskselector_example_01.png |
|
* @image latex screenshots/diskselector_example_01.eps width=\textwidth |
|
* |
|
* @example diskselector_example_01.c |
|
*/ |
|
|
|
/** |
|
* @page diskselector_example_02 Diskselector - Items management |
|
* |
|
* This code places an Elementary diskselector widgets on a window, |
|
* along with some buttons trigerring actions on it (though its API). |
|
* It covers most of diskselector item functions. |
|
* |
|
* On our @c main function, we are adding a default diskselector with |
|
* 3 items. We are only setting their labels (second parameter of function |
|
* elm_diskselector_item_append): |
|
* @dontinclude diskselector_example_02.c |
|
* @skipline elm_diskselector_add |
|
* @until Item 2 |
|
* |
|
* Next we are adding lots of buttons, each one for a callback function |
|
* that will realize a task covering part of diskselector items API. |
|
* Lets check the first one: |
|
* @skipline elm_button_add |
|
* @until evas_object_show |
|
* |
|
* We are labeling the button with a task description with |
|
* elm_object_text_set() and setting a callback |
|
* function evas_object_smart_callback_add(). |
|
* Each callback function will have the signature: |
|
* <tt> static void _task_cb(void *data, Evas_Object *obj, |
|
* void *event_info)</tt> with the function name varying for each task. |
|
* |
|
* Now let's cover all of them. |
|
* |
|
* <b> Appending an item: </b> |
|
* @dontinclude diskselector_example_02.c |
|
* @skipline _add_cb |
|
* @until } |
|
* |
|
* All items are included on diskselector after last one. You @b can't |
|
* prepend items. |
|
* |
|
* The first parameter of elm_diskselector_item_append() is the diskselector |
|
* object, that we are receiving as data on our callback function. |
|
* The second one is a label, the string that will be placed in the center |
|
* of our item. As we don't wan't icons or callback functions, we can |
|
* send NULL as third, fourth and fifth parameters. |
|
* |
|
* <b> Appending an item with icon: </b> |
|
* @dontinclude diskselector_example_02.c |
|
* @skipline _add_ic_cb |
|
* @until } |
|
* |
|
* If an icon is required, you can pass it as third parameter on our |
|
* elm_diskselector_item_append() function. It will be place on the |
|
* left side of item's label, that will be shifted to right a bit. |
|
* |
|
* For more details about how to create icons, look for elm_icon examples. |
|
* |
|
* <b> Appending an item with callback function for selected: </b> |
|
* @dontinclude diskselector_example_02.c |
|
* @skipline _sel_cb |
|
* @until } |
|
* @until } |
|
* |
|
* To set a callback function that will be called every time an item is |
|
* selected, i.e., everytime the diskselector stops with this item in |
|
* center position, just pass the function as fourth parameter. |
|
* |
|
* <b> Appending an item with callback function for selected with data: </b> |
|
* @dontinclude diskselector_example_02.c |
|
* @skipline _sel_data_cb |
|
* @until } |
|
* @until } |
|
* @until } |
|
* @until } |
|
* |
|
* If the callback function request an extra data, it can be attached to our |
|
* item passing a pointer for data as fifth parameter. |
|
* Our function _sel_data_cb will receive it as <tt> void *data </tt>. |
|
* |
|
* If you want to free this data, or handle that the way you need when the |
|
* item is deleted, set a callback function for that, with |
|
* elm_object_item_del_cb_set(). |
|
* |
|
* As you can see we check if @c it is not @c NULL after appending it. |
|
* If an error happens, we won't try to set a function for it. |
|
* |
|
* <b> Deleting an item: </b> |
|
* @dontinclude diskselector_example_02.c |
|
* @skipline _del_cb(void |
|
* @until } |
|
* |
|
* To delete an item we simple need to call elm_object_item_del() with |
|
* a pointer for such item. |
|
* |
|
* If you need, you can get selected item with |
|
* elm_diskselector_selected_item_get(), that will return a pointer for it. |
|
* |
|
* <b> Unselecting an item: </b> |
|
* @dontinclude diskselector_example_02.c |
|
* @skipline _unselect_cb |
|
* @until } |
|
* |
|
* To select an item, you should call elm_diskselector_item_selected_set() |
|
* passing @c EINA_TRUE, and to unselect it, @c EINA_FALSE. |
|
* |
|
* If you unselect the selected item, diskselector will automatically select |
|
* the first item. |
|
* |
|
* <b> Printing all items: </b> |
|
* @dontinclude diskselector_example_02.c |
|
* @skipline _print_cb |
|
* @until } |
|
* |
|
* <b> Clearing the diskselector: </b> |
|
* @dontinclude diskselector_example_02.c |
|
* @skipline _clear_cb |
|
* @until } |
|
* |
|
* <b> Selecting the first item: </b> |
|
* @dontinclude diskselector_example_02.c |
|
* @skipline _select_first_cb |
|
* @until } |
|
* |
|
* <b> Selecting the last item: </b> |
|
* @dontinclude diskselector_example_02.c |
|
* @skipline _select_last_cb |
|
* @until } |
|
* |
|
* <b> Selecting the next item: </b> |
|
* @dontinclude diskselector_example_02.c |
|
* @skipline _select_next_cb |
|
* @until } |
|
* |
|
* <b> Selecting the previous item: </b> |
|
* @dontinclude diskselector_example_02.c |
|
* @skipline _select_prev_cb |
|
* @until } |
|
* |
|
* See the full @ref diskselector_example_02.c "diskselector_example_02.c" |
|
* code, whose window should look like this picture: |
|
* |
|
* @image html screenshots/diskselector_example_02.png |
|
* @image latex screenshots/diskselector_example_02.eps width=\textwidth |
|
* |
|
* @example diskselector_example_02.c |
|
*/ |
|
|
|
/** |
|
* @page list_example_01 List widget example |
|
* |
|
* This code places a single Elementary list widgets on a window, just |
|
* to exemplify the more simple and common use case: a list will be created |
|
* and populated with a few items. |
|
* |
|
* To keep it simple, we won't show how to customize the list, for this check |
|
* @ref list_example_02. Also, we won't focus |
|
* on items management on this example. For an example about this subject, |
|
* check @ref list_example_03. |
|
* |
|
* To add a list widget. |
|
* @dontinclude list_example_01.c |
|
* @skipline elm_list_add |
|
* |
|
* We are just adding the list, so as you can see, defaults for it are: |
|
* @li Items are displayed vertically. |
|
* @li Only one item can be selected. |
|
* @li The list doesn't bounce. |
|
* |
|
* To add items, we are just appending it on a loop, using function |
|
* elm_list_item_append(), that will be better explained on |
|
* items management example. |
|
* @dontinclude list_example_01.c |
|
* @skipline lbl[] |
|
* @until }; |
|
* @skipline for |
|
* @skipline elm_list_item_append |
|
* |
|
* After we just want to show the list. But first we need to start the widget. |
|
* It was done this way to improve widget's performance. So, always remember |
|
* that: |
|
* @warning Call elm_list_go before showing the object |
|
* @skipline elm_list_go |
|
* @skipline show |
|
* |
|
* See the full @ref list_example_01.c "list_example_01.c" |
|
* code, whose window should look like this picture: |
|
* |
|
* @image html screenshots/list_example_01.png |
|
* @image latex screenshots/list_example_01.eps width=\textwidth |
|
* |
|
* @example list_example_01.c |
|
*/ |
|
|
|
/** |
|
* @page list_example_02 List widget example |
|
* |
|
* This code places a single Elementary list widgets on a window, |
|
* exemplifying a part of the widget's API. |
|
* |
|
* First, we will just create a simple list, as done on @ref list_example_01 : |
|
* @dontinclude list_example_02.c |
|
* @skipline lbl |
|
* @until } |
|
* @skipline elm_list_add |
|
* @until elm_list_item_append |
|
* |
|
* Now, let's customize this list a bit. First we will display items |
|
* horizontally: |
|
* @skipline horizontal_set |
|
* |
|
* Then we will choose another list mode. There are four of them, and |
|
* the default #Elm_List_Mode is #ELM_LIST_SCROLL. Let's set compress mode: |
|
* @skipline mode_set |
|
* |
|
* To enable multiple items selection, we need to enable it, since only one |
|
* selected item is allowed by default: |
|
* @skipline elm_list_multi_select_set |
|
* |
|
* We are not adding items with callback functions here, |
|
* since we'll explain it better on @ref list_example_03. But if the callback |
|
* need to be called everytime user clicks an item, even if already selected, |
|
* it's required to enable this behavior: |
|
* @skipline elm_list_select_mode_set |
|
* |
|
* Finally, if a bounce effect is required, or you would like to see |
|
* scrollbars, it is possible. But, for default theme, list |
|
* scrollbars will be invisible anyway. |
|
* @skipline bounce_set |
|
* @until SCROLLER_POLICY_ON |
|
* |
|
* See the full @ref list_example_02.c "list_example_02.c" |
|
* code, whose window should look like this picture: |
|
* |
|
* @image html screenshots/list_example_02.png |
|
* @image latex screenshots/list_example_02.eps width=\textwidth |
|
* |
|
* @example list_example_02.c |
|
*/ |
|
|
|
/** |
|
* @page list_example_03 List - Items management |
|
* |
|
* This code places an Elementary list widgets on a window, |
|
* along with some buttons trigerring actions on it (though its API). |
|
* It covers most of elm_list_item functions. |
|
* |
|
* On our @c main function, we are adding a default list with |
|
* 3 items. We are only setting their labels (second parameter of function |
|
* elm_list_item_append): |
|
* @dontinclude list_example_03.c |
|
* @skipline elm_list_add |
|
* @until Item 2 |
|
* |
|
* Next we are adding lots of buttons, each one for a callback function |
|
* that will realize a task covering part of list items API. |
|
* Lets check the first one: |
|
* @skipline elm_button_add |
|
* @until evas_object_show |
|
* |
|
* We are labeling the button with a task description with |
|
* elm_object_text_set() and setting a callback |
|
* function evas_object_smart_callback_add(). |
|
* Each callback function will have the signature: |
|
* <tt> static void _task_cb(void *data, Evas_Object *obj, |
|
* void *event_info)</tt> with the function name varying for each task. |
|
* |
|
* Now let's cover all of them. |
|
* |
|
* <b> Prepending an item: </b> |
|
* @dontinclude list_example_03.c |
|
* @skipline _prepend_cb |
|
* @until } |
|
* |
|
* The item will be placed on the beginning of the list, |
|
* i.e. it will be the first one. |
|
* |
|
* The first parameter of elm_list_item_prepend() is the list |
|
* object, that we are receiving as data on our callback function. |
|
* The second one is a label, the string that will be placed in the center |
|
* of our item. As we don't wan't icons or callback functions, we can |
|
* send NULL as third, fourth, fifth and sixth parameters. |
|
* |
|
* <b> Appending an item: </b> |
|
* @dontinclude list_example_03.c |
|
* @skipline _add_cb |
|
* @until } |
|
* |
|
* Items included with append will be inserted inserted after the last one. |
|
* |
|
* <b> Appending an item with icon: </b> |
|
* @dontinclude list_example_03.c |
|
* @skipline _add_ic_cb |
|
* @until } |
|
* |
|
* If an icon is required, you can pass it as third parameter on our |
|
* elm_list_item_append() function. It will be place on the |
|
* left side of item's label. If an icon is wanted on the right side, |
|
* it should be passed as fourth parameter. |
|
* |
|
* For more details about how to create icons, look for elm_icon examples |
|
* @ref tutorial_icon. |
|
* |
|
* <b> Appending an item with callback function for selected: </b> |
|
* @dontinclude list_example_03.c |
|
* @skipline _sel_cb |
|
* @until } |
|
* @until } |
|
* |
|
* To set a callback function that will be called every time an item is |
|
* selected, i.e., everytime the list stops with this item in |
|
* center position, just pass the function as fifth parameter. |
|
* |
|
* <b> Appending an item with callback function for selected with data: </b> |
|
* @dontinclude list_example_03.c |
|
* @skipline _sel_data_cb |
|
* @until } |
|
* @until } |
|
* @until } |
|
* @until } |
|
* |
|
* If the callback function request an extra data, it can be attached to our |
|
* item passing a pointer for data as sixth parameter. |
|
* Our function _sel_data_cb will receive it as <tt> void *data </tt>. |
|
* |
|
* If you want to free this data, or handle that the way you need when the |
|
* item is deleted, set a callback function for that, with |
|
* elm_object_item_del_cb_set(). |
|
* |
|
* As you can see we check if @c it is not @c NULL after appending it. |
|
* If an error happens, we won't try to set a function for it. |
|
* |
|
* <b> Deleting an item: </b> |
|
* @dontinclude list_example_03.c |
|
* @skipline _del_cb( |
|
* @until } |
|
* |
|
* To delete an item we simple need to call elm_object_item_del() with |
|
* a pointer for such item. |
|
* |
|
* If you need, you can get selected item with |
|
* elm_list_selected_item_get(), that will return a pointer for it. |
|
* |
|
* <b> Unselecting an item: </b> |
|
* @dontinclude list_example_03.c |
|
* @skipline _unselect_cb |
|
* @until } |
|
* |
|
* To select an item, you should call elm_list_item_selected_set() |
|
* passing @c EINA_TRUE, and to unselect it, @c EINA_FALSE. |
|
* |
|
* <b> Printing all items: </b> |
|
* @dontinclude list_example_03.c |
|
* @skipline _print_cb |
|
* @until } |
|
* |
|
* <b> Clearing the list: </b> |
|
* @dontinclude list_example_03.c |
|
* @skipline _clear_cb |
|
* @until } |
|
* |
|
* <b> Selecting the next item: </b> |
|
* @dontinclude list_example_03.c |
|
* @skipline _select_next_cb |
|
* @until } |
|
* |
|
* <b> Inserting after an item: </b> |
|
* @dontinclude list_example_03.c |
|
* @skipline _insert_after_cb |
|
* @until } |
|
* |
|
* <b> Selecting the previous item: </b> |
|
* @dontinclude list_example_03.c |
|
* @skipline _select_prev_cb |
|
* @until } |
|
* |
|
* <b> Inserting before an item: </b> |
|
* @dontinclude list_example_03.c |
|
* @skipline _insert_before_cb |
|
* @until } |
|
* |
|
* If a separator is required, just set an item as such: |
|
* @dontinclude list_example_03.c |
|
* @skipline _set_separator_cb |
|
* @until } |
|
* |
|
* Also an item can be disabled, and the user won't be allowed to (un)select it: |
|
* @dontinclude list_example_03.c |
|
* @skipline _disable_cb |
|
* @until } |
|
* |
|
* See the full @ref list_example_03.c "list_example_03.c" |
|
* code, whose window should look like this picture: |
|
* |
|
* @image html screenshots/list_example_03.png |
|
* @image latex screenshots/list_example_03.eps width=\textwidth |
|
* |
|
* @example list_example_03.c |
|
*/ |
|
|
|
/** |
|
* @page toolbar_example_01 Toolbar Example - Simple Items |
|
* |
|
* This code places an Elementary toolbar widget on a window, |
|
* to exemplify part of the widget's API. |
|
* |
|
* Let's start adding a button to our window, that will have its text |
|
* modified depending on which item is selected. It's used just to exemplify |
|
* how to change a window content from the toolbar. |
|
* @dontinclude toolbar_example_01.c |
|
* @skipline elm_button_add |
|
* @until evas_object_show |
|
* |
|
* Also, we'll need a toolbar widget, obviously: |
|
* @skipline elm_toolbar_add |
|
* @until evas_object_show |
|
* |
|
* When appending an item is possible to set an icon, label, and a callback |
|
* function that will receive passed data. |
|
* @skipline _item_append |
|
* @until Folder |
|
* |
|
* It's possible to disable items, so the user can't select then. We will |
|
* disable the third item: |
|
* @skipline _item_append |
|
* @until disable |
|
* |
|
* Our callbacks will just set button's label: |
|
* @dontinclude toolbar_example_01.c |
|
* @skip static |
|
* @skip } |
|
* @skipline static |
|
* @until } |
|
* @until } |
|
* @until } |
|
* |
|
* By default, toolbars would display items homogeneously, so item with |
|
* long labels, like the third, will make all of them occupy a lot of space. |
|
* To avoid that, we can disable it: |
|
* @dontinclude toolbar_example_01.c |
|
* @skipline homogeneous |
|
* |
|
* Another default behavior, is to add an menu item if we have more items |
|
* that would fit on toolbar size. To simply enable scroll, without menus, |
|
* it's required to change toolbar's shrink mode: |
|
* @dontinclude toolbar_example_01.c |
|
* @skipline shrink |
|
* |
|
* See @ref toolbar_example_01.c "toolbar_example_01.c", whose window should |
|
* look like this picture: |
|
* |
|
* @image html screenshots/toolbar_example_01.png |
|
* @image latex screenshots/toolbar_example_01.eps width=\textwidth |
|
* |
|
* @example toolbar_example_01.c |
|
*/ |
|
|
|
/** |
|
* @page toolbar_example_02 Toolbar Example - Items with States |
|
* |
|
* This code places an Elementary toolbar widget on a window, |
|
* to exemplify part of the widget's API. |
|
* |
|
* Toolbar widgets has support to items with states. Each state |
|
* can have it's own label, icon, and callback function. |
|
* |
|
* Let's start populating a toolbar with some regular items. |
|
* If you don't know how to do that, see |
|
* @ref toolbar_example_01 "Toolbar Example 1". |
|
* @dontinclude toolbar_example_02.c |
|
* @skipline elm_toolbar_add |
|
* @until Update |
|
* |
|
* The only difference here is that we set shrink mode to #ELM_TOOLBAR_SHRINK_HIDE, |
|
* that won't display items that doesn't fit to the window. |
|
* |
|
* Now, let's add an item with states. First, add the item just as any other. |
|
* @skipline elm_toolbar_item_append |
|
* @until _item_pressed |
|
* |
|
* After that states can be added to this item: |
|
* @skipline state_add |
|
* @until Full |
|
* @until _item_pressed |
|
* |
|
* The both states and the item are using the same callback function, |
|
* that will cycle between states and unselect the item. Unseleting |
|
* is required because it won't call the callback if an user clicks |
|
* over an item already selected: |
|
* @dontinclude toolbar_example_02.c |
|
* @skip static |
|
* @skip } |
|
* @skipline static |
|
* @until } |
|
* |
|
* On our example, some items are hidden |
|
* because we set the window to be small. But if an item should be displayed |
|
* anyway, is needed to set its priority to be higher than others. |
|
* Any positive value will be enough in our case. Let's force the item |
|
* with multiple states to be displayed. |
|
* @skipline priority |
|
* |
|
* See @ref toolbar_example_02.c "toolbar_example_02.c", whose window should |
|
* look like this picture: |
|
* |
|
* @image html screenshots/toolbar_example_02.png |
|
* @image latex screenshots/toolbar_example_02.eps width=\textwidth |
|
* |
|
* @example toolbar_example_02.c |
|
*/ |
|
|
|
/** |
|
* @page toolbar_example_03 Toolbar Example - Items with Menus |
|
* |
|
* Toolbar widgets have support to items with menus. This kind |
|
* of item will display a menu when selected by the user. |
|
* |
|
* Let's start populating a toolbar with some regular items, the same |
|
* way we started @ref toolbar_example_02 "Toolbar Example 2". |
|
* @dontinclude toolbar_example_03.c |
|
* @skipline elm_toolbar_add |
|
* @until Update |
|
* |
|
* The only difference is that we'll keep the default shrink mode, that |
|
* adds an item with a menu of hidden items. |
|
* |
|
* So, a important thing to do is to set a parent for toolbar menus, or they |
|
* will use the toolbar as parent, and its size will be restricted to that. |
|
* @skipline parent_set |
|
* |
|
* Not only items' menus will respect this parent, but also the own toolbar |
|
* menu, used to show hidden items. |
|
* |
|
* Next, let's add an item set to display a menu: |
|
* @skipline elm_toolbar_item_append |
|
* @until _menu_set |
|
* |
|
* Now, to add two options to this item, we can get the menu object and use |
|
* it as a regular elm_menu. See @ref tutorial_menu "Menu example" for more |
|
* about menu widget. |
|
* @skipline _menu_get |
|
* @until Full |
|
* |
|
* See @ref toolbar_example_03.c "toolbar_example_03.c", whose window should |
|
* look like this picture: |
|
* |
|
* @image html screenshots/toolbar_example_03.png |
|
* @image latex screenshots/toolbar_example_03.eps width=\textwidth |
|
* |
|
* @example toolbar_example_03.c |
|
*/ |
|
|
|
/** |
|
* @page segment_control_example Segment Control Example |
|
* |
|
* This code places an Elementary segment control widgets on a window, |
|
* to exemplify part of the widget's API. |
|
* |
|
* Let's start adding a segment control to our window: |
|
* @dontinclude segment_control_example.c |
|
* @skipline elm_segment_control_add |
|
* @until evas_object_show |
|
* |
|
* Now will add an item only with label: |
|
* @skipline item_add |
|
* |
|
* Really simple. To add an item with only an icon, the icon needs to be created |
|
* first, them added with this same function: |
|
* @skipline icon_add |
|
* @until item_add |
|
* |
|
* If an item with label and icon is required, it can be done as well. In this |
|
* case, instead of a label (or icon) centered, the item will display an icon |
|
* at left and the label at right: |
|
* @skipline icon_add |
|
* @until item_add |
|
* |
|
* But, if you need to add some items that can have or not a label, but |
|
* want that all of them looks the same way, with icon at left, just add |
|
* an empty string label. It's done on our example to illustrate that: |
|
* @skipline icon_add |
|
* @until item_add |
|
* |
|
* So far, all the item were added to the last position of the widget, |
|
* but if something different is required, it can be done using another |
|
* insertion function. Let's suppose we want to put an item just before |
|
* the last item: |
|
* @skipline count |
|
* @until insert_at |
|
* |
|
* There are two ways to delete items. Using the item handle, like: |
|
* @skipline insert_at |
|
* @until del |
|
* |
|
* Or using item's index: |
|
* @skipline insert_at |
|
* @until del_at |
|
* |
|
* To set properties of an item already added to the widget, you just need |
|
* to get the item and set icon or label, as the following code shows: |
|
* @skipline item_get |
|
* @until label_set |
|
* |
|
* Finally, it's possible to select an item from the code, and also get |
|
* the selected item. We will select the item at the center of the widget |
|
* and print its position. |
|
* @skipline count_get |
|
* @until printf |
|
* |
|
* See the full @ref segment_control_example.c "example", whose window should |
|
* look like this picture: |
|
* |
|
* @image html screenshots/segment_control_example.png |
|
* @image latex screenshots/segment_control_example.eps width=\textwidth |
|
* |
|
* @example segment_control_example.c |
|
*/ |
|
|
|
/** |
|
* @page flipselector_example Flip selector widget example |
|
* |
|
* This code places an Elementary flip selector widget on a window, |
|
* along with two buttons trigerring actions on it (though its API). |
|
* |
|
* The selector is being populated with the following items: |
|
* @dontinclude flipselector_example.c |
|
* @skip lbl[] |
|
* @until ; |
|
* |
|
* Next, we create it, populating it with those items and registering |
|
* two (smart) callbacks on it: |
|
* @dontinclude flipselector_example.c |
|
* @skip fp = elm_flipselector_add |
|
* @until object_show |
|
* |
|
* Those two callbacks will take place whenever one of those smart |
|
* events occur, and they will just print something to @c stdout: |
|
* @dontinclude flipselector_example.c |
|
* @skip underflow callback |
|
* @until } |
|
* @until } |
|
* Flip the sheets on the widget while looking at the items list, in |
|
* the source code, and you'll get the idea of those events. |
|
* |
|
* The two buttons below the flip selector will take the actions |
|
* described in their labels: |
|
* @dontinclude flipselector_example.c |
|
* @skip bt = elm_button_add |
|
* @until callback_add(win |
|
* |
|
* @dontinclude flipselector_example.c |
|
* @skip unselect the item |
|
* @until } |
|
* @until } |
|
* |
|
* Click on them to exercise those flip selector API calls. To |
|
* interact with the other parts of this API, there's a command line |
|
* interface, whose help string can be asked for with the 'h' key: |
|
* @dontinclude flipselector_example.c |
|
* @skip commands |
|
* @until ; |
|
* |
|
* The 'n' and 'p' keys will exemplify elm_flipselector_flip_next() |
|
* and elm_flipselector_flip_prev(), respectively. 'f' and 'l' account |
|
* for elm_flipselector_first_item_get() and |
|
* elm_flipselector_last_item_get(), respectively. Finally, 's' will |
|
* issue elm_flipselector_selected_item_get() on our example flip |
|
* selector widget. |
|
* |
|
* See the full @ref flipselector_example.c "example", whose window should |
|
* look like this picture: |
|
* |
|
* @image html screenshots/flipselector_example.png |
|
* @image latex screenshots/flipselector_example.eps width=\textwidth |
|
* |
|
* See the full @ref flipselector_example_c "source code" for this example. |
|
* |
|
*/ |
|
|
|
/** |
|
* @page fileselector_example File selector widget example |
|
* |
|
* This code places two Elementary file selector widgets on a window. |
|
* The one on the left is layouting file system items in a @b list, |
|
* while the the other is layouting them in a @b grid. |
|
* |
|
* The one having the majority of hooks of interest is on the left, |
|
* which we create as follows: |
|
* @dontinclude fileselector_example.c |
|
* @skip first file selector |
|
* @until object_show |
|
* |
|
* Note that we enable custom edition of file/directory selection, via |
|
* the text entry it has on its bottom, via |
|
* elm_fileselector_is_save_set(). It starts with the list view, which |
|
* is the default, and we make it not expandable in place |
|
* (elm_fileselector_expandable_set()), so that it replaces its view's |
|
* contents with the current directory's entries each time one |
|
* navigates to a different folder. For both of file selectors we are |
|
* starting to list the contents found in the @c "/tmp" directory |
|
* (elm_fileselector_path_set()). |
|
* |
|
* Note the code setting it to "grid mode" and observe the differences |
|
* in the file selector's views, in the example. We also hide the |
|
* second file selector's Ok/Cancel buttons -- since it's there just |
|
* to show the grid view (and navigation) -- via |
|
* elm_fileselector_buttons_ok_cancel_set(). |
|
* |
|
* The @c "done" event, which triggers the callback below |
|
* @dontinclude fileselector_example.c |
|
* @skip 'done' cb |
|
* @until } |
|
* will be called at the time one clicks the "Ok"/"Cancel" buttons of |
|
* the file selector (on the left). Note that it will print the path |
|
* to the current selection, if any. |
|
* |
|
* The @c "selected" event, which triggers the callback below |
|
* @dontinclude fileselector_example.c |
|
* @skip bt = 'selected' cb |
|
* @until } |
|
* takes place when one selects a file (if the file selector is @b not |
|
* under folders-only mode) or when one selects a folder (when in |
|
* folders-only mode). Experiment it by selecting different file |
|
* system entries. |
|
* |
|
* What comes next is the code creating the three check boxes and two |
|
* buttons below the file selector in the right. They will exercise a |
|
* bunch of functions on the file selector's API, for the instance on |
|
* the left. Experiment with them, specially the buttons, to get the |
|
* difference between elm_fileselector_path_get() and |
|
* elm_fileselector_selected_get(). |
|
* |
|
* Finally, there's the code adding the second file selector, on the |
|
* right: |
|
* @dontinclude fileselector_example.c |
|
* @skip second file selector |
|
* @until object_show |
|
* |
|
* Pay attention to the code setting it to "grid mode" and observe the |
|
* differences in the file selector's views, in the example. We also |
|
* hide the second file selector's Ok/Cancel buttons -- since it's |
|
* there just to show the grid view (and navigation) -- via |
|
* elm_fileselector_buttons_ok_cancel_set(). |
|
* |
|
* See the full @ref fileselector_example.c "example", whose window |
|
* should look like this picture: |
|
* |
|
* @image html screenshots/fileselector_example.png |
|
* @image latex screenshots/fileselector_example.eps width=\textwidth |
|
* |
|
* See the full @ref fileselector_example_c "source code" for this example. |
|
* |
|
*/ |
|
|
|
/** |
|
* @page fileselector_button_example File selector button widget example |
|
* |
|
* This code places an Elementary file selector button widget on a |
|
* window, along with some other checkboxes and a text entry. Those |
|
* are there just as knobs on the file selector button's state and to |
|
* display information from it. |
|
* |
|
* Here's how we instantiate it: |
|
* @dontinclude fileselector_button_example.c |
|
* @skip ic = elm_icon_add |
|
* @until evas_object_show |
|
* |
|
* Note that we set on it both icon and label decorations. It's set to |
|
* list the contents of the @c "/tmp" directory, too, with |
|
* elm_fileselector_button_path_set(). What follows are checkboxes to |
|
* exercise some of its API funtions: |
|
* @dontinclude fileselector_button_example.c |
|
* @skip ck = elm_check_add |
|
* @until evas_object_show(en) |
|
* |
|
* The checkboxes will toggle whether the file selector button's |
|
* internal file selector: |
|
* - must have an editable text entry for file names (thus, be in |
|
* "save dialog mode") |
|
* - is to be raised as an "inner window" (note it's the default |
|
* behavior) or as a dedicated window |
|
* - is to populate its view with folders only |
|
* - is to expand its folders, in its view, <b>in place</b>, and not |
|
* repainting it entirely just with the contents of a sole |
|
* directory. |
|
* |
|
* The entry labeled @c "Last selection" will exercise the @c |
|
* "file,chosen" smart event coming from the file selector button: |
|
* @dontinclude fileselector_button_example.c |
|
* @skip hook on the |
|
* @until toggle inwin |
|
* |
|
* Whenever you dismiss or acknowledges the file selector, after it's |
|
* raised, the @c event_info string will contain the last selection on |
|
* it (if any was made). |
|
* |
|
* This is how the example, just after called, should look like: |
|
* |
|
* @image html screenshots/fileselector_button_example_00.png |
|
* @image latex screenshots/fileselector_button_example_00.eps width=\textwidth |
|
* |
|
* Click on the file selector button to raise its internal file |
|
* selector, which will be contained on an <b>"inner window"</b>: |
|
* |
|
* @image html screenshots/fileselector_button_example_01.png |
|
* @image latex screenshots/fileselector_button_example_01.eps width=\textwidth |
|
* |
|
* Toggle the "inwin mode" switch off and, if you click on the file |
|
* selector button again, you'll get @b two windows, the original one |
|
* (note the last selection there!) |
|
* |
|
* @image html screenshots/fileselector_button_example_02.png |
|
* @image latex screenshots/fileselector_button_example_02.eps width=\textwidth |
|
* |
|
* and the file selector's new one |
|
* |
|
* @image html screenshots/fileselector_button_example_03.png |
|
* @image latex screenshots/fileselector_button_example_03.eps width=\textwidth |
|
* |
|
* Play with the checkboxes to get the behavior changes on the file |
|
* selector button. The respective API calls on the widget coming from |
|
* those knobs where shown in the code already. |
|
* |
|
* See the full @ref fileselector_button_example_c "source code" for |
|
* this example. |
|
* |
|
*/ |
|
|
|
/** |
|
* @page fileselector_entry_example File selector entry widget example |
|
* |
|
* This code places an Elementary file selector entry widget on a |
|
* window, along with some other checkboxes. Those are there just as |
|
* knobs on the file selector entry's state. |
|
* |
|
* Here's how we instantiate it: |
|
* @dontinclude fileselector_entry_example.c |
|
* @skip ic = elm_icon_add |
|
* @until evas_object_show |
|
* |
|
* Note that we set on it's button both icon and label |
|
* decorations. It's set to exhibit the path of (and list the contents |
|
* of, when internal file selector is launched) the @c "/tmp" |
|
* directory, also, with elm_fileselector_entry_path_set(). What |
|
* follows are checkboxes to exercise some of its API funtions: |
|
* @dontinclude fileselector_entry_example.c |
|
* @skip ck = elm_check_add |
|
* @until callback_add(fs_entry |
|
* |
|
* The checkboxes will toggle whether the file selector entry's |
|
* internal file selector: |
|
* - must have an editable text entry for file names (thus, be in |
|
* "save dialog mode") |
|
* - is to be raised as an "inner window" (note it's the default |
|
* behavior) or as a dedicated window |
|
* - is to populate its view with folders only |
|
* - is to expand its folders, in its view, <b>in place</b>, and not |
|
* repainting it entirely just with the contents of a sole |
|
* directory. |
|
* |
|
* Observe how the entry's text will match the string coming from the |
|
* @c "file,chosen" smart event: |
|
* @dontinclude fileselector_entry_example.c |
|
* @skip hook on the |
|
* @until } |
|
* Whenever you dismiss or acknowledges the file selector, after it's |
|
* raised, the @c event_info string will contain the last selection on |
|
* it (if any was made). |
|
* |
|
* Try, also, to type in a valid system path and, then, open the file |
|
* selector's window: it will start the file browsing there, for you. |
|
* |
|
* This is how the example, just after called, should look like: |
|
* |
|
* @image html screenshots/fileselector_entry_example_00.png |
|
* @image latex screenshots/fileselector_entry_example_00.eps width=\textwidth |
|
* |
|
* Click on the file selector entry to raise its internal file |
|
* selector, which will be contained on an <b>"inner window"</b>: |
|
* |
|
* @image html screenshots/fileselector_entry_example_01.png |
|
* @image latex screenshots/fileselector_entry_example_01.eps width=\textwidth |
|
* |
|