From 4517e70a5e4ba7c0fe9cb1ca622be6006766438d Mon Sep 17 00:00:00 2001 From: Luciana Magno de Almeida Date: Tue, 16 Dec 2014 19:04:43 -0200 Subject: [PATCH] cxx: Added examples and tutorial for C++ binding Summary: Added the following examples: * bg_cxx_example_01 * bg_cxx_example_02 * bubble_cxx_example_01 * button_cxx_example_00 * button_cxx_example_01 * calendar_cxx_example_01 * calendar_cxx_example_02 * calendar_cxx_example_03 * calendar_cxx_example_04 * calendar_cxx_example_05 * clock_cxx_example * datetime_cxx_example * glview_cxx_example_01 * hoversel_cxx_example_01 * icon_cxx_example_01 * location_cxx_example_01 * menu_cxx_example_01 * popup_cxx_example_01 * radio_cxx_example_01 * separator_cxx_example_01 * slider_cxx_example * spinner_cxx_example * table_cxx_example_01 * table_cxx_example_02 * thumb_cxx_example_01 Added documentation for the above examples, as well as how using lambdas with C++ elm binding. How to use autohide feature and how to use the C++ wrappers to create windows, widgets and call Eo functions from them with automatic C++ type conversion and how to use signals from C++. --- .../elementary/Makefile_Eolian_Cxx_Helper.am | 12 +- legacy/elementary/configure.ac | 9 +- legacy/elementary/doc/Doxyfile.in | 2 +- legacy/elementary/doc/examples-cxx.dox | 5332 +++++++++++++++++ legacy/elementary/doc/examples.dox | 1 + legacy/elementary/src/examples/.gitignore | 35 + legacy/elementary/src/examples/Makefile.am | 111 +- .../src/examples/bg_cxx_example_01.cc | 23 + .../src/examples/bg_cxx_example_02.cc | 33 + .../src/examples/box_cxx_example_02.cc | 244 +- .../src/examples/bubble_cxx_example_01.cc | 62 + .../src/examples/button_cxx_example_00.cc | 35 + .../src/examples/button_cxx_example_01.cc | 233 + .../src/examples/calendar_cxx_example_01.cc | 21 + .../src/examples/calendar_cxx_example_02.cc | 38 + .../src/examples/calendar_cxx_example_03.cc | 23 + .../src/examples/calendar_cxx_example_04.cc | 43 + .../src/examples/calendar_cxx_example_05.cc | 50 + .../src/examples/clock_cxx_example.cc | 53 + .../src/examples/datetime_cxx_example.cc | 51 + .../src/examples/glview_cxx_example_01.cc | 263 + .../src/examples/hoversel_cxx_example_01.cc | 84 + .../src/examples/icon_cxx_example_01.cc | 38 + .../src/examples/location_cxx_example_01.cc | 82 + .../src/examples/menu_cxx_example_01.cc | 69 + .../src/examples/popup_cxx_example_01.cc | 32 + .../src/examples/radio_cxx_example_01.cc | 79 + .../src/examples/separator_cxx_example_01.cc | 51 + .../src/examples/slider_cxx_example.cc | 109 + .../src/examples/spinner_cxx_example.cc | 95 + .../src/examples/table_cxx_example_01.cc | 43 + .../src/examples/table_cxx_example_02.cc | 46 + .../src/examples/thumb_cxx_example_01.cc | 48 + legacy/elementary/src/lib/.gitignore | 2 + legacy/elementary/src/lib/Elementary.hh.in | 146 + legacy/elementary/src/lib/Makefile.am | 127 +- legacy/elementary/src/tests/.gitignore | 3 + legacy/elementary/src/tests/elm_cxx_suite.cc | 122 +- 38 files changed, 7428 insertions(+), 422 deletions(-) create mode 100644 legacy/elementary/doc/examples-cxx.dox create mode 100644 legacy/elementary/src/examples/bg_cxx_example_01.cc create mode 100644 legacy/elementary/src/examples/bg_cxx_example_02.cc create mode 100644 legacy/elementary/src/examples/bubble_cxx_example_01.cc create mode 100644 legacy/elementary/src/examples/button_cxx_example_00.cc create mode 100644 legacy/elementary/src/examples/button_cxx_example_01.cc create mode 100644 legacy/elementary/src/examples/calendar_cxx_example_01.cc create mode 100644 legacy/elementary/src/examples/calendar_cxx_example_02.cc create mode 100644 legacy/elementary/src/examples/calendar_cxx_example_03.cc create mode 100644 legacy/elementary/src/examples/calendar_cxx_example_04.cc create mode 100644 legacy/elementary/src/examples/calendar_cxx_example_05.cc create mode 100644 legacy/elementary/src/examples/clock_cxx_example.cc create mode 100644 legacy/elementary/src/examples/datetime_cxx_example.cc create mode 100644 legacy/elementary/src/examples/glview_cxx_example_01.cc create mode 100644 legacy/elementary/src/examples/hoversel_cxx_example_01.cc create mode 100644 legacy/elementary/src/examples/icon_cxx_example_01.cc create mode 100644 legacy/elementary/src/examples/location_cxx_example_01.cc create mode 100644 legacy/elementary/src/examples/menu_cxx_example_01.cc create mode 100644 legacy/elementary/src/examples/popup_cxx_example_01.cc create mode 100644 legacy/elementary/src/examples/radio_cxx_example_01.cc create mode 100644 legacy/elementary/src/examples/separator_cxx_example_01.cc create mode 100644 legacy/elementary/src/examples/slider_cxx_example.cc create mode 100644 legacy/elementary/src/examples/spinner_cxx_example.cc create mode 100644 legacy/elementary/src/examples/table_cxx_example_01.cc create mode 100644 legacy/elementary/src/examples/table_cxx_example_02.cc create mode 100644 legacy/elementary/src/examples/thumb_cxx_example_01.cc create mode 100644 legacy/elementary/src/lib/Elementary.hh.in diff --git a/legacy/elementary/Makefile_Eolian_Cxx_Helper.am b/legacy/elementary/Makefile_Eolian_Cxx_Helper.am index 978a892754..8b792e012c 100644 --- a/legacy/elementary/Makefile_Eolian_Cxx_Helper.am +++ b/legacy/elementary/Makefile_Eolian_Cxx_Helper.am @@ -1,11 +1,6 @@ -if HAVE_EOLIAN_CXX EOLIAN_CXX = @eolian_cxx@ _EOLIAN_CXX_DEP = @eolian_cxx@ -else -EOLIAN_CXX = EFL_RUN_IN_TREE=1 $(top_builddir)/src/bin/eolian_cxx/eolian_cxx${EXEEXT} -_EOLIAN_CXX_DEP = bin/eolian_cxx/eolian_cxx${EXEEXT} -endif AM_V_EOLCXX = $(am__v_EOLCXX_@AM_V@) am__v_EOLCXX_ = $(am__v_EOLCXX_@AM_DEFAULT_V@) @@ -13,6 +8,7 @@ am__v_EOLCXX_0 = @echo " EOLCXX " $@; SUFFIXES += .eo.hh -%.eo.hh: %.eo $(_EOLIAN_CXX_DEP) - $(AM_V_EOLCXX)$(EOLIAN_CXX) $(EOLIAN_FLAGS) -o $@ $< - +%.eo.impl.hh %.eo.hh: %.eo $(_EOLIAN_CXX_DEP) + $(AM_V_EOLCXX) \ + $(MKDIR_P) $(dir $@); \ + $(EOLIAN_CXX) $(EOLIAN_FLAGS) -o $@ $< diff --git a/legacy/elementary/configure.ac b/legacy/elementary/configure.ac index c016849c7d..3287329cad 100644 --- a/legacy/elementary/configure.ac +++ b/legacy/elementary/configure.ac @@ -31,10 +31,10 @@ EFL_INIT # C++ bindings AC_ARG_ENABLE([cxx-bindings], - [AS_HELP_STRING([--enable-cxx-bindings], - [enable C++11 bindings. @<:@default=disabled@:>@])], + [AS_HELP_STRING([--disable-cxx-bindings], + [Disable C++11 bindings. @<:@default=enabled@:>@])], [want_cxx11="${enableval}"], - [want_cxx11="no"]) + [want_cxx11="yes"]) # Tests @@ -271,6 +271,7 @@ if test "x${HAVE_CXX11}" = "x1" -a "x${want_cxx11}" = "xyes"; then eina-cxx >= efl_version evas-cxx >= efl_version eio-cxx >= efl_version + edje-cxx >= efl_version ], [ requirement_elm_pc="${requirement_elm_pc} \ @@ -279,10 +280,12 @@ if test "x${HAVE_CXX11}" = "x1" -a "x${want_cxx11}" = "xyes"; then eina-cxx >= efl_version \ evas-cxx >= efl_version \ eio-cxx >= efl_version \ + edje-cxx >= efl_version \ " have_cxx11="yes" LDFLAGS="${LDFLAGS} -fPIC -DPIC" CXXFLAGS="${CXXFLAGS} -fPIC -DPIC" + AC_CONFIG_FILES([src/lib/Elementary.hh]) ], [have_cxx11="no"] ) diff --git a/legacy/elementary/doc/Doxyfile.in b/legacy/elementary/doc/Doxyfile.in index 72133cd68c..7c0e86a619 100644 --- a/legacy/elementary/doc/Doxyfile.in +++ b/legacy/elementary/doc/Doxyfile.in @@ -1,7 +1,7 @@ PROJECT_NAME = Elementary PROJECT_NUMBER = @PACKAGE_VERSION@ OUTPUT_DIRECTORY = . -INPUT = @srcdir@/examples.dox @top_srcdir@/src/lib @srcdir@/index.doxy @top_srcdir@/src/bin/elm_prefs_cc_handlers.c +INPUT = @srcdir@/examples.dox @srcdir@/examples-cxx.dox @top_srcdir@/src/lib @srcdir@/index.doxy @top_srcdir@/src/bin/elm_prefs_cc_handlers.c IMAGE_PATH = @srcdir@/img OUTPUT_LANGUAGE = English GENERATE_HTML = YES diff --git a/legacy/elementary/doc/examples-cxx.dox b/legacy/elementary/doc/examples-cxx.dox new file mode 100644 index 0000000000..7b45ed9ff4 --- /dev/null +++ b/legacy/elementary/doc/examples-cxx.dox @@ -0,0 +1,5332 @@ +/** + * @page Examples-cxx Examples with C++ Bindings. + * + * Here is a list of Elementary C++ Examples. + * + * @ref bg_cxx_example_01 + * + * @ref bg_cxx_example_02 + * + * @ref bubble_cxx_example_01 + * + * @ref button_cxx_example_00 + * + * @ref button_cxx_example_01 + * + * @ref calendar_cxx_example_01 + * + * @ref calendar_cxx_example_02 + * + * @ref calendar_cxx_example_03 + * + * @ref calendar_cxx_example_04 + * + * @ref calendar_cxx_example_05 + * + * @ref clock_cxx_example + * + * @ref datetime_cxx_example + * + * @ref glview_cxx_example_01 + * + * @ref hoversel_cxx_example_01 + * + * @ref icon_cxx_example_01 + * + * @ref location_cxx_example_01 + * + * @ref menu_cxx_example_01 + * + * @ref popup_cxx_example_01 + * + * @ref radio_cxx_example_01 + * + * @ref separator_cxx_example_01 + * + * @ref slider_cxx_example + * + * @ref spinner_cxx_example + * + * @ref table_cxx_example_01 + * + * @ref table_cxx_example_02 + * + * @ref thumb_cxx_example_01 + * + */ + +/** + * @page lambda Lambda Functions with Elementary - C++11 + + * With this tutorial we'll give you a better view of how the lambda + * function can and will be constantly use in the C++ bindings. For a + * more broad aproach you should do a little web research. + + * The syntax adopted for these examples: + + * @c [capture] @c (parameters) @c {body} + + * @a capture: Determinate how and if the capture occurs. Possible + * indicators, two or more should be intercalated by commas: + + * @li [ ] - Capture nothing + + * @li [&] - Capture variables by reference + + * @li [=] - Capture variables by copy + + * @li [&a, b] - Capture only @a a by reference and only + * @a b by copy + + * @li [&, a] - Capture variables by reference and only @a a + * by copy + + * @li [this] - Capture @c this pointer by copy + + * @a parameters: List of parameters necessary for each specific + * lambda function. + + * @a body: Function body + + * Let's start with a more simple lambda and later a more complex one, + * all extracted from elementary examples: + + * First Example - @ref button_cxx_example_00 : + + * @image html screenshots/button_cxx_example_00.png + * @image latex screenshots/button_cxx_example_00.eps width=\textwidth + + * @dontinclude button_cxx_example_00.cc + * @skipline btn + * @skip auto + * @until clicked_add + + * In this example we use a @a lambda function for elm::button + * btn that will be called when that button is clicked in + * callback_clicked_add( on_click ). This lambda will then ask to exit + * Elementary's main loop with @a elm_exit(). If this call is issued, + * it will flag the main loop to cease processing and return back to + * its parent function, usually your elm_main() function. + + * Now let's analize the sintax used for this lambda: + + * With @a [] we are signaling that we don't want to capture any + * variables and with @a () we are indicating that this lambda doesn't + * need parameters to work as it should. Now the important part of this + * function it's the @a body represented by @a {} where we are applying + * elm_exit() everytime this lambda is called. + + * In this case we are using @a std::bind to bind the parameters of + * our lambda function to return as @a std::function object to + * on_click which was declare as auto. + + * For this example with std::bind we simplified our work simply + * because we didn't have to search in the code or documentation of + * Elementary to look for the parameters and/or values that the + * callback_clicked_add requires of the function we are adding. + + * Second Example - @ref hoversel_cxx_example_01 : + + * @image html screenshots/hoversel_cxx_example_01.png + * @image latex screenshots/hoverse_cxx_example_01.eps width=\textwidth + + * @dontinclude hoversel_cxx_example_01.cc + * @skip add_item + * @until clicked_add + + * In this example we use a @a lambda function for @a hoversel that + * will be called when that hoversel is clicked in + * callback_clicked_add( add_item ). This lambda will then add an item + * to heversel, note that since we allocate memory for the item we + * need to know when the item dies so we can free that memory. + + * Now let's analize the sintax used for this lambda: + + * @li @a [] : signaling that we don't want to capture any + * variables + + * @li @a (::elm::hoversel obj ) : indicating that this lambda needs + * the parameter @p obj to work as it should. Bbecause we are only + * adding the parameter we need instead of all the parameters this + * callback requires we need to use placeholders in std::bind, + * indicating the place that @obj should occupy in our + * callback_clicked_add. + + * When the function object returned by bind is called, an argument + * with placeholder _1 is replaced by the first argument in the call, + * _2 is replaced by the second argument in the call, and so on. + + * @li @a body represented by @a {} where we are adding ervery + * function and local variables that will be needed. + + * In this case we are using @a std::bind to bind the parameters of + * our lambda function to return as @a std::function object to + * add_item which was declare as auto. + + * @see Consult all examples from elementary with C++ Bindings @ref + * Examples-cxx "here" + */ + +/** + * @page bg_cxx_example_01 elm::bg - Plain color background with C++ binding + * @dontinclude bg_cxx_example_01.cc + + * This example just sets a default background with a plain color. + + * The first part consists of including the headers. In this case we + * are only working with the Elementary C++ binding and thus we need + * only to include him. + + * @skipline Elementary.hh + + * @attention If necessary the C and/or the C++ headers should be + * include here as well. + + * Now we need to actually start the code and set the elm_policy, + * which defines for a given policy group/identifier a new policy's + * value, respectively. In this example the only policy we need to + * set a value for is @c ELM_POLICY_QUIT, possibles values for it are: + + * @li @p ELM_POLICY_QUIT_NONE: Never quit the application + * automatically; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the + * application's last window is closed; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the + * application's last window is hidden; + + * @skip EAPI_MAIN + * @until elm_policy_set + + * As you can see, the policy we chose was to quit when the last win + * is hidden as opose to examples with the C bindings where we + * perpetually set it to quit when last win was closed. This changed + * was necessary because in C++ binding as the elm mainloop stop + * running all object are destroyed, references are unreferenced and + * events are stopped at ELM_MAIN(). + + * @see For more details consult elm_policy_set + + * Next step is creating an Elementary window, where win calls a + * constructor and sets the type of the win to ELM_WIN_BASIC + * (Elm_Win_Type), which is the indicated type for most of our + * examples. Here we also set the title that will appear at the top of + * our window and then the autohide state for it. + + * The autohide works similarly to @p autodel, automatically handling + * "delete,request" signals when set to @p true, with the difference + * that it will hide the window, instead of destroying it. + + * It is specially designed to work together with @p + * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting + * Elementary's main loop when all the windows are hidden. + + * @skip ::elm::win + * @until autohide_set + + * @note @p autodel and @a autohide are not mutually exclusive. The + * window will be destructed if both autodel and autohide is set to @p + * EINA_TRUE or @p true. + + * Now we construct the elm background and for this we use the C++ + * method below, setting it's parent. + + * @skipline ::elm::bg + + * To better understand, the function @c size_hint_weight_set for C++ + * bindings originated from C bindings function + * evas_object_size_hint_weight_set, that is EFL Evas type function. + * With this function we set the hints for an object's weight. The + * parameters are: + + * @li x - Nonnegative double value to use as horizontal weight hint. + + * @li y - Nonnegative double value to use as vertical weight hint. + + * This is not a size enforcement in any way, it's just a hint that + * should be used whenever appropriate. This is a hint on how a + * container object should resize a given child within its area. + + * Containers may adhere to the simpler logic of just expanding the + * child object's dimensions to fit its own (see the EVAS_HINT_EXPAND + * helper weight macro in the EFL Evas Documentation) or the complete + * one of taking each child's weight hint as real weights to how much + * of its size to allocate for them in each axis. A container is + * supposed to, after normalizing the weights of its children (with + * weight hints), distribute the space it has to layout them by those + * factors – most weighted children get larger in this process than + * the least ones. + + * @skipline weight_set + + * @note Default weight hint values are 0.0, for both axis. + + * Now we add the background as a resize_object to win informing that + * when the size of the win changes so should the background's + * size. And finally we make it visible. + + * @skip win + * @until visibility_set + + * @remarks If a color it's not setted the default color will be used. + + * Now we set the size for the window, making it visible in the end. + + * @skip size_set + * @until visibility_set + + * Finally we just have to start the elm mainloop, starting to handle + * events and drawing operations. + + * @skip elm_run + * @until ELM_MAIN + + * The full code for this example can be found at @ref + * bg_cxx_example_01.cc . + + * @example bg_cxx_example_01.cc +*/ + +/** + * @page bg_cxx_example_02 elm::bg - Image background using C++ binding + * @dontinclude bg_cxx_example_02.cc + + * This is the second background example and shows how to use the + * Elementary background object to set an image as background of your + * application. + + * The first part consists of including the headers. In this case we + * are only working with the Elementary C++ binding and thus we need + * only to include him. + + * @skipline Elementary.hh + + * @attention If necessary the C and/or the C++ headers should be + * include here as well. + + * Now we need to actually start the code and set the elm_policy, + * which defines for a given policy group/identifier a new policy's + * value, respectively. In this example the only policy we need to + * set a value for is @c ELM_POLICY_QUIT, possibles values for it are: + + * @li @p ELM_POLICY_QUIT_NONE: Never quit the application + * automatically; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the + * application's last window is closed; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the + * application's last window is hidden; + + * @skip EAPI_MAIN + * @until elm_policy_set + + * As you can see, the policy we chose was to quit when the last win + * is hidden as opose to examples with the C bindings where we + * perpetually set it to quit when last win was closed. This changed + * was necessary because in C++ binding as the elm mainloop stop + * running all object are destroyed, references are unreferenced and + * events are stopped at ELM_MAIN(). + + * @see For more details consult elm_policy_set + + * Next step is creating an Elementary window, where win calls a + * constructor and sets the type of the win to ELM_WIN_BASIC + * (Elm_Win_Type), which is the indicated type for most of our + * examples. Here we also set the title that will appear at the top of + * our window and then the autohide state for it. + + * The autohide works similarly to @p autodel, automatically handling + * "delete,request" signals when set to @p true, with the difference + * that it will hide the window, instead of destroying it. + + * It is specially designed to work together with @p + * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting + * Elementary's main loop when all the windows are hidden. + + * @skip ::elm::win + * @until autohide_set + + * @note @p autodel and @a autohide are not mutually exclusive. The + * window will be destructed if both autodel and autohide is set to @p + * EINA_TRUE or @p true. + + * Our background will have an image, that will be displayed over the + * background color. + + * To do so, first we set the directory and archive for the image. And + * create the background that will display it. + + * @skip elm_app_info_set + * @until ::elm::bg + + * Before loading this 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 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 std::stringstream. Then we use this stringstream to set + * the file name in the background object: + + * @skip std::stringstream + * @until file_set + + * Notice that the second argument of the file_set() function is @c + * nullptr, since we are setting an image to this background. This + * function also supports setting an Eet file as background, in which + * case the @c key parameter wouldn't be @c nullptr, but be the name + * of the Eet key instead. + + * To better understand, the function @c size_hint_weight_set for C++ + * bindings originated from C bindings function + * evas_object_size_hint_weight_set, that is EFL Evas type function. + * With this function we set the hints for an object's weight. The + * parameters are: + + * @li x - Nonnegative double value to use as horizontal weight hint. + + * @li y - Nonnegative double value to use as vertical weight hint. + + * This is not a size enforcement in any way, it's just a hint that + * should be used whenever appropriate. + + * This is a hint on how a container object should resize a given + * child within its area. + + * Containers may adhere to the simpler logic of just expanding the + * child object's dimensions to fit its own (see the EVAS_HINT_EXPAND + * helper weight macro in the EFL Evas Documentation) or the complete + * one of taking each child's weight hint as real weights to how much + * of its size to allocate for them in each axis. A container is + * supposed to, after normalizing the weights of its children (with + * weight hints), distribute the space it has to layout them by those + * factors – most weighted children get larger in this process than + * the least ones. + + * @skipline weight_set + + * @note Default weight hint values are 0.0, for both axis. + + * Now we add the background as a resize_object to win informing that + * when the size of the win changes so should the background's + * size. And finally we make background. + + * @skip win + * @until visibility + + * Now we only have to set the size for our window and make it + * visible. + + * @skip size_set + * @until visibility_set + + * Finally we just have to start the elm mainloop, starting to handle + * events and drawing operations. + + * @skip elm_run + * @until ELM_MAIN + + * The full code for this example can be found at @ref + * bg_cxx_example_02.cc . + + * This example will look like this: + + * @image html screenshots/bg_cxx_example_02.png + * @image latex screenshots/bg_cxx_example_02.eps width=\textwidth + * @example bg_cxx_example_02.cc + */ + +/** + * @page bubble_cxx_example_01 elm::bubble - Simple use with C++ binding + * @dontinclude bubble_cxx_example_01.cc + + * This example shows a bubble with all fields set - label, info, + * content and icon - and the selected corner changing when the bubble + * is clicked. + + * The first part consists of including the headers. In this case we + * are working with the Elementary and Evas C++ bindings and thus we + * need only to include them. + + * @skip Elementary + * @untilt Evas + + * @attention If necessary the C and/or the C++ headers should be + * include here as well. + + * Now we need to actually start the code and set the elm_policy, + * which defines for a given policy group/identifier a new policy's + * value, respectively. In this example the only policy we need to + * set a value for is @c ELM_POLICY_QUIT, possibles values for it are: + + * @li @p ELM_POLICY_QUIT_NONE: Never quit the application + * automatically; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the + * application's last window is closed; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the + * application's last window is hidden; + + * @skip EAPI_MAIN + * @until elm_policy_set + + * As you can see, the policy we chose was to quit when the last win + * is hidden as opose to examples with the C bindings where we + * perpetually set it to quit when last win was closed. This changed + * was necessary because in C++ binding as the elm mainloop stop + * running all object are destroyed, references are unreferenced and + * events are stopped at ELM_MAIN(). + + * @see For more details consult elm_policy_set + + * Next step is creating an Elementary window, where win calls a + * constructor and sets the type of the win to ELM_WIN_BASIC + * (Elm_Win_Type), which is the indicated type for most of our + * examples. Here we also set the title that will appear at the top of + * our window and then the autohide state for it. + + * The autohide works similarly to @p autodel, automatically handling + * "delete,request" signals when set to @p true, with the difference + * that it will hide the window, instead of destroying it. + + * It is specially designed to work together with @p + * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting + * Elementary's main loop when all the windows are hidden. + + * @skip ::elm::win + * @until autohide_set + + * @note @p autodel and @a autohide are not mutually exclusive. The + * window will be destructed if both autodel and autohide is set to @p + * EINA_TRUE or @p true. + + * Now we construct the elm background using the C++ method below, + * setting it's parent. + + * @skipline elm::bg + + * To better understand, the function @c size_hint_weight_set for C++ + * bindings originated from C bindings function + * evas_object_size_hint_weight_set, that is EFL Evas type function. + * With this function we set the hints for an object's weight. + + * The parameters are: + + * @li x - Nonnegative double value to use as horizontal weight hint. + + * @li y - Nonnegative double value to use as vertical weight hint. + + * This is not a size enforcement in any way, it's just a hint that + * should be used whenever appropriate. + + * This is a hint on how a container object should resize a given + * child within its area. + + * Containers may adhere to the simpler logic of just expanding the + * child object's dimensions to fit its own (see the EVAS_HINT_EXPAND + * helper weight macro in the EFL Evas Documentation) or the complete + * one of taking each child's weight hint as real weights to how much + * of its size to allocate for them in each axis. A container is + * supposed to, after normalizing the weights of its children (with + * weight hints), distribute the space it has to layout them by those + * factors – most weighted children get larger in this process than + * the least ones. + + * @skipline weight_set + + * @note Default weight hint values are 0.0, for both axis. + + * Now we add the background as a resize_object to win informing that + * when the size of the win changes so should the background's + * size. And finally we make it visible. + + * @skip resize + * @until visibility_set + + * @note If a color it's not setted the standard color will be used. + + * Here we are creating an elm::label that is going to be used as the + * content for our bubble: + + * @skip elm::label + * @until visibility_set + + * Despite it's name the bubble's icon in this case it's actually + * evas::rectangle, that we set it's color to blue and at the end make + * it visible. + + * @skip evas::rectangle + * @until visibility_set + + * And finally we have the actual bubble creation and the setting of + * it's label, info and content: + + * @skip elm::bubble + * @until visibility_set + + * @remark Because we didn't set a corner, the default "top_left" will be used. + + * To have the selected corner change in a clockwise motion we are going to + * use the following callback using lambda: + + * @skip auto + * @until }); + + * @see To learn more about consult @ref lambda. + + * Now that we have our bubble and callback all that is left is adding our + * lambda as a clicked callback: + + * @line callback_clicked_add + + * 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: + + * @skip label2 + * @until bubble2.visibility_set + + * Now we only have to set the size for our window and make it + * visible. + + * @skip size_set + * @until visibility_set + + * And finally, start the elm mainloop, starting to handle events and + * drawing operations. + + * @skip elm_run + * @until ELM_MAIN + + * Our example will look like this: + + * @image html screenshots/bubble_cxx_example_01.png + * @image latex screenshots/bubble_cxx_example_01.eps width=\textwidth + + * @see Full source code @ref bubble_cxx_example_01.cc . + + * @example bubble_cxx_example_01.cc + */ + +/** + * @page button_cxx_example_00 Button - Hello, Button! + * @dontinclude button_cxx_example_00.cc + + * Keeping the tradition, this is a simple "Hello, World" button + * example. We will show how to create a button and associate an + * action to be performed when you click on it. + + * The first part consists of including the headers. In this case we + * are only working with the Elementary C++ binding and thus we need + * only to include him. + + * @skipline Elementary.hh + + * @attention If necessary the C and/or the C++ headers should be + * include here as well. + + * Now we need to actually start the code and set the elm_policy, + * which defines for a given policy group/identifier a new policy's + * value, respectively. In this example the only policy we need to + * set a value for is @c ELM_POLICY_QUIT, possibles values for it are: + + * @li @p ELM_POLICY_QUIT_NONE: Never quit the application + * automatically; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the + * application's last window is closed; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the + * application's last window is hidden; + + * @skip EAPI_MAIN + * @until elm_policy_set + + * As you can see, the policy we chose was to quit when the last win + * is hidden as opose to examples with the C bindings where we + * perpetually set it to quit when last win was closed. This changed + * was necessary because in C++ binding as the elm mainloop stop + * running all object are destroyed, references are unreferenced and + * events are stopped at ELM_MAIN(). + + * @see For more details consult elm_policy_set + + * Next step is creating an Elementary window, where win calls a + * constructor and sets the type of the win to ELM_WIN_BASIC + * (Elm_Win_Type), which is the indicated type for most of our + * examples. Here we also set the title that will appear at the top of + * our window and then the autohide state for it. + + * The autohide works similarly to @p autodel, automatically handling + * "delete,request" signals when set to @p true, with the difference + * that it will hide the window, instead of destroying it. + + * It is specially designed to work together with @p + * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting + * Elementary's main loop when all the windows are hidden. + + * @skip ::elm::win + * @until autohide_set + + * @note @p autodel and @a autohide are not mutually exclusive. The + * window will be destructed if both autodel and autohide is set to @p + * EINA_TRUE or @p true. + + * Now we construct the elm background and for this we use the C++ + * method below, setting it's parent. + + * @skipline ::elm::bg + + * The function @c size_hint_weight_set for C++ bindings originated + * from C bindings function evas_object_size_hint_weight_set, that is + * EFL Evas type function. With this function we set the hints for an + * object's weight. The parameters are: + + * @li x - Nonnegative double value to use as horizontal weight hint. + + * @li y - Nonnegative double value to use as vertical weight hint. + + * This is not a size enforcement in any way, it's just a hint that + * should be used whenever appropriate. This is a hint on how a + * container object should resize a given child within its area. + + * Containers may adhere to the simpler logic of just expanding the + * child object's dimensions to fit its own (see the EVAS_HINT_EXPAND + * helper weight macro in the EFL Evas Documentation) or the complete + * one of taking each child's weight hint as real weights to how much + * of its size to allocate for them in each axis. A container is + * supposed to, after normalizing the weights of its children (with + * weight hints), distribute the space it has to layout them by those + * factors – most weighted children get larger in this process than + * the least ones. + + * @skipline weight_set + + * @note Default weight hint values are 0.0, for both axis. + + * Now we add the background as a resize_object to win informing that + * when the size of the win changes so should the background's + * size. And finally we make it visible. + + * @skip win + * @until visibility_set + + * @remarks If a color it's not setted the default color will be used. + + * There is only one button on this interface. We need to create this + * button with the C++ method, set the text to be displayed, the size, + * position and the size hint for weight. + + * @skip btn + * @until weight + + * For alignment we'll use the function @c size_hint_align_set for C++ + * bindings originated from C bindings function + * evas_object_size_hint_align_set, that is EFL Evas type + * function. With this function we set the hints for an object's + * alignment. The parameters are: + + * @li x - Double, ranging from 0.0 to 1.0 or with the special value + * EVAS_HINT_FILL, to use as horizontal alignment hint. + + * @li y - Double, ranging from 0.0 to 1.0 or with the special value + * EVAS_HINT_FILL, to use as vertical alignment hint. + + * These are hints on how to align an object inside the boundaries of + * a container/manager. Accepted values are in the 0.0 to 1.0 range, + * with the special value EVAS_HINT_FILL used to specify "justify" or + * "fill" by some users. In this case, maximum size hints should be + * enforced with higher priority, if they are set. Also, any padding + * hint set on objects should add up to the alignment space on the + * final scene composition. + + * For the horizontal component, 0.0 means to the left, 1.0 means to + * the right. Analogously, for the vertical component, 0.0 to the top, + * 1.0 means to the bottom. + + * This is not a size enforcement in any way, it's just a hint that + * should be used whenever appropriate. + + * @skipline align + + * @note Default alignment hint values are 0.5, for both axis. + + * Continuing with our button we make it visible. + + * @skipline visibility + + * This button performs a basic action: close the application. This + * behavior is described by on_click() which is a lambda function, + * that interrupt the program invoking elm_exit(). The lambda function + * on_click is the added as a clicked callback to btn. + + * @skip on_click + * @until callback + + * @see For more details consult @ref lambda + + * Now we set the size for the window, making it visible in the end: + + * @skip size_set + * @until visibility_set + + * Finally we just have to start the elm mainloop, starting to handle + * events and drawing operations. + + * @skip elm_run + * @until ELM_MAIN + + * The full code for this example can be found at @ref + * button_cxx_example_00.cc . + + * This example will look like this: + * @image html screenshots/button_cxx_example_00.png + * @image latex screenshots/button_cxx_example_00.eps width=\textwidth + * @example button_cxx_example_00.cc + */ + +/** + * @page button_cxx_example_01 Button - Complete example + * @dontinclude button_cxx_example_01.cc + + * 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. + + * The first part consists of including the headers. In this case we + * are only working with the Elementary C++ binding and thus we need + * only to include him. + + * @skipline Elementary.hh + + * @attention If necessary the C and/or the C++ headers should be + * include here as well. + + * Now we need to actually start the code and set the elm_policy, + * which defines for a given policy group/identifier a new policy's + * value, respectively. In this example the only policy we need to + * set a value for is @c ELM_POLICY_QUIT, possibles values for it are: + + * @li @p ELM_POLICY_QUIT_NONE: Never quit the application + * automatically; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the + * application's last window is closed; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the + * application's last window is hidden; + + * @skip EAPI_MAIN + * @until elm_policy_set + + * As you can see, the policy we chose was to quit when the last win + * is hidden as opose to examples with the C bindings where we + * perpetually set it to quit when last win was closed. This changed + * was necessary because in C++ binding as the elm mainloop stop + * running all object are destroyed, references are unreferenced and + * events are stopped at ELM_MAIN(). + + * @see For more details consult elm_policy_set + + * Next step is creating an Elementary window, in this example we use + * the C++ binding method with the elm_win_util_standard_add that is a + * elm_win_legacy function, better explained below. And then we set + * the autohide state for it. + + * @p elm_win_util_standard_add (const char *name, const char *tittle) + * Adds a window object with standard setup. + * Parameters: + + * @li @p name - The name of the window; + + * @li @p title - The title for the window. + + * This creates a window but also puts in a standard background with + * @p elm_bg_add(), as well as setting the window title to @p + * title. The window type created is of type @c ELM_WIN_BASIC, with + * the @c NULL as the parent widget. Returns the created object or @c + * NULL on failure. + + * The autohide works similarly to @p autodel, automatically handling + * "delete,request" signals when set to @p true, with the difference + * that it will hide the window, instead of destroying it. + + * It is specially designed to work together with @p + * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting + * Elementary's main loop when all the windows are hidden. + + * @skip ::elm::win + * @until autohide_set + + * @note @p autodel and @a autohide are not mutually exclusive. The + * window will be destructed if both autodel and autohide is set to @p + * EINA_TRUE or @p true. + + * In this example we'll have several buttons that will be arranged in + * two boxes that will be inserted in a bigger box. One of the smaller + * boxes will contain a set of buttons that will set different times + * for the autorepeat timeouts of the buttons that will be contained in + * the other smaller box. + + * For all this to work, we will construct the three smaller boxes and + * all the button that will be needed. The smaller boxes will be then + * packed in the bigger one. + + * In this part we'll create our directional buttons, that we'll be + * added in the third smaller box, this is necessary for our callback + * to work properly. + + * @skip icon + * @until right + + * Now let's create our bigger box using the C++ method and setting + * it's parent as win. + + * @skipline box + + * The function @c size_hint_weight_set for C++ bindings originated + * from C bindings function evas_object_size_hint_weight_set, that is + * EFL Evas type function. With this function we set the hints for an + * object's weight. The parameters are: + + * @li x - Nonnegative double value to use as horizontal weight hint. + + * @li y - Nonnegative double value to use as vertical weight hint. + + * This is not a size enforcement in any way, it's just a hint that + * should be used whenever appropriate. This is a hint on how a + * container object should resize a given child within its area. + + * Containers may adhere to the simpler logic of just expanding the + * child object's dimensions to fit its own (see the EVAS_HINT_EXPAND + * helper weight macro in the EFL Evas Documentation) or the complete + * one of taking each child's weight hint as real weights to how much + * of its size to allocate for them in each axis. A container is + * supposed to, after normalizing the weights of its children (with + * weight hints), distribute the space it has to layout them by those + * factors – most weighted children get larger in this process than + * the least ones. + + * @skipline weight_set + + * @note Default weight hint values are 0.0, for both axis. + + * Now we add the box as a resize_object to win informing that when + * the size of the win changes so should the box's size. And finally + * we make it visible. + + * @skip win + * @until visibility_set + + * Creating our initial box, again using the C++ method, in this case + * we want the arrangement of the objects, that this box will contain, + * to be displayed horizontally and fot this we will set horizontal to + * @p true, vertical by default. + + * @skip box + * @until horizontal + + * Again we'll set the size hint for weight, but in this box we will + * set the packing method to include this box inside the bigger one. + + * When using the elm box the packing method of the subobj - box in + * this case - should be defined. There are four possible methods: + + * @li @c pack_start(subobj_) - Add an object to the beginning of the + * pack list. Pack @c subobj_ into the box obj, placing it first in + * the list of children objects. The actual position the object will + * get on screen depends on the layout used. If no custom layout is + * set, it will be at the top or left, depending if the box is + * vertical or horizontal, respectively. + + * @li @c pack_end(subobj_) - Add an object at the end of the pack + * list. Pack @c subobj_ into the box obj, placing it last in the list + * of children objects. The actual position the object will get on + * screen depends on the layout used. If no custom layout is set, it + * will be at the bottom or right, depending if the box is vertical or + * horizontal, respectively. + + * @li @c pack_before(subobj_, before_) - Adds an object to the box + * before the indicated object. This will add the @c subobj_ to the + * box indicated before the object indicated with @c before_. If + * before is not already in the box, results are undefined. Before + * means either to the left of the indicated object or above it + * depending on orientation. + + * @li @c pack_after(subobj_, after_) - Adds an object to the box + * after the indicated object. This will add the @c subobj_ to the box + * indicated after the object indicated with @c after_. If after is + * not already in the box, results are undefined. After means either + * to the right of the indicated object or below it depending on + * orientation. + + * In this and most examples we use pack_end by choice and + * practicality. In this part of the code we also make calendar + * visible. + + * @skip pack_end + * @until visibility + + * Now let's start creating the buttons that will be included in this + * first small box, this will contain the initial timeout button. + + * We'll use again the C++ method to create this button, set a text, + * packing method for btn and finally make it visible. + + * @skip btn + * @until visibility + + * In this part we'll use Lambda type function that will be added in + * the clicked callback for all buttons in the first smaller box, + * that'll identify the current initial and gap to be use in the + * autorepeat timeout that will move the central button. + + * @skip auto + * @until callback + + * @note To learn more about Lambda Function and its use in Elementary + * consult @ref lambda. + + * The second and third button will also set the initial timeout but + * with different values. + + * @skip btn2 + * @until btn3.callback + + * Now for our gap timeout buttons will create our second smaller box, + * the same way with the initial box, we'll use the C++ method, set to + * be horizontal, set the size hint weight, choose the packing method + * and set the visibility to true. + + * @skip box_gap + * @until visibility + + * For our gap buttons we'll again, use the C++ method, set the texts + * with the different values for gap, choose the packing method, set + * the visibility and the clicked callback. + + * @skip btn4 + * @until btn6.callback + + * Now we'll give our directional buttons more options so that it will + * visible and also have all the caracteristics that is require. + + * For the up button, we'll set to @p true the autorepeat, + * autorepeat_initial_timeout, autoreapet_gap_timeout, the size hints + * for weight and alignement, choose our packing method and making out + * up button visible. + + * @skip up + * @until visibility + + * For this directional buttons we'll have a diferent repeated + * callback that will insure the timeouts of our middle button in the + * gap and initial timeout that is current setted. + + * @skip auto + * @until + + * For our second callback, we'll detail the release of our + * directional buttons. + + * @skip auto + * @until callback + + * Finishing our up button, we'll create an icon, that'll will be the + * standard "arrow_up". + + * @skip icon + * @until content + + * This last box, will content all the directional buttons and the + * middle button. As before, we use the C++ method, horizontal set, + * weight and align hints, chose the packing method and make it + * visible. + + * @skip box + * @until visibility + + * Now we'll create all the directional and middle buttons, the same as we did with the up button, + * changing only the icon. + + * @skip left + * @until down.content + + * Now we set the size for the window, making it visible in the end: + + * @skip size_set + * @until visibility_set + + * Finally we just have to start the elm mainloop, starting to handle + * events and drawing operations. + + * @skip elm_run + * @until ELM_MAIN + + * The full code for this example can be found at @ref + * button_cxx_example_01.cc . + + * This example will look like this: + * @image html screenshots/button_cxx_example_01.png + * @image latex screenshots/button_cxx_example_01.eps width=\textwidth + * @example button_cxx_example_01.cc + */ + +/** + * @page calendar_cxx_example_01 Calendar - Simple creation with C++ binding + * @dontinclude calendar_cxx_example_01.cc + + * As a first example, let's just display a calendar in our window, + * explaining all steps required to do so. + + * The first part consists of including the headers. In this case we + * are only working with the Elementary C++ binding and thus we need + * only to include him. + + * @skipline Elementary.hh + + * @attention If necessary the C and/or the C++ headers should be + * include here as well. + + * Now we need to actually start the code and set the elm_policy, + * which defines for a given policy group/identifier a new policy's + * value, respectively. In this example the only policy we need to + * set a value for is @c ELM_POLICY_QUIT, possibles values for it are: + + * @li @p ELM_POLICY_QUIT_NONE: Never quit the application + * automatically; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the + * application's last window is closed; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the + * application's last window is hidden; + + * @skip EAPI_MAIN + * @until elm_policy_set + + * As you can see, the policy we chose was to quit when the last win + * is hidden as opose to examples with the C bindings where we + * perpetually set it to quit when last win was closed. This changed + * was necessary because in C++ binding as the elm mainloop stop + * running all object are destroyed, references are unreferenced and + * events are stopped at ELM_MAIN(). + + * @see For more details consult elm_policy_set + + * Next step is creating an Elementary window, in this example we use + * the C++ binding method with the elm_win_util_standard_add that is a + * elm_win_legacy function, better explained below. And then we set + * the autohide state for it. + + * @p elm_win_util_standard_add (const char *name, const char *tittle) + * Adds a window object with standard setup. + * Parameters: + + * @li @p name - The name of the window; + + * @li @p title - The title for the window. + + * This creates a window but also puts in a standard background with + * @p elm_bg_add(), as well as setting the window title to @p + * title. The window type created is of type @c ELM_WIN_BASIC, with + * the @c NULL as the parent widget. Returns the created object or @c + * NULL on failure. + + * The autohide works similarly to @p autodel, automatically handling + * "delete,request" signals when set to @p true, with the difference + * that it will hide the window, instead of destroying it. + + * It is specially designed to work together with @p + * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting + * Elementary's main loop when all the windows are hidden. + + * @skip ::elm::win + * @until autohide_set + + * @note @p autodel and @a autohide are not mutually exclusive. The + * window will be destructed if both autodel and autohide is set to @p + * EINA_TRUE or @p true. + + * Now, the exciting part, let's create the calendar with the C++ + * binding method, passing our window object as parent. + + * @skipline elm::calendar + + * The function @c size_hint_weight_set for C++ bindings originated + * from C bindings function evas_object_size_hint_weight_set, that is + * EFL Evas type function. With this function we set the hints for an + * object's weight. The parameters are: + + * @li x - Nonnegative double value to use as horizontal weight hint. + + * @li y - Nonnegative double value to use as vertical weight hint. + + * This is not a size enforcement in any way, it's just a hint that + * should be used whenever appropriate. This is a hint on how a + * container object should resize a given child within its area. + + * Containers may adhere to the simpler logic of just expanding the + * child object's dimensions to fit its own (see the EVAS_HINT_EXPAND + * helper weight macro in the EFL Evas Documentation) or the complete + * one of taking each child's weight hint as real weights to how much + * of its size to allocate for them in each axis. A container is + * supposed to, after normalizing the weights of its children (with + * weight hints), distribute the space it has to layout them by those + * factors – most weighted children get larger in this process than + * the least ones. + + * @skipline weight_set + + * @note Default weight hint values are 0.0, for both axis. + + * Now we add the calendar as a resize-object to win informing that + * when the size of the win changes so should the calendar's + * size. And finally we make it visible. + + * @skip win + * @until visibility + + * Finally we just have to start the elm mainloop, starting to handle + * events and drawing operations. + + * @skip elm_run + * @until ELM_MAIN + + * Our example will look like this: + + * @image html screenshots/calendar_cxx_example_01.png + + * @image latex screenshots/calendar_cxx_example_01.eps width=\textwidth + + * See the full source code @ref calendar_cxx_example_01.cc here. + + * @example calendar_cxx_example_01.cc + */ + +/** + * @page calendar_cxx_example_02 Calendar - Layout strings formatting with C++ binding + * @dontinclude calendar_cxx_example_02.cc + + * In this simple example, we'll explain how to format the labels + * displaying month and year, and also set weekday names. + + * The first part consists of including the headers. In this case we + * are only working with the Elementary C++ binding and thus we need + * only to include him. + + * @skipline Elementary.hh + + * @attention If necessary the C and/or the C++ headers should be + * include here as well. + + * Now we will jump to the actual code and later explain the function + * to make this tutorial more didactical. + + * We must set the elm_policy, which defines for a given policy + * group/identifier a new policy's value, respectively. In this + * example the only policy we need to set a value for is @c + * ELM_POLICY_QUIT, possibles values for it are: + + * @li @p ELM_POLICY_QUIT_NONE: Never quit the application + * automatically; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the + * application's last window is closed; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the + * application's last window is hidden; + + * @skip EAPI_MAIN + * @until elm_policy_set + + * As you can see, the policy we chose was to quit when the last win + * is hidden as opose to examples with the C bindings where we + * perpetually set it to quit when last win was closed. This changed + * was necessary because in C++ binding as the elm mainloop stop + * running all object are destroyed, references are unreferenced and + * events are stopped at ELM_MAIN(). + + * @see For more details consult elm_policy_set + + * Next step is creating an Elementary window, in this example we use + * the C++ binding method with the elm_win_util_standard_add that is a + * elm_win_legacy function, better explained below. And then we set + * the autohide state for it. + + * @p elm_win_util_standard_add (const char *name, const char *tittle) + * Adds a window object with standard setup. + * Parameters: + + * @li @p name - The name of the window; + + * @li @p title - The title for the window. + + * This creates a window but also puts in a standard background with + * @p elm_bg_add(), as well as setting the window title to @p + * title. The window type created is of type @c ELM_WIN_BASIC, with + * the @c NULL as the parent widget. Returns the created object or @c + * NULL on failure. + + * The autohide works similarly to @p autodel, automatically handling + * "delete,request" signals when set to @p true, with the difference + * that it will hide the window, instead of destroying it. + + * It is specially designed to work together with @p + * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting + * Elementary's main loop when all the windows are hidden. + + * @skip ::elm::win + * @until autohide_set + + * @note @p autodel and @a autohide are not mutually exclusive. The + * window will be destructed if both autodel and autohide is set to @p + * EINA_TRUE or @p true. + + * Now let's create the calendar with the C++ binding method, passing + * our window object as parent. + + * @skipline elm::calendar + + * The function @c size_hint_weight_set for C++ bindings originated + * from C bindings function evas_object_size_hint_weight_set, that is + * EFL Evas type function. With this function we set the hints for an + * object's weight. The parameters are: + + * @li x - Nonnegative double value to use as horizontal weight hint. + + * @li y - Nonnegative double value to use as vertical weight hint. + + * This is not a size enforcement in any way, it's just a hint that + * should be used whenever appropriate. This is a hint on how a + * container object should resize a given child within its area. + + * Containers may adhere to the simpler logic of just expanding the + * child object's dimensions to fit its own (see the EVAS_HINT_EXPAND + * helper weight macro in the EFL Evas Documentation) or the complete + * one of taking each child's weight hint as real weights to how much + * of its size to allocate for them in each axis. A container is + * supposed to, after normalizing the weights of its children (with + * weight hints), distribute the space it has to layout them by those + * factors – most weighted children get larger in this process than + * the least ones. + + * @skipline weight_set + + * @note Default weight hint values are 0.0, for both axis. + + * Now we add the calendar as a resize-object to win informing that + * when the size of the win changes so should the calendar's + * size. + + * @skipline win + + * To format month and year labels, we need to create a callback + * function to create a string given the selected time, declared under + * a struct tm . + + * struct tm , 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 @p _format_month_year , 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: + + * @dontinclude calendar_cxx_example_02.cc + * @skip 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 format_function_set + + * To set weekday names, we should declare them as an array of + * strings: + + * @dontinclude calendar_cxx_example_02.cc + * @skip weekdays[] + * @until } + + * And then set them to calendar: + * @skipline weekdays_names_set + + * Finally we just have to make the calendar and window visible and + * then start the elm mainloop, starting to handle events and drawing + * operations. + + * @skip visibility + * @until ELM_MAIN + + * Our example will look like this: + + * @image html screenshots/calendar_cxx_example_02.png + * @image latex screenshots/calendar_cxx_example_02.eps width=\textwidth + + * See the full source code @ref calendar_cxx_example_02.cc here. + * @example calendar_cxx_example_02.cc + */ + +/** + * @page calendar_cxx_example_03 Calendar - Years restrictions with C++ binding + * @dontinclude calendar_cxx_example_03.cc + + * 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. + + * The first part consists of including the headers. In this case we + * are only working with the Elementary C++ binding and thus we need + * only to include him. + + * @skipline Elementary.hh + + * @attention If necessary the C and/or the C++ headers should be + * include here as well. + + * Now we need to actually start the code and set the elm_policy, + * which defines for a given policy group/identifier a new policy's + * value, respectively. In this example the only policy we need to set + * a value for is @c ELM_POLICY_QUIT, possibles values for it are: + * function to make this tutorial more didactical. + + * @li @p ELM_POLICY_QUIT_NONE: Never quit the application + * automatically; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the + * application's last window is closed; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the + * application's last window is hidden; + + * @skip EAPI_MAIN + * @until elm_policy_set + + * As you can see, the policy we chose was to quit when the last win + * is hidden as opose to examples with the C bindings where we + * perpetually set it to quit when last win was closed. This changed + * was necessary because in C++ binding as the elm mainloop stop + * running all object are destroyed, references are unreferenced and + * events are stopped at ELM_MAIN(). + + * @see For more details consult elm_policy_set + + * Next step is creating an elementary window, in this example we use + * the C++ binding method with the elm_win_util_standard_add that is a + * elm_win_legacy function, better explained below. And then we set + * the autohide state for it. + + * @p elm_win_util_standard_add (const char *name, const char *tittle) + * Adds a window object with standard setup. + * Parameters: + + * @li @p name - The name of the window; + + * @li @p title - The title for the window. + + * This creates a window but also puts in a standard background with + * @p elm_bg_add(), as well as setting the window title to @p + * title. The window type created is of type @c ELM_WIN_BASIC, with + * the @c NULL as the parent widget. Returns the created object or @c + * NULL on failure. + + * The autohide works similarly to @p autodel, automatically handling + * "delete,request" signals when set to @p true, with the difference + * that it will hide the window, instead of destroying it. + + * It is specially designed to work together with @p + * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting + * Elementary's main loop when all the windows are hidden. + + * @skip ::elm::win + * @until autohide_set + + * @note @p autodel and @a autohide are not mutually exclusive. The + * window will be destructed if both autodel and autohide is set to @p + * EINA_TRUE or @p true. + + * Now let's create the calendar with the C++ binding method, passing + * our window object as parent. + + * @skipline elm::calendar + + * The function @c size_hint_weight_set for C++ bindings originated + * from C bindings function evas_object_size_hint_weight_set, that is + * EFL Evas type function. With this function we set the hints for an + * object's weight. The parameters are: + + * @li x - Nonnegative double value to use as horizontal weight hint. + + * @li y - Nonnegative double value to use as vertical weight hint. + + * This is not a size enforcement in any way, it's just a hint that + * should be used whenever appropriate. This is a hint on how a + * container object should resize a given child within its area. + + * Containers may adhere to the simpler logic of just expanding the + * child object's dimensions to fit its own (see the EVAS_HINT_EXPAND + * helper weight macro in the EFL Evas Documentation) or the complete + * one of taking each child's weight hint as real weights to how much + * of its size to allocate for them in each axis. A container is + * supposed to, after normalizing the weights of its children (with + * weight hints), distribute the space it has to layout them by those + * factors – most weighted children get larger in this process than + * the least ones. + + * @skipline weight_set + + * @note Default weight hint values are 0.0, for both axis. + + * Now we add the calendar as a resize-object to win informing that + * when the size of the win changes so should the calendar's + * size. + + * @skipline win + + * Straigh to the point, to set it is enough to call + * 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 min_max_year_set + + * Finally we just have to make the calendar and window visible and + * then start the elm mainloop, starting to handle events and drawing + * operations. + + * @skip visibility + * @until ELM_MAIN + + * Our example will look like this: + + * @image html screenshots/calendar_cxx_example_03.png + * @image latex screenshots/calendar_cxx_example_03.eps width=\textwidth + + * See the full source code @ref calendar_cxx_example_03.cc here. + + * @example calendar_cxx_example_03.cc + */ + +/** + * @page calendar_cxx_example_04 Calendar - Days selection with C++ binding. + * @dontinclude calendar_cxx_example_04.cc + + * 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. + + * The first part consists of including the headers. In this case we + * are only working with the Elementary C++ binding and thus we need + * only to include him. + + * @skipline Elementary.hh + + * @attention If necessary the C and/or the C++ headers should be + * include here as well. + + * Now we need to actually start the code and set the elm_policy, + * which defines for a given policy group/identifier a new policy's + * value, respectively. In this example the only policy we need to set + * a value for is @c ELM_POLICY_QUIT, possibles values for it are: + + * @li @p ELM_POLICY_QUIT_NONE: Never quit the application + * automatically; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the + * application's last window is closed; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the + * application's last window is hidden; + + * @skip EAPI_MAIN + * @until elm_policy_set + + * As you can see, the policy we chose was to quit when the last win + * is hidden as opose to examples with the C bindings where we + * perpetually set it to quit when last win was closed. This changed + * was necessary because in C++ binding as the elm mainloop stop + * running all object are destroyed, references are unreferenced and + * events are stopped at ELM_MAIN(). + + * @see For more details consult elm_policy_set + + * Next step is creating an elementary window, in this example we use + * the C++ binding method with the elm_win_util_standard_add that is a + * elm_win_legacy function, better explained below. And then we set + * the autohide state for it. + + * @p elm_win_util_standard_add (const char *name, const char *tittle) + * Adds a window object with standard setup. + * Parameters: + + * @li @p name - The name of the window; + + * @li @p title - The title for the window. + + * This creates a window but also puts in a standard background with + * @p elm_bg_add(), as well as setting the window title to @p + * title. The window type created is of type @c ELM_WIN_BASIC, with + * the @c NULL as the parent widget. Returns the created object or @c + * NULL on failure. + + * The autohide works similarly to @p autodel, automatically handling + * "delete,request" signals when set to @p true, with the difference + * that it will hide the window, instead of destroying it. + + * It is specially designed to work together with @p + * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting + * Elementary's main loop when all the windows are hidden. + + * @skip ::elm::win + * @until autohide_set + + * @note @p autodel and @a autohide are not mutually exclusive. The + * window will be destructed if both autodel and autohide is set to @p + * EINA_TRUE or @p true. + + * In this example we'll need to use a elm::box to layout the two + * calendars that'll be created. A box arranges objects in a linear + * fashion, governed by a layout function that defines the details of + * this arrangement. The box will use an internal function + * to set the layout to a single row, vertical by default. + + * Now let's create the box with the C++ binding method, passing + * our window object as parent. + + * @skipline elm::box + + * The function @c size_hint_weight_set for C++ bindings originated + * from C bindings function evas_object_size_hint_weight_set, that is + * EFL Evas type function. With this function we set the hints for an + * object's weight. The parameters are: + + * @li x - Nonnegative double value to use as horizontal weight hint. + + * @li y - Nonnegative double value to use as vertical weight hint. + + * This is not a size enforcement in any way, it's just a hint that + * should be used whenever appropriate. This is a hint on how a + * container object should resize a given child within its area. + + * Containers may adhere to the simpler logic of just expanding the + * child object's dimensions to fit its own (see the EVAS_HINT_EXPAND + * helper weight macro in the EFL Evas Documentation) or the complete + * one of taking each child's weight hint as real weights to how much + * of its size to allocate for them in each axis. A container is + * supposed to, after normalizing the weights of its children (with + * weight hints), distribute the space it has to layout them by those + * factors – most weighted children get larger in this process than + * the least ones. + + * @skipline weight_set + + * @note Default weight hint values are 0.0, for both axis. + + * Now we add the box as a resize-object to win informing that when + * the size of the win changes so should the box's size. Remember + * always to set the box visibility to true. + + * @skip win + * @until visibility + + * Now let's create the calendar with the C++ binding method, passing + * our window object as parent. The function size_hint_weight_set + * works with calendar the same way as with box, for more, search + * above. + + * @skip elm::calendar + * @until weight_set + + * The function @c size_hint_align_set for C++ bindings originated + * from C bindings function evas_object_size_hint_align_set, that is + * EFL Evas type function. With this function we set the hints for an + * object's alignment. The parameters are: + + * @li x - Double, ranging from 0.0 to 1.0 or with the special value + * EVAS_HINT_FILL, to use as horizontal alignment hint. + + * @li y - Double, ranging from 0.0 to 1.0 or with the special value + * EVAS_HINT_FILL, to use as vertical alignment hint. + + * These are hints on how to align an object inside the boundaries of + * a container/manager. Accepted values are in the 0.0 to 1.0 range, + * with the special value EVAS_HINT_FILL used to specify "justify" or + * "fill" by some users. In this case, maximum size hints should be + * enforced with higher priority, if they are set. Also, any padding + * hint set on objects should add up to the alignment space on the + * final scene composition. + + * For the horizontal component, 0.0 means to the left, 1.0 means to + * the right. Analogously, for the vertical component, 0.0 to the top, + * 1.0 means to the bottom. + + * This is not a size enforcement in any way, it's just a hint that + * should be used whenever appropriate. + + * @note Default alignment hint values are 0.5, for both axis. + + * @skipline align_set + + * 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 select_mode_set + + * When using the elm box the packing method of the subobj - calendar + * in this case - should be defined. There are four possible methods: + + * @li @c pack_start(subobj_) - Add an object to the beginning of the + * pack list. Pack @c subobj_ into the box obj, placing it first in + * the list of children objects. The actual position the object will + * get on screen depends on the layout used. If no custom layout is + * set, it will be at the top or left, depending if the box is + * vertical or horizontal, respectively. + + * @li @c pack_end(subobj_) - Add an object at the end of the pack + * list. Pack @c subobj_ into the box obj, placing it last in the list + * of children objects. The actual position the object will get on + * screen depends on the layout used. If no custom layout is set, it + * will be at the bottom or right, depending if the box is vertical or + * horizontal, respectively. + + * @li @c pack_before(subobj_, before_) - Adds an object to the box + * before the indicated object. This will add the @c subobj_ to the + * box indicated before the object indicated with @c before_. If + * before is not already in the box, results are undefined. Before + * means either to the left of the indicated object or above it + * depending on orientation. + + * @li @c pack_after(subobj_, after_) - Adds an object to the box + * after the indicated object. This will add the @c subobj_ to the box + * indicated after the object indicated with @c after_. If after is + * not already in the box, results are undefined. After means either + * to the right of the indicated object or below it depending on + * orientation. + + * In this and most examples we use pack_end by choice and + * practicality. In this part of the code we also make calendar + * visible. + + * @skip visibility + * @until pack_end + + * 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_cxx_example_04.cc + * @skipline SECS_DAY + + * As with the first calendar, we'll also construct cal2, set it's + * hint_weight and hint_align, make cal2 visible and choose the + * packing method. + + * @skip cal2 + * @until weight + * @skip visibility + * @until pack + + * Now let's select two days from current day: + + * @dontinclude calendar_cxx_example_04.cc + * @skip time(NULL) + * @until selected_time_set + + * Finally we just have to make window visible and then start the elm + * mainloop, starting to handle events and drawing operations. + + * @skip visibility + * @until ELM_MAIN + + * Our example will look like this: + + * @image html screenshots/calendar_cxx_example_04.png + * @image latex screenshots/calendar_cxx_example_04.eps width=\textwidth + + * See the full source code @ref calendar_cxx_example_04.cc here. + * @example calendar_cxx_example_04.cc + */ + +/** + * @page calendar_cxx_example_05 Calendar - Signal callback and getters with C++ binding. + * @dontinclude calendar_cxx_example_05.cc + + * 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. To be more didatical we'll start with the basics. + + * The first part consists of including the headers. In this case we + * are only working with the Elementary C++ binding and thus we need + * only to include him. + + * @skipline Elementary.hh + + * @attention If necessary the C and/or the C++ headers should be + * included here as well. + + * Now we need to actually start the code and set the elm_policy, + * which defines for a given policy group/identifier a new policy's + * value, respectively. In this example the only policy we need to set + * a value for is @c ELM_POLICY_QUIT, possibles values for it are: + * function to make this tutorial more didactical. + + * @li @p ELM_POLICY_QUIT_NONE: Never quit the application + * automatically; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the + * application's last window is closed; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the + * application's last window is hidden; + + * @skip EAPI_MAIN + * @until elm_policy_set + + * As you can see, the policy we chose was to quit when the last win + * is hidden as opose to examples with the C bindings where we + * perpetually set it to quit when last win was closed. This changed + * was necessary because in C++ binding as the elm mainloop stop + * running all object are destroyed, references are unreferenced and + * events are stopped at ELM_MAIN(). + + * @see For more details consult elm_policy_set + + * Next step is creating an elementary window, in this example we use + * the C++ binding method with the elm_win_util_standard_add that is a + * elm_win_legacy function, better explained below. And then we set + * the autohide state for it. + + * @p elm_win_util_standard_add (const char *name, const char *tittle) + * Adds a window object with standard setup. + * Parameters: + + * @li @p name - The name of the window; + + * @li @p title - The title for the window. + + * This creates a window but also puts in a standard background with + * @p elm_bg_add(), as well as setting the window title to @p + * title. The window type created is of type @c ELM_WIN_BASIC, with + * the @c NULL as the parent widget. Returns the created object or @c + * NULL on failure. + + * The autohide works similarly to @p autodel, automatically handling + * "delete,request" signals when set to @p true, with the difference + * that it will hide the window, instead of destroying it. + + * It is specially designed to work together with @p + * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting + * Elementary's main loop when all the windows are hidden. + + * @skip ::elm::win + * @until autohide_set + + * @note @p autodel and @a autohide are not mutually exclusive. The + * window will be destructed if both autodel and autohide is set to @p + * EINA_TRUE or @p true. + + * Now let's create the calendar with the C++ binding method, passing + * our window object as parent. + + * @skipline elm::calendar + + * The function @c size_hint_weight_set for C++ bindings originated + * from C bindings function evas_object_size_hint_weight_set, that is + * EFL Evas type function. With this function we set the hints for an + * object's weight. The parameters are: + + * @li x - Nonnegative double value to use as horizontal weight hint. + + * @li y - Nonnegative double value to use as vertical weight hint. + + * This is not a size enforcement in any way, it's just a hint that + * should be used whenever appropriate. This is a hint on how a + * container object should resize a given child within its area. + + * Containers may adhere to the simpler logic of just expanding the + * child object's dimensions to fit its own (see the EVAS_HINT_EXPAND + * helper weight macro in the EFL Evas Documentation) or the complete + * one of taking each child's weight hint as real weights to how much + * of its size to allocate for them in each axis. A container is + * supposed to, after normalizing the weights of its children (with + * weight hints), distribute the space it has to layout them by those + * factors – most weighted children get larger in this process than + * the least ones. + + * @skipline weight_set + + * @note Default weight hint values are 0.0, for both axis. + + * Now we add the calendar as a resize-object to win informing that + * when the size of the win changes so should the calendar's + * size. + + * Let's check our callback function, type lambda: + * @skip print_cal_info + * @until double interval; + + * To learn more about consult @ref lambda. + + * To get selected day, we need to call 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. + + * @skip selected_time_get + * @until return + + * Next we'll get information from calendar and place on declared + * vars: + + * @skip interval + * @until 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 with std::cout and finish the lambda + * function: + + * @skip std::cout + * @until std::placeholders::_1 + + * struct tm 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 callback_changed_add + + * Finally we just have to make calendar and window visibles and then + * start the elm mainloop, starting to handle events and drawing + * operations. + + * @skip visibility + * @until ELM_MAIN + + * Our example will look like this: + + * @image html screenshots/calendar_cxx_example_05.png + * @image latex screenshots/calendar_cxx_example_05.eps width=\textwidth + + * See the full source code @ref calendar_cxx_example_05.cc here. + * @example calendar_cxx_example_05.cc + */ + +/** + * @page clock_cxx_example Clock widget example wit C++ binding. + * @dontinclude clock_cxx_example.cc + + * This code places five Elementary clock widgets on a window, each of + * them exemplifying a part of the widget's API. Before explaining + * each clock to be more didatical let's start with the basics. + + * The first part consists of including the headers. In this + * case we are only working with the Elementary C++ binding and thus + * we need only to include him. + + * @skipline Elementary.hh + + * @attention If necessary the C and/or the C++ headers should be + * include here as well. + + * Now we need to actually start the code and set the elm_policy, + * which defines for a given policy group/identifier a new policy's + * value, respectively. In this example the only policy we need to + * set a value for is @c ELM_POLICY_QUIT, possibles values for it are: + + * @li @p ELM_POLICY_QUIT_NONE: Never quit the application + * automatically; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the + * application's last window is closed; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the + * application's last window is hidden; + + * @skip EAPI_MAIN + * @until elm_policy_set + + * As you can see, the policy we chose was to quit when the last win + * is hidden as opose to examples with the C bindings where we + * perpetually set it to quit when last win was closed. This changed + * was necessary because in C++ binding as the elm mainloop stop + * running all object are destroyed, references are unreferenced and + * events are stopped at ELM_MAIN(). + + * @see For more details consult elm_policy_set + + * Next step is creating an Elementary window, in this example we use + * the C++ binding method with the elm_win_util_standard_add that is a + * elm_win_legacy function, better explained below. And then we set + * the autohide state for it. + + * @p elm_win_util_standard_add (const char *name, const char *tittle) + * Adds a window object with standard setup. + * Parameters: + + * @li @p name - The name of the window; + + * @li @p title - The title for the window. + + * This creates a window but also puts in a standard background with + * @p elm_bg_add(), as well as setting the window title to @p + * title. The window type created is of type @c ELM_WIN_BASIC, with + * the @c NULL as the parent widget. Returns the created object or @c + * NULL on failure. + + * And we also set the autohide state for win, autohide works + * similarly to @p autodel, automatically handling "delete,request" + * signals when set to @p true, with the difference that it will hide + * the window, instead of destroying it. + + * It is specially designed to work together with @p + * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting + * Elementary's main loop when all the windows are hidden. + + * @skip ::elm::win + * @until autohide_set + + * @note @p autodel and @a autohide are not mutually exclusive. The + * window will be destructed if both autodel and autohide is set to @p + * EINA_TRUE or @p true. + + * @see For more details consult elm::win::autohide_set(). + + * A box arranges objects in a linear fashion, governed by a layout + * function that defines the details of this arrangement. The box will + * use an internal function to set the layout to a single row, + * vertical by default. + + * Now let's create the box with the C++ binding method, passing our + * window object as parent. + + * @skipline elm::box + + * To better understand, the function @c size_hint_weight_set for C++ + * bindings originated from C bindings function + * evas_object_size_hint_weight_set, that is EFL Evas type function. + * With this function we set the hints for an object's weight. The + * parameters are: + + * @li x - Nonnegative double value to use as horizontal weight hint. + + * @li y - Nonnegative double value to use as vertical weight hint. + + * This is not a size enforcement in any way, it's just a hint that + * should be used whenever appropriate. This is a hint on how a + * container object should resize a given child within its area. + + * Containers may adhere to the simpler logic of just expanding the + * child object's dimensions to fit its own (see the EVAS_HINT_EXPAND + * helper weight macro in the EFL Evas Documentation) or the complete + * one of taking each child's weight hint as real weights to how much + * of its size to allocate for them in each axis. A container is + * supposed to, after normalizing the weights of its children (with + * weight hints), distribute the space it has to layout them by those + * factors – most weighted children get larger in this process than + * the least ones. + + * @skipline weight_set + + * @note Default weight hint values are 0.0, for both axis. + + * Then we add the box as a resize-object to win informing that when + * the size of the win changes so should the box's size. Remember + * always to set the box visibility to true. + + * @skip win + * @until visibility + + * We create each clock with the C++ binding method, passing our + * window object as parent. The first of them is the pristine clock, + * using the defaults for a clock, which are military time with no + * seconds shown. + + * @skipline clock + + * When using the elm::box the packing method of the subobj - clock + * in this case - should be defined. There are four possible methods: + + * @li @c pack_start(subobj_) - Add an object to the beginning of the + * pack list. Pack @c subobj_ into the box obj, placing it first in + * the list of children objects. The actual position the object will + * get on screen depends on the layout used. If no custom layout is + * set, it will be at the top or left, depending if the box is + * vertical or horizontal, respectively. + + * @li @c pack_end(subobj_) - Add an object at the end of the pack + * list. Pack @c subobj_ into the box obj, placing it last in the list + * of children objects. The actual position the object will get on + * screen depends on the layout used. If no custom layout is set, it + * will be at the bottom or right, depending if the box is vertical or + * horizontal, respectively. + + * @li @c pack_before(subobj_, before_) - Adds an object to the box + * before the indicated object. This will add the @c subobj_ to the + * box indicated before the object indicated with @c before_. If + * before is not already in the box, results are undefined. Before + * means either to the left of the indicated object or above it + * depending on orientation. + + * @li @c pack_after(subobj_, after_) - Adds an object to the box + * after the indicated object. This will add the @c subobj_ to the box + * indicated after the object indicated with @c after_. If after is + * not already in the box, results are undefined. After means either + * to the right of the indicated object or below it depending on + * orientation. + + * In this and most examples we use pack_end by choice and + * practicality. In this part of the code we also make clock + * visible. + + * @skip pack_end + * @until visibility + + * The second clock shows ther am/pm time, that we also create with + * the C++ binding method, passing our window object as + * parent. Setting show_am_pm to true and again choosing the packing + * method and making clock visible. + + * @skip clock + * @until visibility + + * 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 + * time_set(): + + * @skip ck3 + * @until visibility + + * In both fourth and fifth ones, we turn on the edition + * mode. 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: + + * @skip ck4 + * @until visibility + + * The fifth, besides editable, has only the time @b units editable, + * for hours, minutes and seconds. This exemplifies edit_mode_set(): + + * @skip ck5 + * @until visibility + + * Finally we just have to make our window visible and then run the + * elm mainloop, starting to handle events and drawing operations. + + * @skip visibility + * @until ELM_MAIN + + * See the full @ref clock_cxx_example.cc, whose window should look + * like this picture: + + * @image html screenshots/clock_cxx_example.png + * @image latex screenshots/clock_cxx_example.eps width=\textwidth + * @example clock_cxx_example.cc + */ + + /** + * @page datetime_cxx_example Datetime Example with C++ binding + * @dontinclude datetime_cxx_example.cc + + * This example places three Elementary Datetime widgets on a window, + * each of them exemplifying the widget's different usage. + + * The first part consists of including the headers. In this + * case we are only working with the Elementary C++ binding and thus + * we need only to include him. + + * @skipline Elementary.hh + + * @attention If necessary the C and/or the C++ headers should be + * include here as well. + + * Now we need to actually start the code and set the elm_policy, + * which defines for a given policy group/identifier a new policy's + * value, respectively. In this example the only policy we need to + * set a value for is @c ELM_POLICY_QUIT, possibles values for it are: + + * @li @p ELM_POLICY_QUIT_NONE: Never quit the application + * automatically; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the + * application's last window is closed; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the + * application's last window is hidden; + + * @skip EAPI_MAIN + * @until elm_policy_set + + * As you can see, the policy we chose was to quit when the last win + * is hidden as opose to examples with the C bindings where we + * perpetually set it to quit when last win was closed. This changed + * was necessary because in C++ binding as the elm mainloop stop + * running all object are destroyed, references are unreferenced and + * events are stopped at ELM_MAIN(). + + * @see For more details consult elm_policy_set + + * Next step is creating an Elementary window, where win calls a + * constructor and sets the type of the win to ELM_WIN_BASIC + * (Elm_Win_Type), which is the indicated type for most of our + * examples. Here we also set the title that will appear at the top of + * our window and then the autohide state for win. + + * The autohide works similarly to @p autodel, automatically handling + * "delete,request" signals when set to @p true, with the difference + * that it will hide the window, instead of destroying it. + + * It is specially designed to work together with @p + * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting + * Elementary's main loop when all the windows are hidden. + + * @skip ::elm::win + * @until autohide_set + + * @note @p autodel and @a autohide are not mutually exclusive. The + * window will be destructed if both autodel and autohide is set to @p + * EINA_TRUE or @p true. + + * Now we construct the elm background and for this we use the C++ + * method below, setting it's parent. + + * @skipline ::elm::bg + + * To better understand, the function @c size_hint_weight_set for C++ + * bindings originated from C bindings function + * evas_object_size_hint_weight_set, that is EFL Evas type function. + * With this function we set the hints for an object's weight. The + * parameters are: + + * @li x - Nonnegative double value to use as horizontal weight hint. + + * @li y - Nonnegative double value to use as vertical weight hint. + + * This is not a size enforcement in any way, it's just a hint that + * should be used whenever appropriate. This is a hint on how a + * container object should resize a given child within its area. + + * Containers may adhere to the simpler logic of just expanding the + * child object's dimensions to fit its own (see the EVAS_HINT_EXPAND + * helper weight macro in the EFL Evas Documentation) or the complete + * one of taking each child's weight hint as real weights to how much + * of its size to allocate for them in each axis. A container is + * supposed to, after normalizing the weights of its children (with + * weight hints), distribute the space it has to layout them by those + * factors – most weighted children get larger in this process than + * the least ones. + + * @skipline weight_set + + * @note Default weight hint values are 0.0, for both axis. + + * Now we add the background as a resize_object to win informing that + * when the size of the win changes so should the background's + * size. And finally we make it visible. + + * @skip win + * @until visibility_set + + * @remarks If a color it's not setted the default color will be used. + + * A box arranges objects in a linear fashion, governed by a layout + * function that defines the details of this arrangement. The box will + * use an internal function to set the layout to a single row, + * vertical by default. + + * Now let's create the box with the C++ binding method, passing our + * window object as parent. Using Evas weight_set function again to + * hint on how a container object should resize a given child within + * its area. + + * @skipline elm::box + * @until weight_set + + * Then we add the box as a resize-object to win informing that when + * the size of the win changes so should the box's size. Remember + * always to set the box visibility to true. + + * @skip win + * @until visibility + + * The first of them is "only Date display". We will create it + * using the C++ method below. The weight hint works with datetime the + * same as it did with background and box. + + * @skip datetime + * @until weight + + * Now we have to The function @c size_hint_align_set for C++ bindings + * originated from C bindings function + * evas_object_size_hint_align_set, that is EFL Evas type + * function. With this function we set the hints for an object's + * alignment. The parameters are: + + * @li x - Double, ranging from 0.0 to 1.0 or with the special value + * EVAS_HINT_FILL, to use as horizontal alignment hint. + + * @li y - Double, ranging from 0.0 to 1.0 or with the special value + * EVAS_HINT_FILL, to use as vertical alignment hint. + + * These are hints on how to align an object inside the boundaries of + * a container/manager. Accepted values are in the 0.0 to 1.0 range, + * with the special value EVAS_HINT_FILL used to specify "justify" or + * "fill" by some users. In this case, maximum size hints should be + * enforced with higher priority, if they are set. Also, any padding + * hint set on objects should add up to the alignment space on the + * final scene composition. + + * For the horizontal component, 0.0 means to the left, 1.0 means to + * the right. Analogously, for the vertical component, 0.0 to the top, + * 1.0 means to the bottom. + + * This is not a size enforcement in any way, it's just a hint that + * should be used whenever appropriate. + + * @skipline align + + * @note Default alignment hint values are 0.5, for both axis. + + * An important feature for the datetime is the setting of what we + * want it to display. We can achieve that by using: + + * @p field_visible_set ( Elm_Datetime_Field_Type fieldtype_, bool + * visible_) + + * Parameters are: + + * @li @p fieldtype_: type of the field, supports 6 fields: + + * @p ELM_DATETIME_YEAR: Indicates Year field. + + * @p ELM_DATETIME_MONTH: Indicates Month field. + + * @p ELM_DATETIME_DATE: Indicates Date field. + + * @p ELM_DATETIME_HOUR: Indicates Hour field, + + * @p ELM_DATETIME_MINUTE: Indicates Minute field. + + * @p ELM_DATETIME_AMPM: Indicates AM/PM field. + + * @li @p visible_: @p true field can be visible, @p false otherwise. + + * @attention Setting this API True does not ensure that the field is + * visible, apart from this, the field's format must be present in + * Datetime overall format. If a field's visibility is set to False + * then it won't appear even though its format is present in overall + * format. So if and only if this API is set true and the + * corresponding field's format is present in Datetime format, the + * field is visible. + + * @note By default the field visibility is set to @p true. + + * For this first datetime we are setting the HOUR, MINUTE and AM/PM + * to not be visible, doing this we'll display in our datetime the + * year, month and date. + + * @note Hour format 12hr(1-12) or 24hr(0-23) display can be selected + * by setting the corresponding user format. The corresponding Month + * and AM/PM strings are displayed according to the system’s language + * settings. + + * @skip HOUR + * @until AMPM + + * When using the elm box the packing method of the subobj - datetime + * in this case - should be defined. There are four possible methods: + + * @li @c pack_start(subobj_) - Add an object to the beginning of the + * pack list. Pack @c subobj_ into the box obj, placing it first in + * the list of children objects. The actual position the object will + * get on screen depends on the layout used. If no custom layout is + * set, it will be at the top or left, depending if the box is + * vertical or horizontal, respectively. + + * @li @c pack_end(subobj_) - Add an object at the end of the pack + * list. Pack @c subobj_ into the box obj, placing it last in the list + * of children objects. The actual position the object will get on + * screen depends on the layout used. If no custom layout is set, it + * will be at the bottom or right, depending if the box is vertical or + * horizontal, respectively. + + * @li @c pack_before(subobj_, before_) - Adds an object to the box + * before the indicated object. This will add the @c subobj_ to the + * box indicated before the object indicated with @c before_. If + * before is not already in the box, results are undefined. Before + * means either to the left of the indicated object or above it + * depending on orientation. + + * @li @c pack_after(subobj_, after_) - Adds an object to the box + * after the indicated object. This will add the @c subobj_ to the box + * indicated after the object indicated with @c after_. If after is + * not already in the box, results are undefined. After means either + * to the right of the indicated object or below it depending on + * orientation. + + * In this and most examples we use pack_end by choice and + * practicality. In this part of the code we also make datetime + * visible. + + * @skip pack_end + * @until visibility + + * For our second datetime, we'll also set the size hints weight and + * align, but in this case, the filds YEAR, MONTH and DATE will be not + * visible, and thus displaying in our datetime the hour, minute and + * AM/PM. Finally we choose it's packing method and set the visibility + * of datetime to @p true. + + * @skip datetime2 + * @until visibility + + * For our third and last datetime, we setted the weight and align as + * before, chose our packing method and made it visible. Note that in + * this case we didn't exclude any type of field leaving all visible. + + * @skip datetime3 + * @until visibility + + * And finally, we set our win's visibility and start the elm + * mainloop, starting to handle events and drawing operations. + + * @skip win + * @until ELM_MAIN + + * See the full @ref datetime_cxx_example.cc . + + * This example should look like: + + * @image html screenshots/datetime_cxx_example.png + * @image latex screenshots/datetime_cxx_example.eps width=\textwidth + + * @example datetime_cxx_example.cc + */ + +/** + * @page glview_cxx_example_01 Glview example with C++ Binding + * @dontinclude glview_cxx_example_01.cc + + * In this example we'll illustrate how to use Glview and it's + * features. + + * The first part consists of including the headers. In this case we + * need to include @p Elementary.hh, @p Evas_GL.h and @p stdio.h. + + *@li @p Elementary.hh: library for Elementary with support for C++ + * language; + + *@li @p Evas_GL.h: has functions that are used to do OpenGL rendering + * on Evas, Evas allows us to use OpenGL to render to specially set up + * image objects, which act as render target surfaces. + + *@li @p stdio.h is a C library with functions tha perform + * Input/Output operations. + + * @skip Elementary.hh + * @until stdio + + * Continuing with the code, at this point we create a GL related + * struct: + + *@li @p Evas_GL_API that is the structure type of the Evas GL API object + * that contains the GL APIs to be used in Evas GL. + + *@li @p GLuint one of the pre-defined types of OpenGL which is a unsigned binary integer. + + *@li @p int AKA @p int. + + * @skip typedef + * @until }; + + * Here we're simply initializing a type float, that we named red. + + * @skipline red + + * In this example we'll need a type C helper function to load shaders + * from a shader source. + + * @skip static + * @until GLint + + * Inside this function we create the shader objectand load/compile + * shader source. + + * @skip shader + * @until return shader; + + * Completing our load shader function. + + * @skipline } + + * This example will also need a function to initialize the shader and + * program object. + + * @skip static + * @until linked + + * In this function we load the vertex/fragment shaders, create the + * program object and finish our funtion. + + * @skip gld + * @until return 1; + * @skiline } + + * We need the following callbacks: + + * @li initialize callback: that get called once for + * initialization; + + * @skip void + * @until BufferData + * @skipline } + + * @li delete callback: gets called when glview is deleted; + + * @skip void + * @until free + * @skipline } + + * @li resize callback: gets called every time object is resized; + + * @skip void + * @skipline } + + * @li draw callback: is where all the main GL rendering happens. + + * @skip void + * @until COLOR_BUFFER + + * Inside this callback, we'll draw a triangle. + + * @skip gl + * @until DrawArrays + + * Still inside as an option we are going to flush the GL pipeline and + * end our callback. + + * @skip Finish + * @until } + + * We create @p _anim to notify that glview has changed so it can + * render. + + * @skip static + * @until } + + * Now that we finished with the GL preparations, we'll start the main + * code and initialize our GLData pointer object to NULL and run a + * check just in case. + + * @skip EAPI_MAIN + * @until if + + * Let's set the elm_policy, which defines for a given policy + * group/identifier a new policy's value, respectively. In this + * example the only policy we need to set a value for is @c + * ELM_POLICY_QUIT, possibles values for it are: + + * @li @p ELM_POLICY_QUIT_NONE: Never quit the application + * automatically; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the + * application's last window is closed; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the + * application's last window is hidden; + + * @skipline elm_policy_set + + * As you can see, the policy we chose was to quit when the last win + * is hidden as opose to examples with the C bindings where we + * perpetually set it to quit when last win was closed. This changed + * was necessary because in C++ binding as the elm mainloop stop + * running all object are destroyed, references are unreferenced and + * events are stopped at ELM_MAIN(). + + * @see For more details consult elm_policy_set + + * Next step is creating an elementary window, in this example we use + * the C++ binding method with the elm_win_util_standard_add that is a + * elm_win_legacy function, better explained below. And then we set + * the autohide state for it. + + * @p elm_win_util_standard_add (const char *name, const char *tittle) + * Adds a window object with standard setup. + * Parameters: + + * @li @p name - The name of the window; + + * @li @p title - The title for the window. + + * This creates a window but also puts in a standard background with + * @p elm_bg_add(), as well as setting the window title to @p + * title. The window type created is of type @c ELM_WIN_BASIC, with + * the @c NULL as the parent widget. Returns the created object or @c + * NULL on failure. + + * The autohide works similarly to @p autodel, automatically handling + * "delete,request" signals when set to @p true, with the difference + * that it will hide the window, instead of destroying it. + + * It is specially designed to work together with @p + * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting + * Elementary's main loop when all the windows are hidden. + + * @skip ::elm::win + * @until autohide_set + + * @note @p autodel and @a autohide are not mutually exclusive. The + * window will be destructed if both autodel and autohide is set to @p + * EINA_TRUE or @p true. + + * Now let's create a box with the C++ binding method, passing our + * window object as parent, we'll use this box to contain our glview + * object. + + * @skipline bx + + * To better understand, the function @c size_hint_weight_set for C++ + * bindings originated from C bindings function + * evas_object_size_hint_weight_set, that is EFL Evas type function. + * With this function we set the hints for an object's weight. The + * parameters are: + + * @li x - Nonnegative double value to use as horizontal weight hint. + + * @li y - Nonnegative double value to use as vertical weight hint. + + * This is not a size enforcement in any way, it's just a hint that + * should be used whenever appropriate. This is a hint on how a + * container object should resize a given child within its area. + + * Containers may adhere to the simpler logic of just expanding the + * child object's dimensions to fit its own (see the EVAS_HINT_EXPAND + * helper weight macro in the EFL Evas Documentation) or the complete + * one of taking each child's weight hint as real weights to how much + * of its size to allocate for them in each axis. A container is + * supposed to, after normalizing the weights of its children (with + * weight hints), distribute the space it has to layout them by those + * factors – most weighted children get larger in this process than + * the least ones. + + * @skipline weight_set + + * @note Default weight hint values are 0.0, for both axis. + + * Then we add the box as a resize-object to win informing that when + * the size of the win changes so should the box's size. Remember + * always to set the box visibility to true. + + * @skip win + * @until visibility + + * In this part we'll create a new elm glview, using the C++ method, + * in this case it requires that we set @p Evas_GL_Context_Version + * with the version_constructor. @p Evas_GL_Context_Version is a + * enumeration that defines the available OpenGL ES version numbers, + * it can be used to create OpenGL-ES 1.1 contexts. + + * @skip glview + * @until glapi + + * The function size_hint_weight_set works with glview the same way as + * with box, for more, search above. + + * The function @c size_hint_align_set for C++ bindings originated + * from C bindings function evas_object_size_hint_align_set, that is + * EFL Evas type function. With this function we set the hints for an + * object's alignment. The parameters are: + + * @li x - Double, ranging from 0.0 to 1.0 or with the special value + * EVAS_HINT_FILL, to use as horizontal alignment hint. + + * @li y - Double, ranging from 0.0 to 1.0 or with the special value + * EVAS_HINT_FILL, to use as vertical alignment hint. + + * These are hints on how to align an object inside the boundaries of + * a container/manager. Accepted values are in the 0.0 to 1.0 range, + * with the special value EVAS_HINT_FILL used to specify "justify" or + * "fill" by some users. In this case, maximum size hints should be + * enforced with higher priority, if they are set. Also, any padding + * hint set on objects should add up to the alignment space on the + * final scene composition. + + * For the horizontal component, 0.0 means to the left, 1.0 means to + * the right. Analogously, for the vertical component, 0.0 to the top, + * 1.0 means to the bottom. + + * This is not a size enforcement in any way, it's just a hint that + * should be used whenever appropriate. + + * @note Default alignment hint values are 0.5, for both axis. + + * @skipline align_set + + * Mode is simply for supporting alpha, depth buffering and stencil + * buffering. + + * @skip mode + * @until mode_set + + * Resize policy tells glview what to do with the surface when it + * resizes. ELM_VIEW_RESIZE_POLICY_RECREATE will tell it to destroy + * the current surface and recreate it to the new size. + + * @skipline resize + + * Render policy tells glview how it would like glview to render gl + * code. ELM_GLVIEW_RENDER_POLICY_ON_DEMAND will have the gl calls + * called in the pixel_get callback, which only gets called if the + * object is visible, hence ON_DEMAND. ALWAYS mode renders it despite + * the visibility of the object. + + * @skipline render + + * Now we'll register our callbacks. + + * @skip init + * @until draw + + * When using the elm box the packing method of the subobj - glview in + * this case - should be defined. There are four possible methods: + + * @li @c pack_start(subobj_) - Add an object to the beginning of the + * pack list. Pack @c subobj_ into the box obj, placing it first in + * the list of children objects. The actual position the object will + * get on screen depends on the layout used. If no custom layout is + * set, it will be at the top or left, depending if the box is + * vertical or horizontal, respectively. + + * @li @c pack_end(subobj_) - Add an object at the end of the pack + * list. Pack @c subobj_ into the box obj, placing it last in the list + * of children objects. The actual position the object will get on + * screen depends on the layout used. If no custom layout is set, it + * will be at the bottom or right, depending if the box is vertical or + * horizontal, respectively. + + * @li @c pack_before(subobj_, before_) - Adds an object to the box + * before the indicated object. This will add the @c subobj_ to the + * box indicated before the object indicated with @c before_. If + * before is not already in the box, results are undefined. Before + * means either to the left of the indicated object or above it + * depending on orientation. + + * @li @c pack_after(subobj_, after_) - Adds an object to the box + * after the indicated object. This will add the @c subobj_ to the box + * indicated after the object indicated with @c after_. If after is + * not already in the box, results are undefined. After means either + * to the right of the indicated object or below it depending on + * orientation. + + * In this and most examples we use pack_end by choice and + * practicality, in this part of the code we also make glview visible + * and set to focus. + + * @skip pack_end + * @until focus + + * For a simple demonstration of the animation we'll have to use + * ecore::animator. As long as tou trigger an update on the image via + * @p changed_set() it will be updated. + + * @skip ani + * @until "gld" + + * If you delete gl, this animator will keep running trying to access + * gl so it's better to delete this animator with + * ecore_animator_del(), as seen inside the lambda function. + + * @skipline callback_del + + * @note To learn more about Lambda Function and its use in Elementary + * consult @ref lambda. + + * We're going to add a "OK" button to end the program. First step is + * to create it using the C++ method, setting it's parent. + + * @skipline button + + * Second, set the text, alignment and weight hints, the hints work + * the same as with box and glview. + + * @skip text + * @until weight + + * Pack our button in the same box as glview and set the visibility for + * it. + + * @skip pack + * @until visibility + + * As a final step for our button, we are going to add a clicked + * callback, using again Lambda Type Function. + + * @skipline clicked + + * @note To learn more about Lambda Function and its use in Elementary + * consult @ref lambda. + + * Now we only have to set the size for our window and make it + * visible. + + * @skip size_set + * @until visibility_set + + * And finally, start the elm mainloop, starting to handle events and + * drawing operations. + + * @skip elm_run + * @until ELM_MAIN + + * See full code for this example @ref glview_cxx_example_01.cc "here" . + + * @example glview_cxx_example_01.cc + */ + +/** + * @page hoversel_cxx_example_01 Hoversel example with C++ Binding + * @dontinclude hoversel_cxx_example_01.cc + + * In this example we'll create a hoversel with 3 items, one with a + * label but no icon and two with both a label and an icon. Every item + * that is clicked will be deleted, but everytime the hoversel is + * activated we will also add an item. In addition our first item will + * print all items when clicked and our third item will clear all + * items in the hoversel. + + * The first part consists of including the headers. We'll include @p + * Elementary.hh, @p Eina.hh and @p Evas.hh, that are C++ bindings + * that are needed in this example. + + * @skip Elementary + * @until Evas + + * Before our main code we'll need the following callbacks: + + *@li @p _print_items: callback for our first item which prints all + * items in the hoversel. + + * @until print + + *@li @p _free: callback that frees the allocated memory. + + * @until free + + * Starting the main code and initializing Eina C++ Lybrary, always + * initiate Eina when included. + + * @skip EAPI + * @until eina + + * Now let's set the elm_policy, which defines for a given policy + * group/identifier a new policy's value, respectively. In this + * example the only policy we need to set a value for is @c + * ELM_POLICY_QUIT, possibles values for it are: + + * @li @p ELM_POLICY_QUIT_NONE: Never quit the application + * automatically; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the + * application's last window is closed; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the + * application's last window is hidden; + + * @skipline elm_policy_set + + * As you can see, the policy we chose was to quit when the last win + * is hidden as opose to examples with the C bindings where we + * perpetually set it to quit when last win was closed. This changed + * was necessary because in C++ binding as the elm mainloop stop + * running all object are destroyed, references are unreferenced and + * events are stopped at ELM_MAIN(). + + * @see For more details consult elm_policy_set + + * Next step is creating an elementary window, in this example we use + * the C++ binding method with the elm_win_util_standard_add that is a + * elm_win_legacy function, better explained below. And then we set + * the autohide state for it. + + * @p elm_win_util_standard_add (const char *name, const char *tittle) + * Adds a window object with standard setup. + * Parameters: + + * @li @p name - The name of the window; + + * @li @p title - The title for the window. + + * This creates a window but also puts in a standard background with + * @p elm_bg_add(), as well as setting the window title to @p + * title. The window type created is of type @c ELM_WIN_BASIC, with + * the @c NULL as the parent widget. Returns the created object or @c + * NULL on failure. + + * The autohide works similarly to @p autodel, automatically handling + * "delete,request" signals when set to @p true, with the difference + * that it will hide the window, instead of destroying it. + + * It is specially designed to work together with @p + * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting + * Elementary's main loop when all the windows are hidden. + + * @skip ::elm::win + * @until autohide_set + + * @note @p autodel and @a autohide are not mutually exclusive. The + * window will be destructed if both autodel and autohide is set to @p + * EINA_TRUE or @p true. + + * Next we'll create a red evas::rectangle to use as the icon of our + * hoversel, for thus using the C++ method, setting the color and + * making it visible. + + * @skip evas + * @until visibility + + * And now we create our hoversel and set some of it's properties. We + * set @p win as its parent, set it to be vertical and give it a label + * and content, that will work as icon: + + * @skip hoversel + * @until content + + * Next we will add callbacks to be called for the first and third: + + * @skip item + * @until "Option 2" + + * We also set a pair of callbacks to be called whenever any item is + * selected or when the hoversel is activated, for this we'll use + * Lambda type function, @p add_item is called when the hoversel is + * activated and adds an item to the hoversel. Note that since we + * allocate memory for the item we need to know when the item dies so + * we can free that memory. + + * @skip add + * @until clicked + + * @see For more on Lambda check @ref lambda "here" + + * Finishing with hoversel we set its size, position and make it + * visible. + + * @skip size + * @until visibility + + * In our second hoversel we'll add a button and for this we need + * create it using C++ method, set a text, add a callback for when + * button is clicked. This callback is type Lambda, it will clear + * hoversel when clicked. + + * @skip button + * @until callback + + * Concluding our button options, we will set the size, position and + * visibility. + + * @skip size + * @until visibility + + * Now we set the size for the window, making it visible in the end: + + * @skip size_set + * @until visibility_set + + * Finally we just have to start the elm mainloop, starting to handle + * events and drawing operations. + + * @skip elm_run + * @until ELM_MAIN + + * Our example will look like this: + + * @image html screenshots/hoversel_cxx_example_01.png + * @image latex screenshots/hoversel_cxx_example_01.eps width=\textwidth + + * @example hoversel_cxx_example_01.cc + */ + +/** + * @page icon_cxx_example_01 Icon Example with C++ binding + * @dontinclude icon_cxx_example_01.cc + + * This example is as simple as possible. An icon object will be added + * to the window over a blank background, and set to be resizable + * together with the window. All the options set through the example + * will affect the behavior of this icon. + + * The first part consists of including the headers. In this case we + * are only working with the Elementary C++ binding and thus we need + * only to include him. + + * @skipline Elementary.hh + + * @attention If necessary the C and/or the C++ headers should be + * include here as well. + + * Now we need to actually start the code and set the elm_policy, + * which defines for a given policy group/identifier a new policy's + * value, respectively. In this example the only policy we need to set + * a value for is @c ELM_POLICY_QUIT, possibles values for it are: + + * @li @p ELM_POLICY_QUIT_NONE: Never quit the application + * automatically; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the + * application's last window is closed; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the + * application's last window is hidden; + + * @skip EAPI_MAIN + * @until elm_policy_set + + * As you can see, the policy we chose was to quit when the last win + * is hidden as opose to examples with the C bindings where we + * perpetually set it to quit when last win was closed. This changed + * was necessary because in C++ binding as the elm mainloop stop + * running all object are destroyed, references are unreferenced and + * events are stopped at ELM_MAIN(). + + * @see For more details consult elm_policy_set + + * Next step is creating an elementary window, in this example we use + * the C++ binding method with the elm_win_util_standard_add that is a + * elm_win_legacy function, better explained below. And then we set + * the autohide state for it. + + * @p elm_win_util_standard_add (const char *name, const char *tittle) + * Adds a window object with standard setup. + * Parameters: + + * @li @p name - The name of the window; + + * @li @p title - The title for the window. + + * This creates a window but also puts in a standard background with + * @p elm_bg_add(), as well as setting the window title to @p + * title. The window type created is of type @c ELM_WIN_BASIC, with + * the @c NULL as the parent widget. Returns the created object or @c + * NULL on failure. + + * The autohide works similarly to @p autodel, automatically handling + * "delete,request" signals when set to @p true, with the difference + * that it will hide the window, instead of destroying it. + + * It is specially designed to work together with @p + * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting + * Elementary's main loop when all the windows are hidden. + + * @skip ::elm::win + * @until autohide_set + + * @note @p autodel and @a autohide are not mutually exclusive. The + * window will be destructed if both autodel and autohide is set to @p + * EINA_TRUE or @p true. + + * Now we construct the elm icon and for this we use the C++ method + * below, setting it's parent. An icon object is used to display + * standard icon images ("delete", "edit", "arrows", etc.) or images + * coming from a custom file (PNG, JPG, EDJE, etc.), on icon contexts. + + * @skipline ::elm::icon + + * The icon image requested can be in the Elementary theme in use, or + * in the freedesktop.org theme paths. It's possible to set the order + * of preference from where an image will be fetched and for that + * we'll use the function @ order_lookup_set(order_) that will be use + * by standard_set. Possibles values for @p order_ are: + + * @li @p ELM_ICON_LOOKUP_FDO_THEME: icon look up order is freedesktop + * then theme; + + * @li @p ELM_ICON_LOOKUP_THEME_FDO: icon look up order is theme then + * freedesktop; + + * @li @p ELM_ICON_LOOKUP_FDO: icon look up order is only freedesktop; + + * @li @p ELM_ICON_LOOKUP_THEME: icon look up order is only theme; + + * @skipline order + + * Now that we setted the order value we can set the standard "home" + * icon, chosen for this example. + + * @skipline standard + + * An interesting thing is that after setting this, it's possible to + * check where in the filesystem is the theme used by this icon, and + * the name of the group used, using file_get. + + * @skip file + * @until std::cout + + * We can also get the name of the standard icon that we setted + * before. + + * @skip name + * @until std::cout + + * We can now go setting our options. + + * no_scale_set() is used just to set this value to true as we don't + * actually want to scale our icon, just resize it. + + * resizable_set() is used to allow the icon to be resized to a size + * smaller than the original one, but not to a size bigger than it. + + * smooth_set() will disable the smooth scaling, so the scale + * algorithm used to scale the icon to the new object size is going to + * be faster, but with a lower quality. + + * fill_outside_set() is used to ensure that the icon will fill the + * entire area available to it, even if keeping the aspect ratio. The + * icon will overflow its width or height (any of them that is + * necessary) to the object area, instead of resizing the icon down + * until it can fit entirely in this area. + + * This is the code for setting these options: + + * @until fill_outside + + * However, if you try this example you may notice that this image is + * not being affected by all of these options. This happens because + * the used icon will be from elementary theme, and thus it has its + * own set of options like smooth scaling and fill_outside + * options. You can change the "home" icon to use some image (from + * your system) and see that then those options will be respected. + + * To better understand, the function @c size_hint_weight_set for C++ + * bindings originated from C bindings function + * evas_object_size_hint_weight_set, that is EFL Evas type function. + * With this function we set the hints for an object's weight. The + * parameters are: + + * @li x - Nonnegative double value to use as horizontal weight hint. + + * @li y - Nonnegative double value to use as vertical weight hint. + + * This is not a size enforcement in any way, it's just a hint that + * should be used whenever appropriate. + + * This is a hint on how a container object should resize a given + * child within its area. + + * Containers may adhere to the simpler logic of just expanding the + * child object's dimensions to fit its own (see the EVAS_HINT_EXPAND + * helper weight macro in the EFL Evas Documentation) or the complete + * one of taking each child's weight hint as real weights to how much + * of its size to allocate for them in each axis. A container is + * supposed to, after normalizing the weights of its children (with + * weight hints), distribute the space it has to layout them by those + * factors – most weighted children get larger in this process than + * the least ones. + + * @skipline weight_set + + * @note Default weight hint values are 0.0, for both axis. + + * Now we add the icon as a resize_object to win informing that + * when the size of the win changes so should the icon's + * size. And finally we make icon visible. + + * Now we set the size for the window, making it visible in the end: + + * @skip size_set + * @until visibility_set + + * Finally we just have to start the elm mainloop, starting to handle + * events and drawing operations. + + * @skip elm_run + * @until ELM_MAIN + + * The full code for this example can be found at @ref icon_cxx_example_01.cc + + * This example will look like this: + + * @image html screenshots/icon_cxx_example_01.png + * @image latex screenshots/icon_cxx_example_01.eps width=\textwidth + + * @example icon_cxx_example_01.cc + */ + +/** + * @page location_cxx_example_01 Location example with C++ Binding + * @dontinclude location_cxx_example_01.cc + + * This example shows how to integrate the Elocation.h library with + * elementary. + + * The first part consists of including the headers. In this case we + * need to include both Elementary C++ binding and Elocation, + + * @skip Elementary.hh + * @until endif + + * @attention All necessary libraries from Elementary, Elightenment, C + * and/or C++ headers should be include here. + + * Before our main code, we need a set of callbacks to react on + * incoming elocation events. They are standard ecore events and we + * register callbacks on these events in the main function. + + * @skip void + * @until ECORE_CALLBACK_DONE + * @until } + + * Now we need to actually start the code and initializing pointers + * for address, addr_geocode, position and pos_geocode and an integer + * status. We also run a check for elm_need_elocation. + + * @skip EAPI_MAIN + * @until -1 + + * Now let's set the elm_policy, which defines for a given policy + * group/identifier a new policy's value, respectively. In this + * example the only policy we need to set a value for is @c + * ELM_POLICY_QUIT, possibles values for it are: + + * @li @p ELM_POLICY_QUIT_NONE: Never quit the application + * automatically; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the + * application's last window is closed; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the + * application's last window is hidden; + + * @skipline elm_policy_set + + * As you can see, the policy we chose was to quit when the last win + * is hidden as opose to examples with the C bindings where we + * perpetually set it to quit when last win was closed. This changed + * was necessary because in C++ binding as the elm mainloop stop + * running all object are destroyed, references are unreferenced and + * events are stopped at ELM_MAIN(). + + * @see For more details consult elm_policy_set + + * Next step is creating an elementary window, in this example we use + * the C++ binding method with the elm_win_util_standard_add that is a + * elm_win_legacy function, better explained below. And then we set + * the autohide state for it. + + * @p elm_win_util_standard_add (const char *name, const char *tittle) + * Adds a window object with standard setup. + * Parameters: + + * @li @p name - The name of the window; + + * @li @p title - The title for the window. + + * This creates a window but also puts in a standard background with + * @p elm_bg_add(), as well as setting the window title to @p + * title. The window type created is of type @c ELM_WIN_BASIC, with + * the @c NULL as the parent widget. Returns the created object or @c + * NULL on failure. + + * The autohide works similarly to @p autodel, automatically handling + * "delete,request" signals when set to @p true, with the difference + * that it will hide the window, instead of destroying it. + + * It is specially designed to work together with @p + * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting + * Elementary's main loop when all the windows are hidden. + + * @skip ::elm::win + * @until autohide_set + + * @note @p autodel and @a autohide are not mutually exclusive. The + * window will be destructed if both autodel and autohide is set to @p + * EINA_TRUE or @p true. + + * For this example we're using a label that will display the text + * "Getting location ...". First we'll create our label, setting it's + * parent, then setting the following label's options: + + * @li @p line_wrap_set: Set the wrapping behavior of the label, by + * default no wrapping is done. Possible values for wrap are: + * @p ELM_WRAP_NONE - No wrapping; + * @p ELM_WRAP_CHAR - wrap between characters; + * @p ELM_WRAP_WORD - wrap between words; + * @p ELM_WRAP_MIXED - Word wrap, and if that fails, char wrap. + + * @ skipline wrap + + * @li @p text_set: Set the text that label will display. + + * @skipline text + + * @li @p slide_mode_set: Set the slide mode of the label widget. By + * default, slide mode is none. Possible values for mode are: + + * ELM_LABEL_SLIDE_MODE_NONE - no slide effect + + * ELM_LABEL_SLIDE_MODE_AUTO - slide only if the label area is bigger + * than the text width length + + * ELM_LABEL_SLIDE_MODE_ALWAYS -slide always + + * @attention ELM_LABEL_SLIDE_MODE_AUTO, ELM_LABEL_SLIDE_MODE_ALWAYS + * only work with the themes "slide_short", "slide_long" and + * "slide_bounce". ELM_LABEL_SLIDE_MODE_AUTO, + * ELM_LABEL_SLIDE_MODE_ALWAYS don't work if the line + * wrap(elm_label_line_wrap_set()) or + * ellipsis(elm_label_ellipsis_set()) is set. + + * @skipline slide + + * To better understand, the function @c size_hint_weight_set for C++ + * bindings originated from C bindings function + * evas_object_size_hint_weight_set, that is EFL Evas type function. + * With this function we set the hints for an object's weight. The + * parameters are: + + * @li x - Nonnegative double value to use as horizontal weight hint. + + * @li y - Nonnegative double value to use as vertical weight hint. + + * This is not a size enforcement in any way, it's just a hint that + * should be used whenever appropriate. This is a hint on how a + * container object should resize a given child within its area. + + * Containers may adhere to the simpler logic of just expanding the + * child object's dimensions to fit its own (see the EVAS_HINT_EXPAND + * helper weight macro in the EFL Evas Documentation) or the complete + * one of taking each child's weight hint as real weights to how much + * of its size to allocate for them in each axis. A container is + * supposed to, after normalizing the weights of its children (with + * weight hints), distribute the space it has to layout them by those + * factors – most weighted children get larger in this process than + * the least ones. + + * @dontinclude location_cxx_example_01.cc + * @skipline weight_set + + * @note Default weight hint values are 0.0, for both axis. + + * The function @c size_hint_align_set for C++ bindings originated + * from C bindings function evas_object_size_hint_align_set, that is + * EFL Evas type function. With this function we set the hints for an + * object's alignment. The parameters are: + + * @li x - Double, ranging from 0.0 to 1.0 or with the special value + * EVAS_HINT_FILL, to use as horizontal alignment hint. + + * @li y - Double, ranging from 0.0 to 1.0 or with the special value + * EVAS_HINT_FILL, to use as vertical alignment hint. + + * These are hints on how to align an object inside the boundaries of + * a container/manager. Accepted values are in the 0.0 to 1.0 range, + * with the special value EVAS_HINT_FILL used to specify "justify" or + * "fill" by some users. In this case, maximum size hints should be + * enforced with higher priority, if they are set. Also, any padding + * hint set on objects should add up to the alignment space on the + * final scene composition. + + * For the horizontal component, 0.0 means to the left, 1.0 means to + * the right. Analogously, for the vertical component, 0.0 to the top, + * 1.0 means to the bottom. + + * This is not a size enforcement in any way, it's just a hint that + * should be used whenever appropriate. + + * @note Default alignment hint values are 0.5, for both axis. + + * @skipline align_set + + * Setting the size for label and make it visible. + + * @skip size + * @until visibility + + * Going back to our elocation, first we'll create an address + * and position object that we'll use for all our operations. + + * @skip address + * @until position + + * We also have to register our callback so we get updates later on. + + * @skipline ecore + + * Now we need to get the elocation position and print it, using our + * label. This fills in the object with the data from GeoClue. + + * @skip elocation + * @until print + + * Now we only have to set the size for our window and make it + * visible. + + * @skip size_set + * @until visibility_set + + * And finally, start the elm mainloop, starting to handle events and + * drawing operations. + + * @skip elm_run + * @until ELM_MAIN + + * The full code for this example can be found at @ref location_cxx_example_01.cc + + * @example location_cxx_example_01.cc + */ + + +/** + * @page menu_cxx_example_01 Menu Example with C++ Binding + * @dontinclude menu_cxx_example_01.cc + + * This example shows how to create a menu with regular items, object + * items, submenus and how to delete items from a menu. + + * The first part consists of including the headers. We'll include @p + * Elementary.hh, @p Eina.hh and @p Evas.hh, that are C++ bindings + * that are needed in this example. + + * @skip Elementary + * @until Evas + + * Starting the main code and initializing Eina C++ Lybrary, always + * initiate Eina when included. We'll also initialize a couple of + * pointers. + + * @skip EAPI + * @until menu_it + + * Now let's set the elm_policy, which defines for a given policy + * group/identifier a new policy's value, respectively. In this + * example the only policy we need to set a value for is @c + * ELM_POLICY_QUIT, possibles values for it are: + + * @li @p ELM_POLICY_QUIT_NONE: Never quit the application + * automatically; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the + * application's last window is closed; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the + * application's last window is hidden; + + * @skipline elm_policy_set + + * As you can see, the policy we chose was to quit when the last win + * is hidden as opose to examples with the C bindings where we + * perpetually set it to quit when last win was closed. This changed + * was necessary because in C++ binding as the elm mainloop stop + * running all object are destroyed, references are unreferenced and + * events are stopped at ELM_MAIN(). + + * @see For more details consult elm_policy_set + + * Next step is creating an elementary window, in this example we use + * the C++ binding method with the elm_win_util_standard_add that is a + * elm_win_legacy function, better explained below. And then we set + * the autohide state for it. + + * @p elm_win_util_standard_add (const char *name, const char *tittle) + * Adds a window object with standard setup. + * Parameters: + + * @li @p name - The name of the window; + + * @li @p title - The title for the window. + + * This creates a window but also puts in a standard background with + * @p elm_bg_add(), as well as setting the window title to @p + * title. The window type created is of type @c ELM_WIN_BASIC, with + * the @c NULL as the parent widget. Returns the created object or @c + * NULL on failure. + + * The autohide works similarly to @p autodel, automatically handling + * "delete,request" signals when set to @p true, with the difference + * that it will hide the window, instead of destroying it. + + * It is specially designed to work together with @p + * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting + * Elementary's main loop when all the windows are hidden. + + * @skip ::elm::win + * @until autohide_set + + * @note @p autodel and @a autohide are not mutually exclusive. The + * window will be destructed if both autodel and autohide is set to @p + * EINA_TRUE or @p true. + + * Next we'll create a evas::rectangle to use as the icon of our menu + * for thus using the C++ method, adding our rect as a resize-object + * to win informing that when the size of the win changes so should + * the box's size. + + * @skip evas + * @until resize + + * We'll also set, for rect, the hint for it's minimum size, it's + * color and making it visible. + + * @skip size + * @until visibility + + * Creating the menu using the C++ method, setting it's parent and + * adding an item to this menu. We are going to add more items, but + * these icons are going to have a parent, which will put them in a + * sub-menu. + + * @skip menu + * @until "menu 1" + + * We'll add a button to a menu_item, where this button will delete + * the first item of our sub-menu when clicked, we'll do this + * using @p elm_object_item_content_set(). + + * @skip button + * @until content_set + + * Now, for the callback that will be used in this button we're use + * lambda type function and then add as clicked callback to button. + + * @skip del_it + * @until clicked + + * @see To learn more about consult @ref lambda. + + * We now add a separator and three more regular items: + + * @until item_add + * @until item_add + * @until item_add + + * We now add another item, however this time it won't go the sub-menu + * and it'll be disabled: + + * @until disabled_set + + * To make sure that our menu is shown whenever the window is + * clicked, we use the following callback, also lambda: + + * @skip show + * @until ( show ); + + * Finally. we just make menu visible, set a size for our window + * making it visible and then start the elm mainloop, starting to + * handle events and drawing operations. + + * @skip visibility + * @until ELM_MAIN + + * Our example will look like this: + + * @image html screenshots/menu_cxx_example_01.png + * @image latex screenshots/menu_cxx_example_01.eps width=\textwidth + + * @example menu_cxx_example_01.cc + */ + +/** + * @page popup_cxx_example_01 Popup example with C++ Binding + * @dontinclude popup_cxx_example_01.cc + + * The first part consists of including the headers. In this + * case we are only working with the Elementary C++ binding and thus + * we need only to include him. + + * @skipline Elementary.hh + + * @attention If necessary the C and/or the C++ headers should be + * include here as well. + + * Now we need to actually start the code and set the elm_policy, + * which defines for a given policy group/identifier a new policy's + * value, respectively. In this example the only policy we need to + * set a value for is @c ELM_POLICY_QUIT, possibles values for it are: + + * @li @p ELM_POLICY_QUIT_NONE: Never quit the application + * automatically; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the + * application's last window is closed; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the + * application's last window is hidden; + + * @skip EAPI_MAIN + * @until elm_policy_set + + * As you can see, the policy we chose was to quit when the last win + * is hidden as opose to examples with the C bindings where we + * perpetually set it to quit when last win was closed. This changed + * was necessary because in C++ binding as the elm mainloop stop + * running all object are destroyed, references are unreferenced and + * events are stopped at ELM_MAIN(). + + * @see For more details consult elm_policy_set + + * Next step is creating an Elementary window, in this example we use + * the C++ binding method with the elm_win_util_standard_add that is a + * elm_win_legacy function, better explained below. And then we set + * the autohide state for it. + + * @p elm_win_util_standard_add (const char *name, const char *tittle) + * Adds a window object with standard setup. + + * Parameters: + + * @li @p name - The name of the window; + + * @li @p title - The title for the window. + + * This creates a window but also puts in a standard background with + * @p elm_bg_add(), as well as setting the window title to @p + * title. The window type created is of type @c ELM_WIN_BASIC, with + * the @c NULL as the parent widget. Returns the created object or @c + * NULL on failure. + + * The autohide works similarly to @p autodel, automatically handling + * "delete,request" signals when set to @p true, with the difference + * that it will hide the window, instead of destroying it. + + * It is specially designed to work together with @p + * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting + * Elementary's main loop when all the windows are hidden. + + * @skip ::elm::win + * @until autohide_set + + * @note @p autodel and @a autohide are not mutually exclusive. The + * window will be destructed if both autodel and autohide is set to @p + * EINA_TRUE or @p true. + + * Now let's create the label with the C++ binding method, passing our + * window object as parent. We'll also set to this label the text that + * we'll use later on the popup. + + * @skip elm::label + * @until text + + * Using the same method we'll create our popup passing our window + * object as parent. We'll also set the timeout to 3.0 seconds, label + * as content, the title and visibility true for our popup. + + * @skip elm::popup + * @until visibility + + * Our popup will hide every time the lambda type function is called. + * The lambda function get the popup object by reference and set it's + * visibility to false, making it invisible. In this example we are + * using @a std::bind to bind the parameters of our lambda function to + * return as @a std::function object to popup_hide which was declare + * as auto. + + * @skip popup_hide + * @until }); + + * To learn more consult @ref lambda. + + * In this example we'll add the popup_hide in the timeout callback + * and the block_clicked callback. This results in hiding the popup in + * maximum of 3.0 seconds or when the popup block is clicked. + + * @skip timeout + * @until block + + * Finally we just have to make our window visible and set it's size, + * then run the elm mainloop, starting to handle events and drawing + * operations. + + * @skip visibility + * @until ELM_MAIN + + * This example will initially look like this: + + * @image html screenshots/popup_cxx_example_01.png + * @image latex screenshots/popup_cxx_example_01.eps width=\textwidth + + * Once the popup is hidden after timeout: + + * @image html screenshots/popup_cxx_example_01_a.png + * @image latex screenshots/popup_cxx_example_01_a.eps width=\textwidth + + * @example popup_cxx_example_01.cc + */ + +/** + * @page radio_cxx_example_01 Radio example with C++ Binding + * @dontinclude radio_cxx_example_01.cc + + * In this example we will create 4 radios, and add them to the same + * group. We will also have the radios in the group change the value + * of a variable directly and have then print it when the value + * changes. + + * The first part consists of including the headers. In this + * case we are only working with the Elementary C++ binding and thus + * we need only to include him. + + * @skipline Elementary.hh + + * @attention If necessary the C and/or the C++ headers should be + * include here as well. + + * Now we need to actually start the code and set the elm_policy, + * which defines for a given policy group/identifier a new policy's + * value, respectively. In this example the only policy we need to + * set a value for is @c ELM_POLICY_QUIT, possibles values for it are: + + * @li @p ELM_POLICY_QUIT_NONE: Never quit the application + * automatically; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the + * application's last window is closed; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the + * application's last window is hidden; + + * @skip EAPI_MAIN + * @until elm_policy_set + + * As you can see, the policy we chose was to quit when the last win + * is hidden as opose to examples with the C bindings where we + * perpetually set it to quit when last win was closed. This changed + * was necessary because in C++ binding as the elm mainloop stop + * running all object are destroyed, references are unreferenced and + * events are stopped at ELM_MAIN(). + + * @see For more details consult elm_policy_set + + * And move right to declaring a static variable, the one whose value + * the radios will change: + + * @skipline static + + * Next step is creating an Elementary window, in this example we use + * the C++ binding method with the elm_win_util_standard_add that is a + * elm_win_legacy function, better explained below. And then we set + * the autohide state for it. + + * @p elm_win_util_standard_add (const char *name, const char *tittle) + * Adds a window object with standard setup. + + * Parameters: + + * @li @p name - The name of the window; + + * @li @p title - The title for the window. + + * This creates a window but also puts in a standard background with + * @p elm_bg_add(), as well as setting the window title to @p + * title. The window type created is of type @c ELM_WIN_BASIC, with + * the @c NULL as the parent widget. Returns the created object or @c + * NULL on failure. + + * The autohide works similarly to @p autodel, automatically handling + * "delete,request" signals when set to @p true, with the difference + * that it will hide the window, instead of destroying it. + + * It is specially designed to work together with @p + * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting + * Elementary's main loop when all the windows are hidden. + + * @skip ::elm::win + * @until autohide_set + + * @note @p autodel and @a autohide are not mutually exclusive. The + * window will be destructed if both autodel and autohide is set to @p + * EINA_TRUE or @p true. + + * A box arranges objects in a linear fashion, governed by a layout + * function that defines the details of this arrangement. The box will + * use an internal function to set the layout to a single row, + * vertical by default. + + * Now let's create the box with the C++ binding method, passing our + * window object as parent and then setting box's layout as + * horizontal. + + * @skipline elm::box + * @until horizontal + + * To better understand, the function @c size_hint_weight_set for C++ + * bindings originated from C bindings function + * evas_object_size_hint_weight_set, that is EFL Evas type function. + * With this function we set the hints for an object's weight. The + * parameters are: + + * @li x - Nonnegative double value to use as horizontal weight hint. + + * @li y - Nonnegative double value to use as vertical weight hint. + + * This is not a size enforcement in any way, it's just a hint that + * should be used whenever appropriate. This is a hint on how a + * container object should resize a given child within its area. + + * Containers may adhere to the simpler logic of just expanding the + * child object's dimensions to fit its own (see the EVAS_HINT_EXPAND + * helper weight macro in the EFL Evas Documentation) or the complete + * one of taking each child's weight hint as real weights to how much + * of its size to allocate for them in each axis. A container is + * supposed to, after normalizing the weights of its children (with + * weight hints), distribute the space it has to layout them by those + * factors – most weighted children get larger in this process than + * the least ones. + + * @skipline weight_set + + * @note Default weight hint values are 0.0, for both axis. + + * Now we add the box as a resize_object to win informing that when + * the size of the win changes so should the box's size. And finally + * we make it visible. + + * @skip win + * @until visibility_set + + * Radio is a widget that allows for one or more options to be + * displayed and have the user choose only one of them. It contains an + * indicator, an optional label and an optional icon object. While + * it's possible to have a group of only one radio they, are normally + * used in groups of 2 or more. + + * We will create the box with the C++ binding method, passing our + * window object as parent and then setting box's layout as + * horizontal. + + * And now we create a radio with the C++ binding method, passing our + * window object as parent. Since this is the first radio in our group + * we set the group to be the radio, so we can set the other radios in + * the same group. + + * @skip radio + * @until radio; + + * We also set the text, then state value of this radio to 1 and + * the value pointer to @p val, since val is @p 1 this has the + * additional effect of setting the radio value to @p 1. + + * @skip text + * @until pointer + + * For this radio we choose the standard home icon, the icon will be + * created with the same method and setting the icon as content of + * radio. + + * @skip icon + * @until content + + * When using the elm::box the packing method of the subobj - radio + * in this case - should be defined. There are four possible methods: + + * @li @c pack_start(subobj_) - Add an object to the beginning of the + * pack list. Pack @c subobj_ into the box obj, placing it first in + * the list of children objects. The actual position the object will + * get on screen depends on the layout used. If no custom layout is + * set, it will be at the top or left, depending if the box is + * vertical or horizontal, respectively. + + * @li @c pack_end(subobj_) - Add an object at the end of the pack + * list. Pack @c subobj_ into the box obj, placing it last in the list + * of children objects. The actual position the object will get on + * screen depends on the layout used. If no custom layout is set, it + * will be at the bottom or right, depending if the box is vertical or + * horizontal, respectively. + + * @li @c pack_before(subobj_, before_) - Adds an object to the box + * before the indicated object. This will add the @c subobj_ to the + * box indicated before the object indicated with @c before_. If + * before is not already in the box, results are undefined. Before + * means either to the left of the indicated object or above it + * depending on orientation. + + * @li @c pack_after(subobj_, after_) - Adds an object to the box + * after the indicated object. This will add the @c subobj_ to the box + * indicated after the object indicated with @c after_. If after is + * not already in the box, results are undefined. After means either + * to the right of the indicated object or below it depending on + * orientation. + + * In this and most examples we use pack_end by choice and + * practicality. + + * @skipline pack_end + + * The function size_hint_weight_set works with radio the same way + * as with box, as above. + + * @skipline weight_set + + * The function @c size_hint_align_set for C++ bindings originated + * from C bindings function evas_object_size_hint_align_set, that is + * EFL Evas type function. With this function we set the hints for an + * object's alignment. The parameters are: + + * @li x - Double, ranging from 0.0 to 1.0 or with the special value + * EVAS_HINT_FILL, to use as horizontal alignment hint. + + * @li y - Double, ranging from 0.0 to 1.0 or with the special value + * EVAS_HINT_FILL, to use as vertical alignment hint. + + * These are hints on how to align an object inside the boundaries of + * a container/manager. Accepted values are in the 0.0 to 1.0 range, + * with the special value EVAS_HINT_FILL used to specify "justify" or + * "fill" by some users. In this case, maximum size hints should be + * enforced with higher priority, if they are set. Also, any padding + * hint set on objects should add up to the alignment space on the + * final scene composition. + + * For the horizontal component, 0.0 means to the left, 1.0 means to + * the right. Analogously, for the vertical component, 0.0 to the top, + * 1.0 means to the bottom. + + * This is not a size enforcement in any way, it's just a hint that + * should be used whenever appropriate. + + * @skipline align_set + + * @note Default alignment hint values are 0.5, for both axis. + + * To end the settings of radio we'll make it visible and with our + * lambda type function we output the current value of @p val. In this + * example we are using @a std::bind to bind the parameters of our + * lambda function to return as @a std::function object to @p cb_val + * which was declare as @p auto. Now we just have to add @p cb_val as + * changed radio callback of our radio. + + * @skip visibility + * @until changed + + * @see To learn more consult @ref lambda. + + * The creation of our second radio is almost identical, using the + * same method we create radio2 passing win as parent. We also set the + * text, then state value of this radio to 2 and the value pointer to + * @p val. This radio will be added in the same group as the first + * radio. + + * @skip text + * @until group + + * Then we set the standard file icon, the icon will be created with + * the same method and then set the icon as content of radio. + + * @skip ic2 + * @until content + + * As before, we set packing method of radio2 in the box, the weight, + * alignment and visibility of radio2. Then add cb_val as callback + * when the radio changes. + + * @skip pack + * @until changed + + * For our third and fourth radios we'll omit the icon and set the + * value to 3 and 4, respectively, we'll also add them to the group of + * the first radio: + + * @skip radio3 + * @until radio4.callback + + * Finally we just have to make our window visible and set it's size, + * then run the elm mainloop, starting to handle events and drawing + * operations. + + * @skip visibility + * @until ELM_MAIN + + * The full code for this example can be found at @ref radio_cxx_example_01.cc + + * The example will look like this: + + * @image html screenshots/radio_cxx_example_01.png + * @image latex screenshots/radio_cxx_example_01.eps width=\textwidth + + * @example radio_cxx_example_01.cc + */ + +/** + * @page separator_cxx_example_01 Separator with C++ Binding + * @dontinclude separator_cxx_example_01.cc + + * Separator is a very thin object used to separate other objects, + * wich can be vertical or horizontal. + + * This example shows how to create a window and separate in two + * parts, each one will be filled with a background color to show the + * division. The @a separator is used to visually mark the division + * between two parts. + + * The first part consists of including the headers. In this case we + * are only working with the Elementary and Evas C++ bindings. + + * @skip Elementary.hh + * @until Evas + + * @attention If necessary the C and/or the C++ headers should be + * include here as well. + + * Now we need to actually start the code and set the elm_policy, + * which defines for a given policy group/identifier a new policy's + * value, respectively. In this example the only policy we need to + * set a value for is @c ELM_POLICY_QUIT, possibles values for it are: + + * @li @p ELM_POLICY_QUIT_NONE: Never quit the application + * automatically; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the + * application's last window is closed; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the + * application's last window is hidden; + + * @n @skip EAPI_MAIN int + * @until elm_policy_set + + * As you can see, the policy we chose was to quit when the last win + * is hidden as opose to examples with the C bindings where we + * perpetually set it to quit when last win was closed. This changed + * was necessary because in C++ binding as the elm mainloop stop + * running all object are destroyed, references are unreferenced and + * events at ELM_MAIN() because of this. ?? + + * @see elm_policy_set() + + * Next step is creating an Elementary window, where win calls a + * constructor and sets the type of the win to ELM_WIN_BASIC + * (Elm_Win_Type), which is the indicated type for most of our + * examples. Here we also set the title that will appear at the top of + * our window and then the autohide state for it. + + * The autohide works similarly to @p autodel, automatically handling + * "delete,request" signals when set to @p true, with the difference + * that it will hide the window, instead of destroying it. + + * It is specially designed to work together with @p + * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting + * Elementary's main loop when all the windows are hidden. + + * @skip ::elm::win + * @until autohide_set + + * @note @p autodel and @a autohide are not mutually exclusive. The + * window will be destructed if both autodel and autohide is set to @p + * EINA_TRUE or @p true. + + * Now let's create the background with the C++ binding method, passing + * our window as parent. + + * @skipline elm::bg + + * The function @c size_hint_weight_set for C++ bindings originated + * from C bindings function evas_object_size_hint_weight_set, that is + * EFL Evas type function. With this function we set the hints for an + * object's weight. The parameters are: + + * @li x - Nonnegative double value to use as horizontal weight hint. + + * @li y - Nonnegative double value to use as vertical weight hint. + + * This is not a size enforcement in any way, it's just a hint that + * should be used whenever appropriate. This is a hint on how a + * container object should resize a given child within its area. + + * Containers may adhere to the simpler logic of just expanding the + * child object's dimensions to fit its own (see the EVAS_HINT_EXPAND + * helper weight macro in the EFL Evas Documentation) or the complete + * one of taking each child's weight hint as real weights to how much + * of its size to allocate for them in each axis. A container is + * supposed to, after normalizing the weights of its children (with + * weight hints), distribute the space it has to layout them by those + * factors – most weighted children get larger in this process than + * the least ones. + + * @skipline weight_set + + * @note Default weight hint values are 0.0, for both axis. + + * Now we add the background as a resize-object to win informing that + * when the size of the win changes so should the background's size + * and setting it's visibility. You can change the background's color + * using color_set, if not, the default color will be used. + + * @skip win + * @until visibility_set + + * To put a box in the window we also need to set it's parent. By + * default, box object arranges their contents vertically from top to + * bottom. By calling this function with horizontal as @a true, the + * box will become horizontal, arranging contents from left to right. + + * @skip ::elm::box + * @until horizontal + + * The value that we set EFL Evas function size_hint_weight_set + * expands the box to cover all win's area and adding it as a + * resize_object to win informing that when the size of the win + * changes so should the box's size. In the end we make the box + * visible. + + * @skip weight + * @until visibility + + * Now we create a retangle, like before, we just need to setting it's + * parent. After created, we set the color to show the difference + * between the next rectangle and define the minimun size of each side + * by using size_hint_min_set(minimum width, minimum height). + + * @skip rect + * @until min_set + + * As in the background, the value we set EFL Evas function + * size_hint_weight_set expands the background to cover all area + * defined in size_hint_min_set. We also need to expand the rectangle + * to fill the area if the win's size change, if not, win can change + * it's size and the rectangle will only fill it's own previous area. + + * @until weight + + * The function @c size_hint_align_set for C++ bindings originated + * from C bindings function evas_object_size_hint_align_set, that is + * EFL Evas type function. With this function we set the hints for an + * object's alignment. The parameters are: + + * @li x - Double, ranging from 0.0 to 1.0 or with the special value + * EVAS_HINT_FILL, to use as horizontal alignment hint. + + * @li y - Double, ranging from 0.0 to 1.0 or with the special value + * EVAS_HINT_FILL, to use as vertical alignment hint. + + * These are hints on how to align an object inside the boundaries of + * a container/manager. Accepted values are in the 0.0 to 1.0 range, + * with the special value EVAS_HINT_FILL used to specify "justify" or + * "fill" by some users. In this case, maximum size hints should be + * enforced with higher priority, if they are set. Also, any padding + * hint set on objects should add up to the alignment space on the + * final scene composition. + + * For the horizontal component, 0.0 means to the left, 1.0 means to + * the right. Analogously, for the vertical component, 0.0 to the top, + * 1.0 means to the bottom. + + * This is not a size enforcement in any way, it's just a hint that + * should be used whenever appropriate. + + * @skipline align_set + + * @note Default alignment hint values are 0.5, for both axis. + + * Now we only need to set the visibility of the rectangle and add our + * retangle to box with the packing method of the subobj - rectangle + * in this case. There are four possible methods: + + * @li @c pack_start(subobj_) - Add an object to the beginning of the + * pack list. Pack @c subobj_ into the box obj, placing it first in + * the list of children objects. The actual position the object will + * get on screen depends on the layout used. If no custom layout is + * set, it will be at the top or left, depending if the box is + * vertical or horizontal, respectively. + + * @li @c pack_end(subobj_) - Add an object at the end of the pack + * list. Pack @c subobj_ into the box obj, placing it last in the list + * of children objects. The actual position the object will get on + * screen depends on the layout used. If no custom layout is set, it + * will be at the bottom or right, depending if the box is vertical or + * horizontal, respectively. + + * @li @c pack_before(subobj_, before_) - Adds an object to the box + * before the indicated object. This will add the @c subobj_ to the + * box indicated before the object indicated with @c before_. If + * before is not already in the box, results are undefined. Before + * means either to the left of the indicated object or above it + * depending on orientation. + + * @li @c pack_after(subobj_, after_) - Adds an object to the box + * after the indicated object. This will add the @c subobj_ to the box + * indicated after the object indicated with @c after_. If after is + * not already in the box, results are undefined. After means either + * to the right of the indicated object or below it depending on + * orientation. + + * In this and most examples we use pack_end by choice and + * practicality. In this part of the code we also make rectangle + * visible. + + * @skip visibility + * @until pack + + * Once we have our first rectangle in the box we create and add our + * separator. Using the same approach, we setting it's parent. Since + * our box is in horizontal mode it's a good idea to set the separator + * to be horizontal too. Finishing with the visibility and packing + * method. + + * @skip elm::separator + * @until pack + + * After all this, we just need to create another rectangle, setting + * the color, size hints, make rect2 visible and packing in the + * box. Don't forget to set the win's visibility as true. + + * @skip rect2 + * @until win.visibility + + * Finally we just have to start the elm mainloop, starting to handle + * events and drawing operations. + + * @skip elm_run + * @until ELM_MAIN() + + * The full code for this example can be found at @ref separator_cxx_example_01.cc . + + * This example will look like: + + * @image html screenshots/separator_cxx_example_01.png + * @image latex screenshots/separator_cxx_example_01.eps width=\textwidth + + * @example separator_cxx_example_01.cc + */ + +/** + * @page slider_cxx_example Slider widget example with C++ Binding + * @dontinclude slider_cxx_example.cc + + * This code places seven Elementary slider widgets on a window, each of + * them exemplifying a part of the widget's API. + + * The first part consists of including the headers. In this + * case we are only working with the Elementary C++ binding and thus + * we need only to include him. + + * @skipline Elementary.hh + + * @attention If necessary the C and/or the C++ headers should be + * include here as well. + + * Now we need to actually start the code and set the elm_policy, + * which defines for a given policy group/identifier a new policy's + * value, respectively. In this example the only policy we need to + * set a value for is @c ELM_POLICY_QUIT, possibles values for it are: + + * @li @p ELM_POLICY_QUIT_NONE: Never quit the application + * automatically; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the + * application's last window is closed; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the + * application's last window is hidden; + + * @skip EAPI_MAIN + * @until elm_policy_set + + * As you can see, the policy we chose was to quit when the last win + * is hidden as opose to examples with the C bindings where we + * perpetually set it to quit when last win was closed. This changed + * was necessary because in C++ binding as the elm mainloop stop + * running all object are destroyed, references are unreferenced and + * events are stopped at ELM_MAIN(). + + * @see For more details consult elm_policy_set + + * Next step is creating an Elementary window, in this example we use + * the C++ binding method with the elm_win_util_standard_add that is a + * elm_win_legacy function, better explained below. And then we set + * the autohide state for it. + + * @p elm_win_util_standard_add (const char *name, const char *tittle) + * Adds a window object with standard setup. + + * Parameters: + + * @li @p name - The name of the window; + + * @li @p title - The title for the window. + + * This creates a window but also puts in a standard background with + * @p elm_bg_add(), as well as setting the window title to @p + * title. The window type created is of type @c ELM_WIN_BASIC, with + * the @c NULL as the parent widget. Returns the created object or @c + * NULL on failure. + + * The autohide works similarly to @p autodel, automatically handling + * "delete,request" signals when set to @p true, with the difference + * that it will hide the window, instead of destroying it. + + * It is specially designed to work together with @p + * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting + * Elementary's main loop when all the windows are hidden. + + * @skip ::elm::win + * @until autohide_set + + * @note @p autodel and @a autohide are not mutually exclusive. The + * window will be destructed if both autodel and autohide is set to @p + * EINA_TRUE or @p true. + + * Now let's create a box with the C++ binding method, passing our + * window object as parent, we'll use this box to contain our slider + * object. + + * @skipline bx + + * To better understand, the function @c size_hint_weight_set for C++ + * bindings originated from C bindings function + * evas_object_size_hint_weight_set, that is EFL Evas type function. + * With this function we set the hints for an object's weight. The + * parameters are: + + * @li x - Nonnegative double value to use as horizontal weight hint. + + * @li y - Nonnegative double value to use as vertical weight hint. + + * This is not a size enforcement in any way, it's just a hint that + * should be used whenever appropriate. This is a hint on how a + * container object should resize a given child within its area. + + * Containers may adhere to the simpler logic of just expanding the + * child object's dimensions to fit its own (see the EVAS_HINT_EXPAND + * helper weight macro in the EFL Evas Documentation) or the complete + * one of taking each child's weight hint as real weights to how much + * of its size to allocate for them in each axis. A container is + * supposed to, after normalizing the weights of its children (with + * weight hints), distribute the space it has to layout them by those + * factors – most weighted children get larger in this process than + * the least ones. + + * @skipline weight_set + + * @note Default weight hint values are 0.0, for both axis. + + * Then we add the box as a resize-object to win informing that when + * the size of the win changes so should the box's size. Remember + * always to set the box visibility to true. + + * @skip win + * @until visibility + + * Now we'll create our slider, using the C++ binding method and set + * it's size hint that works with slider the same way as with box, for + * more, look above. This is the default slider. + + * @skip slider + * @until weight + + * The function @c size_hint_align_set for C++ bindings originated + * from C bindings function evas_object_size_hint_align_set, that is + * EFL Evas type function. With this function we set the hints for an + * object's alignment. The parameters are: + + * @li x - Double, ranging from 0.0 to 1.0 or with the special value + * EVAS_HINT_FILL, to use as horizontal alignment hint. + + * @li y - Double, ranging from 0.0 to 1.0 or with the special value + * EVAS_HINT_FILL, to use as vertical alignment hint. + + * These are hints on how to align an object inside the boundaries of + * a container/manager. Accepted values are in the 0.0 to 1.0 range, + * with the special value EVAS_HINT_FILL used to specify "justify" or + * "fill" by some users. In this case, maximum size hints should be + * enforced with higher priority, if they are set. Also, any padding + * hint set on objects should add up to the alignment space on the + * final scene composition. + + * For the horizontal component, 0.0 means to the left, 1.0 means to + * the right. Analogously, for the vertical component, 0.0 to the top, + * 1.0 means to the bottom. + + * This is not a size enforcement in any way, it's just a hint that + * should be used whenever appropriate. + + * @skipline align + + * @note Default alignment hint values are 0.5, for both axis. + + * When using the elm box the packing method of the subobj - slider + * in this case - should be defined. There are four possible methods: + + * @li @c pack_start(subobj_) - Add an object to the beginning of the + * pack list. Pack @c subobj_ into the box obj, placing it first in + * the list of children objects. The actual position the object will + * get on screen depends on the layout used. If no custom layout is + * set, it will be at the top or left, depending if the box is + * vertical or horizontal, respectively. + + * @li @c pack_end(subobj_) - Add an object at the end of the pack + * list. Pack @c subobj_ into the box obj, placing it last in the list + * of children objects. The actual position the object will get on + * screen depends on the layout used. If no custom layout is set, it + * will be at the bottom or right, depending if the box is vertical or + * horizontal, respectively. + + * @li @c pack_before(subobj_, before_) - Adds an object to the box + * before the indicated object. This will add the @c subobj_ to the + * box indicated before the object indicated with @c before_. If + * before is not already in the box, results are undefined. Before + * means either to the left of the indicated object or above it + * depending on orientation. + + * @li @c pack_after(subobj_, after_) - Adds an object to the box + * after the indicated object. This will add the @c subobj_ to the box + * indicated after the object indicated with @c after_. If after is + * not already in the box, results are undefined. After means either + * to the right of the indicated object or below it depending on + * orientation. + + * In this and most examples we use pack_end by choice and + * practicality, in this part of the code we also make slider visible. + + * @skip pack + * @until visibility + + * 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. + + * Creating the second slider, the difference being that we set a text + * and two icons. + + * @skip slider + * @until text + + * Creating the first icon as standard "home" and not resizable and + * finally add icon as content for the second slider. + + * @skip icon + * @until content + + * Our second icon is the standard "folder", also not resizable and + * with add it also to the second slider. + + * @skip ic2 + * @until content + + * The same as before, the size hints weight, align will be setted and + * the packing method for the second slider. Also making it visible. + + * @skip align + * @until visibility + + * 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: + + * @skip slider + * @until visibility + + * 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, by default it uses 0.0 and 1.0: + + * @skip slider + * @until visibility + + * 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: + + * @skip slider + * @until visibility + + * 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. For this we suggest you + * use a lambda type function. + + * @skip slider + * @until }; + + * In this case, a function to free this will be required, also a + * Lambda. + + * @skipline auto + + * @see To learn more consult @ref lambda. + + * Now we add our two labdas as indicators for our sixth slider and + * set the hints, packing method and visibility for our slider. + + * @skip indicator + * @until visibility + + * For our seventh slider we'll show that slider can also be displayed + * vertically: + + * @skip slider + * @until visibility + + * Finally the last slider will exemplify how to listen to slider's + * signals, changed and delay,changed . First we + * need to implement callback functions that will simply print + * slider's value, using lambda again: + + * @skip changed + * @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 callback + * @until callback_delay + + * Finally we just have to make our window visible. Then run the elm + * mainloop, starting to handle events and drawing operations. + + * @skip visibility + * @until ELM_MAIN + + * See the full @ref slider_cxx_example.cc "example", whose window should + * look like this picture: + + * @image html screenshots/slider_cxx_example.png + * @image latex screenshots/slider_cxx_example.eps width=\textwidth + + * @example slider_cxx_example.cc + */ + +/** + * @page spinner_cxx_example Spinner widget example with C++ Binding + * @dontinclude spinner_cxx_example.cc + + * This code places seven Elementary spinner widgets on a window, each of + * them exemplifying a part of the widget's API. + + * The first part consists of including the headers. In this + * case we are only working with the Elementary C++ binding and thus + * we need only to include him. + + * @skipline Elementary.hh + + * @attention If necessary the C and/or the C++ headers should be + * include here as well. + + * Now we need to actually start the code and set the elm_policy, + * which defines for a given policy group/identifier a new policy's + * value, respectively. In this example the only policy we need to + * set a value for is @c ELM_POLICY_QUIT, possibles values for it are: + + * @li @p ELM_POLICY_QUIT_NONE: Never quit the application + * automatically; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the + * application's last window is closed; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the + * application's last window is hidden; + + * @skip EAPI_MAIN + * @until elm_policy_set + + * As you can see, the policy we chose was to quit when the last win + * is hidden as opose to examples with the C bindings where we + * perpetually set it to quit when last win was closed. This changed + * was necessary because in C++ binding as the elm mainloop stop + * running all object are destroyed, references are unreferenced and + * events are stopped at ELM_MAIN(). + + * @see For more details consult elm_policy_set + + * Next step is creating an Elementary window, in this example we use + * the C++ binding method with the elm_win_util_standard_add that is a + * elm_win_legacy function, better explained below. And then we set + * the autohide state for it. + + * @p elm_win_util_standard_add (const char *name, const char *tittle) + * Adds a window object with standard setup. + + * Parameters: + + * @li @p name - The name of the window; + + * @li @p title - The title for the window. + + * This creates a window but also puts in a standard background with + * @p elm_bg_add(), as well as setting the window title to @p + * title. The window type created is of type @c ELM_WIN_BASIC, with + * the @c NULL as the parent widget. Returns the created object or @c + * NULL on failure. + + * The autohide works similarly to @p autodel, automatically handling + * "delete,request" signals when set to @p true, with the difference + * that it will hide the window, instead of destroying it. + + * It is specially designed to work together with @p + * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting + * Elementary's main loop when all the windows are hidden. + + * @skip ::elm::win + * @until autohide_set + + * @note @p autodel and @a autohide are not mutually exclusive. The + * window will be destructed if both autodel and autohide is set to @p + * EINA_TRUE or @p true. + + * A box arranges objects in a linear fashion, governed by a layout + * function that defines the details of this arrangement. The box will + * use an internal function to set the layout to a single row, + * vertical by default. + + * Now let's create the box with the C++ binding method, passing our + * window object as parent. + + * @skipline elm::box + + * To better understand, the function @c size_hint_weight_set for C++ + * bindings originated from C bindings function + * evas_object_size_hint_weight_set, that is EFL Evas type function. + * With this function we set the hints for an object's weight. The + * parameters are: + + * @li x - Nonnegative double value to use as horizontal weight hint. + + * @li y - Nonnegative double value to use as vertical weight hint. + + * This is not a size enforcement in any way, it's just a hint that + * should be used whenever appropriate. This is a hint on how a + * container object should resize a given child within its area. + + * Containers may adhere to the simpler logic of just expanding the + * child object's dimensions to fit its own (see the EVAS_HINT_EXPAND + * helper weight macro in the EFL Evas Documentation) or the complete + * one of taking each child's weight hint as real weights to how much + * of its size to allocate for them in each axis. A container is + * supposed to, after normalizing the weights of its children (with + * weight hints), distribute the space it has to layout them by those + * factors – most weighted children get larger in this process than + * the least ones. + + * @skipline weight_set + + * @note Default weight hint values are 0.0, for both axis. + + * Now we add the box as a resize_object to win informing that + * when the size of the win changes so should the box's + * size. And finally we make it visible. + + * @skip win + * @until visibility_set + + * Now we create our spinner with the C++ method, this first one will + * the default spinner. + + * @skipline spinner + + * 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" + + * The function size_hint_weight_set works with spinner the same way + * as with box, as seem above. + + * @skipline weight_set + + * The function @c size_hint_align_set for C++ bindings originated + * from C bindings function evas_object_size_hint_align_set, that is + * EFL Evas type function. With this function we set the hints for an + * object's alignment. The parameters are: + + * @li x - Double, ranging from 0.0 to 1.0 or with the special value + * EVAS_HINT_FILL, to use as horizontal alignment hint. + + * @li y - Double, ranging from 0.0 to 1.0 or with the special value + * EVAS_HINT_FILL, to use as vertical alignment hint. + + * These are hints on how to align an object inside the boundaries of + * a container/manager. Accepted values are in the 0.0 to 1.0 range, + * with the special value EVAS_HINT_FILL used to specify "justify" or + * "fill" by some users. In this case, maximum size hints should be + * enforced with higher priority, if they are set. Also, any padding + * hint set on objects should add up to the alignment space on the + * final scene composition. + + * For the horizontal component, 0.0 means to the left, 1.0 means to + * the right. Analogously, for the vertical component, 0.0 to the top, + * 1.0 means to the bottom. + + * This is not a size enforcement in any way, it's just a hint that + * should be used whenever appropriate. + + * @skipline align_set + + * @note Default alignment hint values are 0.5, for both axis. + + * When using the elm::box the packing method of the subobj - spinner + * in this case - should be defined. There are four possible methods: + + * @li @c pack_start(subobj_) - Add an object to the beginning of the + * pack list. Pack @c subobj_ into the box obj, placing it first in + * the list of children objects. The actual position the object will + * get on screen depends on the layout used. If no custom layout is + * set, it will be at the top or left, depending if the box is + * vertical or horizontal, respectively. + + * @li @c pack_end(subobj_) - Add an object at the end of the pack + * list. Pack @c subobj_ into the box obj, placing it last in the list + * of children objects. The actual position the object will get on + * screen depends on the layout used. If no custom layout is set, it + * will be at the bottom or right, depending if the box is vertical or + * horizontal, respectively. + + * @li @c pack_before(subobj_, before_) - Adds an object to the box + * before the indicated object. This will add the @c subobj_ to the + * box indicated before the object indicated with @c before_. If + * before is not already in the box, results are undefined. Before + * means either to the left of the indicated object or above it + * depending on orientation. + + * @li @c pack_after(subobj_, after_) - Adds an object to the box + * after the indicated object. This will add the @c subobj_ to the box + * indicated after the object indicated with @c after_. If after is + * not already in the box, results are undefined. After means either + * to the right of the indicated object or below it depending on + * orientation. + + * In this and most examples we use pack_end by choice and + * practicality. In this part of the code we also make spinner + * visible. + + * @skip pack_end + * @until visibility + + * In our second spinner we are altering the format. It will put a + * text before and after the value, and also format value to display + * two decimals. As with the first spinner, we create the second with + * the same C++ method, set the alignment and the weight, choose the + * packing method and make it visible. + + * @skip spinner + * @until visibility + + * 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: + + * @skip spinner + * @until visibility + + * 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. + + * @skip spinner + * @until visibility + + * In the fifth the user won't be allowed to set value directly, i.e., will + * be obligate change value only using arrows: + + * @skip spinner + * @until visibility + + * 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: + + * @skip spinner + * @until visibility + + * Finally the last widget will exemplify how to listen to widget's + * signals, changed and delay_changed . + + * We start the same way as previously, creating spinner, setting + * alignment and weight, choosing the packing method, making it + * visible and editable. + + * @skip spinner + * @until editable + + * Our spinner will output it's value or delay value every time the + * std::function object is called. In this example we are using @a + * std::bind to bind the parameters of each lambda function, that + * captures sp7 by reference and then get it's value or delay value to + * finally output it. + + * The first function changed, that was declare as auto, will output + * the new value. For this we need to add it to the + * @p callback_changed + + * @skip changed + * @until callback + + * The second function changed, that was also declare as auto, will + * output the new delay value. For this we need to add it to the @p + * callback_delay_changed. + + * @skip delay + * @until callback + + * To learn more consult @ref lambda. + + * 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. + + * Finally we just have to make our window visible. Then run the elm + * mainloop, starting to handle events and drawing operations. + + * @skip visibility + * @until ELM_MAIN + + * See the full code for this example at @ref spinner_cxx_example.cc . + + * This example will look like this: + + * @image html screenshots/spinner_cxx_example.png + * @image latex screenshots/spinner_cxx_example.eps width=\textwidth + * @example spinner_cxx_example.cc + */ + +/** + * @page table_cxx_example_01 Table Example with C++ binding - Homogeneous + * @dontinclude table_cxx_example_01.cc + + * In this example we add four labels to a homogeneous table that has a padding + * of 5px between cells. + + * The first part consists of including the headers. In this + * case we are only working with the Elementary C++ binding and thus + * we need only to include him. + + * @skipline Elementary.hh + + * @attention If necessary the C and/or the C++ headers should be + * include here as well. + + * Now we need to actually start the code and set the elm_policy, + * which defines for a given policy group/identifier a new policy's + * value, respectively. In this example the only policy we need to + * set a value for is @c ELM_POLICY_QUIT, possibles values for it are: + + * @li @p ELM_POLICY_QUIT_NONE: Never quit the application + * automatically; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the + * application's last window is closed; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the + * application's last window is hidden; + + * @skip EAPI_MAIN + * @until elm_policy_set + + * As you can see, the policy we chose was to quit when the last win + * is hidden as opose to examples with the C bindings where we + * perpetually set it to quit when last win was closed. This changed + * was necessary because in C++ binding as the elm mainloop stop + * running all object are destroyed, references are unreferenced and + * events are stopped at ELM_MAIN(). + + * @see For more details consult elm_policy_set + + * Next step is creating an Elementary window, in this example we use + * the C++ binding method with the elm_win_util_standard_add that is a + * elm_win_legacy function, better explained below. And then we set + * the autohide state for it. + + * @p elm_win_util_standard_add (const char *name, const char *tittle) + * Adds a window object with standard setup. + * Parameters: + + * @li @p name - The name of the window; + + * @li @p title - The title for the window. + + * This creates a window but also puts in a standard background with + * @p elm_bg_add(), as well as setting the window title to @p + * title. The window type created is of type @c ELM_WIN_BASIC, with + * the @c NULL as the parent widget. Returns the created object or @c + * NULL on failure. + + * And we also set the autohide state for win, autohide works + * similarly to @p autodel, automatically handling "delete,request" + * signals when set to @p true, with the difference that it will hide + * the window, instead of destroying it. + + * It is specially designed to work together with @p + * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting + * Elementary's main loop when all the windows are hidden. + + * @skip ::elm::win + * @until autohide_set + + * @note @p autodel and @a autohide are not mutually exclusive. The + * window will be destructed if both autodel and autohide is set to @p + * EINA_TRUE or @p true. + + * Now we construct the elm table and for this we use the C++ method + * below, setting it's parent. + + * @skipline ::elm::table + + * We then add table as a resize_object to win informing that when the + * size of the win changes so should the box's size and make it + * visible. + + * @skip resize + * @until visibility + + * Next step is to set the padding, in this case 5px and as we chosen + * for this example homogeneous_set to true. + + * @skip padding + * @until homogeneous + + * We'll create for each cell on this table a simple elm_lable, using + * the C++ method below, setting it's parent. Set the text for the + * labels and make each visible. The parameters for packing the labels + * in our table will be better explain below. + + * @skip elm::label + * @until (label3, + + * When using pack in our table we are adding a child to a packing + * location of the table. The parameters are: + + * pack (evas::object @a subobj, + * int @a column, + * int @a row, + * int @a colspan, + * int @a rowspan) + + * @li subobj - The subobject to be added to the table + + * @li column - Column number + + * @li row - Row number + + * @li colspan - Number of columns that the subobj will occuppy + + * @li rowspan - Number of rows that the subobj will occuppy + + * @note All positioning inside the table is relative to rows and + * columns, so a value of 0 for @a column and @a row, means the top + * left cell of the table. And for example, value of 2 for @a colspan and @a + * rowspan indicates that the subobj will occuppy two column and two rows, + * thus occuppying 4 cells in total. + + * Finally we just have to make our window visible. Then run the elm + * mainloop, starting to handle events and drawing operations. + + * @skip visibility + * @until ELM_MAIN + + * @See Full code for this example: @ref table_cxx_example_01.cc . + + * Our example will look like this: + + * @image html screenshots/table_cxx_example_01.png + * @image latex screenshots/table_cxx_example_01.eps width=\textwidth + * @example table_cxx_example_01.cc + */ + +/** + * @page table_cxx_example_02 Table Example with C++ binding - Heterogeneous + * @dontinclude table_cxx_example_02.cc + + * For our second example we'll create a table with 4 rectangles in + * it. Since our rectangles are of different sizes our table won't be + * homogeneous. + + * The first part consists of including the headers. In this + * case we are only working with the Elementary C++ binding and thus + * we need only to include him. + + * @skipline Elementary.hh + + * @attention If necessary the C and/or the C++ headers should be + * include here as well. + + * Now we need to actually start the code and set the elm_policy, + * which defines for a given policy group/identifier a new policy's + * value, respectively. In this example the only policy we need to + * set a value for is @c ELM_POLICY_QUIT, possibles values for it are: + + * @li @p ELM_POLICY_QUIT_NONE: Never quit the application + * automatically; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the + * application's last window is closed; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the + * application's last window is hidden; + + * @skip EAPI_MAIN + * @until elm_policy_set + + * As you can see, the policy we chose was to quit when the last win + * is hidden as opose to examples with the C bindings where we + * perpetually set it to quit when last win was closed. This changed + * was necessary because in C++ binding as the elm mainloop stop + * running all object are destroyed, references are unreferenced and + * events are stopped at ELM_MAIN(). + + * @see For more details consult elm_policy_set + + * Next step is creating an Elementary window, in this example we use + * the C++ binding method with the elm_win_util_standard_add that is a + * elm_win_legacy function, better explained below. And then we set + * the autohide state for it. + + * @p elm_win_util_standard_add (const char *name, const char *tittle) + * Adds a window object with standard setup. + * Parameters: + + * @li @p name - The name of the window; + + * @li @p title - The title for the window. + + * This creates a window but also puts in a standard background with + * @p elm_bg_add(), as well as setting the window title to @p + * title. The window type created is of type @c ELM_WIN_BASIC, with + * the @c NULL as the parent widget. Returns the created object or @c + * NULL on failure. + + * And we also set the autohide state for win, autohide works + * similarly to @p autodel, automatically handling "delete,request" + * signals when set to @p true, with the difference that it will hide + * the window, instead of destroying it. + + * It is specially designed to work together with @p + * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting + * Elementary's main loop when all the windows are hidden. + + * @skip ::elm::win + * @until autohide_set + + * @note @p autodel and @a autohide are not mutually exclusive. The + * window will be destructed if both autodel and autohide is set to @p + * EINA_TRUE or @p true. + + * Now we construct the elm table and for this we use the C++ method + * below, passing windows as it's parent. + + * @skipline ::elm::table + + * We then add table as a resize_object to win informing that when the + * size of the win changes so should the table's size and make it + * visible. The last configuration for table is to set homogeneous as + * false. + + * @skip resize + * @until homogeneous + + * For each cell of this table we are going to create a unique @p + * evas::rectangle, each with diferent colors and sizes. + + * Let's see a snip of the code on how we constructed our rectangles + * and setted the colors. + + * @skip evas + * @until color + + * @skip evas + * @until color + + * @skip evas + * @until color + + * @skip evas + * @until color + + * For each rectangle we also setted the size_hint_min that hints for + * an object's minimum size. This is not a size enforcement in any + * way, it's just a hint that should be used whenever appropriate. + + * @dontinclude table_cxx_example_02.cc + * @skipline size_hint + + * @skipline size_hint + + * @skipline size_hint + + * @skipline size_hint + + * When using pack in our table we are adding a child to a packing + * location of the table. The parameters are: + + * pack (evas::object @a subobj, + * int @a column, + * int @a row, + * int @a colspan, + * int @a rowspan) + + * @li subobj - The subobject to be added to the table + + * @li column - Column number + + * @li row - Row number + + * @li colspan - Number of columns that the subobj will occuppy + + * @li rowspan - Number of rows that the subobj will occuppy + + * @note All positioning inside the table is relative to rows and + * columns, so a value of 0 for @a column and @a row, means the top + * left cell of the table. And for example, value of 2 for @a colspan + * and @a rowspan indicates that the subobj will occuppy two column + * and two rows, thus occuppying 4 cells in total. + + * So for each rectangle we are setting a specific location and how + * many cells it's occupying, better seem below: + + * @dontinclude table_cxx_example_02.cc + * @skipline pack + + * @skipline pack + + * @skipline pack + + * @skipline pack + + * Finally we just have to make our window visible. Then run the elm + * mainloop, starting to handle events and drawing operations. + + * @skip visibility + * @until ELM_MAIN + + * @See Full code for this example: @ref table_cxx_example_02.cc . + + * Our example will look like this: + + * @image html screenshots/table_cxx_example_02.png + * @image latex screenshots/table_cxx_example_02.eps width=\textwidth + + * @example table_cxx_example_02.cc + */ + +/** + * @page thumb_cxx_example_01 Thumb - Generating thumbnails with C++ Binding + * @dontinclude thumb_cxx_example_01.cc + + * This example shows how to create a simple thumbnail object with + * Elementary C++ Binding. + + * The first part consists of including the headers. In this case we + * need Elementary C++ binding, iostream and sstream libraries. + + * @skip Elementary.hh + * @until sstream + + * @attention All necessary Enlightenment, Elementary, C and/or C++ + * headers should be include here as well. + + * Starting the main code and telling elementary that we need Ethumb + * to generate the thumbnails: + + * @skip EAPI + * @until elm_need_ethumb + + * Then, we use app_info_set to access the image that we are using for + * this example. + + * @skipline app + + * Now let's set the elm_policy, which defines for a given policy + * group/identifier a new policy's value, respectively. In this + * example the only policy we need to set a value for is @c + * ELM_POLICY_QUIT, possibles values for it are: + + * @li @p ELM_POLICY_QUIT_NONE: Never quit the application + * automatically; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the + * application's last window is closed; + + * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the + * application's last window is hidden; + + * @skipline elm_policy_set + + * As you can see, the policy we chose was to quit when the last win + * is hidden as opose to examples with the C bindings where we + * perpetually set it to quit when last win was closed. This changed + * was necessary because in C++ binding as the elm mainloop stop + * running all object are destroyed, references are unreferenced and + * events are stopped at ELM_MAIN(). + + * @see For more details consult elm_policy_set + + * Next step is creating an elementary window, in this example we use + * the C++ binding method with the elm_win_util_standard_add that is a + * elm_win_legacy function, better explained below. And then we set + * the autohide state for it. + + * @p elm_win_util_standard_add (const char *name, const char *tittle) + * Adds a window object with standard setup. + * Parameters: + + * @li @p name - The name of the window; + + * @li @p title - The title for the window. + + * This creates a window but also puts in a standard background with + * @p elm_bg_add(), as well as setting the window title to @p + * title. The window type created is of type @c ELM_WIN_BASIC, with + * the @c NULL as the parent widget. Returns the created object or @c + * NULL on failure. + + * The autohide works similarly to @p autodel, automatically handling + * "delete,request" signals when set to @p true, with the difference + * that it will hide the window, instead of destroying it. + + * It is specially designed to work together with @p + * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting + * Elementary's main loop when all the windows are hidden. + + * @skip ::elm::win + * @until autohide_set + + * @note @p autodel and @a autohide are not mutually exclusive. The + * window will be destructed if both autodel and autohide is set to @p + * EINA_TRUE or @p true. + + * Creating our thumb and setting it's parent, using C++ method. + + * @skipline thumb + + * For our callbacks we are using lambda type functions to create + * then, note that all three only show a message, for when our thumb + * generation is starting, stoping and it's return error. + + * @skip auto + * @until generate_error + + * @note To learn more about Lambda Function and its use in Elementary + * consult @ref lambda. + + * Continuing with our thumb, we'll set a size, set it to not be + * editable, set the file and after that, we can start creating + * thumbnail objects. They are very similar to image or icon objects: + + * @skip size + * @until reload + + * As you can see, the main different function here is reload(), which + * will check if the options of the Ethumb client have changed. If so, + * it will re-generate the thumbnail, and show the new one. + + * Notice in this example that the thumbnail object is displayed on + * the size of the window (320x320 pixels), but the thumbnail + * generated and stored has size 160x160 pixels. That's why the + * picture seems upscaled. + + * Ideally, you will be generating thumbnails with the size that you + * will be using them. + + * Finishing with thumb we set the weight hint. To better understand, + * the function @c size_hint_weight_set for C++ bindings originated + * from C bindings function evas_object_size_hint_weight_set, that is + * EFL Evas type function. With this function we set the hints for an + * object's weight. + * The parameters are: + + * @li x - Nonnegative double value to use as horizontal weight hint. + + * @li y - Nonnegative double value to use as vertical weight hint. + + * This is not a size enforcement in any way, it's just a hint that + * should be used whenever appropriate. This is a hint on how a + * container object should resize a given child within its area. + + * Containers may adhere to the simpler logic of just expanding the + * child object's dimensions to fit its own (see the EVAS_HINT_EXPAND + * helper weight macro in the EFL Evas Documentation) or the complete + * one of taking each child's weight hint as real weights to how much + * of its size to allocate for them in each axis. A container is + * supposed to, after normalizing the weights of its children (with + * weight hints), distribute the space it has to layout them by those + * factors – most weighted children get larger in this process than + * the least ones. + + * @skipline weight_set + + * @note Default weight hint values are 0.0, for both axis. + + * Then we add the thumb as a resize-object to win informing that when + * the size of the win changes so should the thumb's size. Remember + * always to set the thumb visibility to true. + + * @skip win + * @until visibility + + * Now we only have to set the size for our window and make it + * visible. + + * @skip size_set + * @until visibility_set + + * And finally, start the elm mainloop, starting to handle events and + * drawing operations. + + * @skip elm_run + * @until ELM_MAIN + + * The full source code can be found at @ref thumb_cxx_example_01.cc + + * @image latex screenshots/thumb_cxx_example_01.eps width=\textwidth + * @example thumb_cxx_example_01.cc + */ \ No newline at end of file diff --git a/legacy/elementary/doc/examples.dox b/legacy/elementary/doc/examples.dox index 02d58e0764..3d425b1ad2 100644 --- a/legacy/elementary/doc/examples.dox +++ b/legacy/elementary/doc/examples.dox @@ -6552,6 +6552,7 @@ * @example bg_example_01.c */ + /** * @page bg_example_02_c bg_example_02.c * @include bg_example_02.c diff --git a/legacy/elementary/src/examples/.gitignore b/legacy/elementary/src/examples/.gitignore index 98a343b640..900ec8378c 100644 --- a/legacy/elementary/src/examples/.gitignore +++ b/legacy/elementary/src/examples/.gitignore @@ -118,3 +118,38 @@ /evas3d_map_example /sphere_hunter/sphere_hunter /performance/performance +/bg_cxx_example_01 +/bg_cxx_example_02 +/bubble_cxx_example_01 +/button_cxx_example_00 +/button_cxx_example_01 +/calendar_cxx_example_01 +/calendar_cxx_example_02 +/calendar_cxx_example_03 +/calendar_cxx_example_04 +/calendar_cxx_example_05 +/check_cxx_example_01 +/clock_cxx_example +/conformant_cxx_example_01 +/conformant_cxx_example_02 +/datetime_cxx_example +/frame_cxx_example_01 +/glview_cxx_example_01 +/hoversel_cxx_example_01 +/icon_cxx_example_01 +/image_cxx_example_01 +/label_cxx_example_01 +/location_cxx_example_01 +/menu_cxx_example_01 +/notify_cxx_example_01 +/panel_cxx_example_01 +/panes_cxx_example +/popup_cxx_example_01 +/popup_cxx_example_02 +/radio_cxx_example_01 +/separator_cxx_example_01 +/slider_cxx_example +/spinner_cxx_example +/table_cxx_example_01 +/table_cxx_example_02 +/thumb_cxx_example_01 diff --git a/legacy/elementary/src/examples/Makefile.am b/legacy/elementary/src/examples/Makefile.am index ef68bdd4c9..bf969e3855 100644 --- a/legacy/elementary/src/examples/Makefile.am +++ b/legacy/elementary/src/examples/Makefile.am @@ -21,6 +21,10 @@ AM_CPPFLAGS = \ -DPACKAGE_LIB_DIR=\"$(libdir)\" \ @ELEMENTARY_CFLAGS@ +AM_CXXFLAGS = \ +@ELEMENTARY_CFLAGS@ \ +@ELEMENTARY_CXX_CFLAGS@ + LDADD = \ @ELEMENTARY_LIBS@ \ $(top_builddir)/src/lib/libelementary.la @@ -146,7 +150,32 @@ track_example_01.c if HAVE_CXX11 SRCS += \ -box_cxx_example_02.cc +thumb_cxx_example_01.cc \ +table_cxx_example_02.cc \ +table_cxx_example_01.cc \ +spinner_cxx_example.cc \ +slider_cxx_example.cc \ +separator_cxx_example_01.cc \ +radio_cxx_example_01.cc \ +popup_cxx_example_01.cc \ +menu_cxx_example_01.cc \ +location_cxx_example_01.cc \ +icon_cxx_example_01.cc \ +hoversel_cxx_example_01.cc \ +glview_cxx_example_01.cc \ +datetime_cxx_example.cc \ +clock_cxx_example.cc \ +calendar_cxx_example_05.cc \ +calendar_cxx_example_04.cc \ +calendar_cxx_example_03.cc \ +calendar_cxx_example_02.cc \ +calendar_cxx_example_01.cc \ +button_cxx_example_01.cc \ +button_cxx_example_00.cc \ +bubble_cxx_example_01.cc \ +box_cxx_example_02.cc \ +bg_cxx_example_02.cc \ +bg_cxx_example_01.cc endif .edc.edj: @@ -297,7 +326,32 @@ track_example_01 if HAVE_CXX11 examples_PROGRAMS += \ -box_cxx_example_02 +thumb_cxx_example_01 \ +table_cxx_example_02 \ +table_cxx_example_01 \ +spinner_cxx_example \ +slider_cxx_example \ +separator_cxx_example_01 \ +radio_cxx_example_01 \ +popup_cxx_example_01 \ +menu_cxx_example_01 \ +location_cxx_example_01 \ +icon_cxx_example_01 \ +hoversel_cxx_example_01 \ +glview_cxx_example_01 \ +datetime_cxx_example \ +clock_cxx_example \ +calendar_cxx_example_05 \ +calendar_cxx_example_04 \ +calendar_cxx_example_03 \ +calendar_cxx_example_02 \ +calendar_cxx_example_01 \ +button_cxx_example_01 \ +button_cxx_example_00 \ +bubble_cxx_example_01 \ +box_cxx_example_02 \ +bg_cxx_example_02 \ +bg_cxx_example_01 endif if ELEMENTARY_WINDOWS_BUILD @@ -313,10 +367,32 @@ efl_thread_4_SOURCES = efl_thread_4.c endif if HAVE_CXX11 +thumb_cxx_example_01_SOURCES = thumb_cxx_example_01.cc +table_cxx_example_02_SOURCES = table_cxx_example_02.cc +table_cxx_example_01_SOURCES = table_cxx_example_01.cc +spinner_cxx_example_SOURCES = spinner_cxx_example.cc +slider_cxx_example_SOURCES = slider_cxx_example.cc +separator_cxx_example_01_SOURCES = separator_cxx_example_01.cc +radio_cxx_example_01_SOURCES = radio_cxx_example_01.cc +popup_cxx_example_01_SOURCES = popup_cxx_example_01.cc +menu_cxx_example_01_SOURCES = menu_cxx_example_01.cc +location_cxx_example_01_SOURCES = location_cxx_example_01.cc +icon_cxx_example_01_SOURCES = icon_cxx_example_01.cc +hoversel_cxx_example_01_SOURCES = hoversel_cxx_example_01.cc +glview_cxx_example_01_SOURCES = glview_cxx_example_01.cc +datetime_cxx_example_SOURCES = datetime_cxx_example.cc +clock_cxx_example_SOURCES = clock_cxx_example.cc +calendar_cxx_example_05_SOURCES = calendar_cxx_example_05.cc +calendar_cxx_example_04_SOURCES = calendar_cxx_example_04.cc +calendar_cxx_example_03_SOURCES = calendar_cxx_example_03.cc +calendar_cxx_example_02_SOURCES = calendar_cxx_example_02.cc +calendar_cxx_example_01_SOURCES = calendar_cxx_example_01.cc +button_cxx_example_01_SOURCES = button_cxx_example_01.cc +button_cxx_example_00_SOURCES = button_cxx_example_00.cc +bubble_cxx_example_01_SOURCES = bubble_cxx_example_01.cc box_cxx_example_02_SOURCES = box_cxx_example_02.cc -box_cxx_example_02_CXXFLAGS = \ -@ELEMENTARY_CFLAGS@ \ -@ELEMENTARY_CXX_CFLAGS@ +bg_cxx_example_02_SOURCES = bg_cxx_example_02.cc +bg_cxx_example_01_SOURCES = bg_cxx_example_01.cc endif # This variable will hold the list of screenshots that will be made @@ -406,7 +482,30 @@ menu_example_01:menu_example_01.png:0.5 if HAVE_CXX11 SCREENSHOTS += \ -box_cxx_example_02:box_cxx_example_02.png:1.3 +bg_cxx_example_02:bg_cxx_example_02.png:0.0 \ +box_cxx_example_02:box_cxx_example_02.png:1.3 \ +bubble_cxx_example_01:bubble_cxx_example_01.png:0.0 \ +button_cxx_example_00:button_cxx_example_00.png:0.0 \ +button_cxx_example_01:button_cxx_example_01.png:0.0 \ +calendar_cxx_example_01:calendar_cxx_example_01.png:0.0 \ +calendar_cxx_example_02:calendar_cxx_example_02.png:0.0 \ +calendar_cxx_example_03:calendar_cxx_example_03.png:0.0 \ +calendar_cxx_example_04:calendar_cxx_example_04.png:0.0 \ +calendar_cxx_example_05:calendar_cxx_example_05.png:0.0 \ +clock_cxx_example:clock_cxx_example.png:0.5 \ +datetime_cxx_example:datetime_cxx_example.png:0.0 \ +hoversel_cxx_example_01:hoversel_cxx_example_01.png:0.0 \ +icon_cxx_example_01:icon_cxx_example_01.png:0.0 \ +menu_cxx_example_01:menu_cxx_example_01.png:0.5 \ +popup_cxx_example_01:popup_cxx_example_01.png:1.0 \ +popup_cxx_example_01:popup_cxx_example_01_a.png:6.0 \ +radio_cxx_example_01:radio_cxx_example_01.png:0.0 \ +separator_cxx_example_01:separator_cxx_example_01.png:0.0 \ +slider_cxx_example:slider_cxx_example.png:0.0 \ +spinner_cxx_example:spinner_cxx_example.png:0.0 \ +table_cxx_example_01:table_cxx_example_01.png:0.0 \ +table_cxx_example_02:table_cxx_example_02.png:0.0 \ +thumb_cxx_example_01:thumb_cxx_example_01.png:0.5 endif HTML_SS_DIR=$(top_builddir)/doc/html/screenshots diff --git a/legacy/elementary/src/examples/bg_cxx_example_01.cc b/legacy/elementary/src/examples/bg_cxx_example_01.cc new file mode 100644 index 0000000000..9fe20f445c --- /dev/null +++ b/legacy/elementary/src/examples/bg_cxx_example_01.cc @@ -0,0 +1,23 @@ +#include + +EAPI_MAIN int +elm_main (int argc, char *argv[]) +{ + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN); + + ::elm::win_standard win; + win.title_set("Bg Plain"); + win.autohide_set(true); + + ::elm::bg bg(efl::eo::parent = win); + bg.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + win.resize_object_add(bg); + bg.visible_set(true); + + win.size_set(320,320); + win.visible_set(true); + + elm_run(); + return 0; +} +ELM_MAIN() diff --git a/legacy/elementary/src/examples/bg_cxx_example_02.cc b/legacy/elementary/src/examples/bg_cxx_example_02.cc new file mode 100644 index 0000000000..56fc7486e4 --- /dev/null +++ b/legacy/elementary/src/examples/bg_cxx_example_02.cc @@ -0,0 +1,33 @@ +#include + +#include + +EAPI_MAIN int +elm_main (int argc, char *argv[]) +{ + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN); + + ::elm::win_standard win; + win.title_set("Bg Image"); + win.autohide_set(true); + + elm_app_compile_data_dir_set("/usr/share/elementary"); + elm_app_info_set(reinterpret_cast(elm_main), "elementary", "images/plant_01.jpg"); + + ::elm::bg bg(efl::eo::parent = win); + bg.load_size_set(20,20); + bg.option_set(ELM_BG_OPTION_CENTER); + std::stringstream ss; + ss << elm_app_data_dir_get() << "/images/plant_01.jpg"; + bg.file_set(ss.str(), nullptr); + bg.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + win.resize_object_add(bg); + bg.visible_set(true); + + win.size_set(320, 320); + win.visible_set(true); + + elm_run(); + return 0; +} +ELM_MAIN() diff --git a/legacy/elementary/src/examples/box_cxx_example_02.cc b/legacy/elementary/src/examples/box_cxx_example_02.cc index 28950f4d63..f61990dd65 100644 --- a/legacy/elementary/src/examples/box_cxx_example_02.cc +++ b/legacy/elementary/src/examples/box_cxx_example_02.cc @@ -1,52 +1,15 @@ //Compile with: //gcc -g box_example_02.c -o box_example_02 `pkg-config --cflags --libs elementary` - -extern "C" -{ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#define ELM_INTERNAL_API_ARGESFSDFEFC -#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED -#define ELM_INTERFACE_ATSPI_COMPONENT_PROTECTED -#define ELM_INTERFACE_ATSPI_ACTION_PROTECTED -#define ELM_INTERFACE_ATSPI_VALUE_PROTECTED -#define ELM_INTERFACE_ATSPI_EDITABLE_TEXT_PROTECTED -#define ELM_INTERFACE_ATSPI_TEXT_PROTECTED -#define ELM_INTERFACE_ATSPI_SELECTION_PROTECTED -#define ELM_INTERFACE_ATSPI_IMAGE_PROTECTED -#define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED - -#include - -#include -#include -#include -#include - -#include "elm_interface_atspi_accessible.h" -#include "elm_interface_atspi_accessible.eo.h" - -#include "elm_interface_atspi_widget_action.h" -#include "elm_interface_atspi_widget_action.eo.h" -} - -#include - -#include -#include -#include - +#include #include #include +#include struct Transitions_Data { - efl::eo::wref box; + efl::eo::wref box; std::deque transitions; Evas_Object_Box_Layout last_layout; }; @@ -61,7 +24,7 @@ _test_box_transition_change(void *data) assert (!!data); assert (!tdata->transitions.empty()); - if(efl::eina::optional box = tdata->box.lock()) + if(efl::eina::optional box = tdata->box.lock()) { next_layout = tdata->transitions.front(); layout_data = elm_box_transition_new(2.0, tdata->transitions.back(), @@ -70,149 +33,110 @@ _test_box_transition_change(void *data) box->layout_set(elm_box_layout_transition, layout_data, elm_box_transition_free); tdata->last_layout = next_layout; - + tdata->transitions.push_back(tdata->transitions[0]); tdata->transitions.pop_front(); } } -struct clean_ref -{ - clean_ref(efl::eo::base base) - : _ref(base._eo_ptr()) - {} - - template - void operator()(T const&, Eo_Event_Description const&, void*) const - { - if(_ref) - eo_unref(_ref); - } - - Eo* _ref; -}; - EAPI_MAIN int elm_main(int argc, char *argv[]) { - elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN); Transitions_Data tdata; - Eo* test; - { - ::elm_win win (elm_win_util_standard_add("box-transition", "Box Transition")); - win.autodel_set(true); + ::elm::win_standard win; + win.title_set("Box Transition"); + win.autohide_set(true); - elm_box bigbox ( efl::eo::parent = win ); - bigbox.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - win.resize_object_add(bigbox); - bigbox.visibility_set(true); - win.callback_del_add(clean_ref(bigbox)); + elm::box bigbox ( efl::eo::parent = win ); + bigbox.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + win.resize_object_add(bigbox); + bigbox.visible_set(true); - elm_box buttons ( efl::eo::parent = win ); - buttons.horizontal_set(EINA_TRUE); - bigbox.pack_end(buttons); - buttons.visibility_set(true); - win.callback_del_add(clean_ref(buttons)); + elm::box buttons ( efl::eo::parent = win ); + buttons.horizontal_set(EINA_TRUE); + bigbox.pack_end(buttons); + buttons.visible_set(true); - elm_button add ( efl::eo::parent = win ); - add.text_set("elm.text", "Add"); - buttons.pack_end(add); - add.visibility_set(true); - add.callback_clicked_add - (std::bind([&tdata] - { - if(efl::eina::optional box = tdata.box.lock()) - { - elm_button btn ( efl::eo::parent = *box ); - btn.text_set("elm.text", "I do nothing"); - efl::eina::list childrens(box->children_get()); - if (!childrens.empty()) - { - box->pack_after(btn, childrens.front()); - } - else - box->pack_end(btn); - btn.visibility_set(true); - } - })); - win.callback_del_add(clean_ref(add)); + elm::button add ( efl::eo::parent = win ); + add.text_set("elm.text", "Add"); + buttons.pack_end(add); + add.visible_set(true); + add.callback_clicked_add + (std::bind([&tdata] + { + if(efl::eina::optional box = tdata.box.lock()) + { + elm::button btn ( efl::eo::parent = *box ); + btn.text_set(nullptr, "I do nothing"); + box->pack_end(btn); + btn.visible_set(true); + } + })); - elm_button clear ( efl::eo::parent = win ); - clear.text_set("elm.text", "Clear"); - buttons.pack_end(clear); - clear.visibility_set(true); - clear.callback_clicked_add(std::bind([&tdata] { tdata.box.lock()->clear(); })); - win.callback_del_add(clean_ref(clear)); + elm::button clear ( efl::eo::parent = win ); + clear.text_set("elm.text", "Clear"); + buttons.pack_end(clear); + clear.visible_set(true); + clear.callback_clicked_add(std::bind([&tdata] { tdata.box.lock()->clear(); })); - elm_box dynamic ( efl::eo::parent = win ); - dynamic.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - dynamic.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL); - bigbox.pack_end(dynamic); - dynamic.visibility_set(true); - win.callback_del_add(clean_ref(dynamic)); + elm::box dynamic ( efl::eo::parent = win ); + dynamic.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + dynamic.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL); + bigbox.pack_end(dynamic); + dynamic.visible_set(true); - auto unpack = std::bind([&tdata] (evas::clickable_interface obj) - { - elm_button btn = efl::eo::downcast(obj); - tdata.box.lock()->unpack(btn); - btn.position_set(0, 50); - btn.color_set(128, 64, 0, 128); - }, std::placeholders::_1) - ; + auto unpack = std::bind([&tdata] (evas::clickable_interface obj) + { + elm::button btn = efl::eo::downcast(obj); + tdata.box.lock()->unpack(btn); + btn.position_set(0, 50); + btn.object_smart::color_set(128, 64, 0, 128); + }, std::placeholders::_1) + ; - elm_button bt1 ( efl::eo::parent = win ); - bt1.text_set("elm.text", "Button 1"); - bt1.callback_clicked_add(unpack); - bt1.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - bt1.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL); - dynamic.pack_end(bt1); - bt1.visibility_set(true); - win.callback_del_add(clean_ref(bt1)); + elm::button bt1 ( efl::eo::parent = win ); + bt1.text_set("elm.text", "Button 1"); + bt1.callback_clicked_add(unpack); + bt1.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + bt1.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL); + dynamic.pack_end(bt1); + bt1.visible_set(true); - elm_button bt2 ( efl::eo::parent = win ); - bt2.text_set("elm.text", "Button 2"); - bt2.size_hint_weight_set(EVAS_HINT_EXPAND, 0.0); - bt2.size_hint_align_set(1.0, 0.5); - bt2.callback_clicked_add(unpack); - dynamic.pack_end(bt2); - bt2.visibility_set(true); - win.callback_del_add(clean_ref(bt2)); + elm::button bt2 ( efl::eo::parent = win ); + bt2.text_set("elm.text", "Button 2"); + bt2.size_hint_weight_set(EVAS_HINT_EXPAND, 0.0); + bt2.size_hint_align_set(1.0, 0.5); + bt2.callback_clicked_add(unpack); + dynamic.pack_end(bt2); + bt2.visible_set(true); - elm_button bt3 ( efl::eo::parent = win ); - bt3.text_set("elm.text", "Button 3"); - bt3.callback_clicked_add(unpack); - dynamic.pack_end(bt3); - bt3.visibility_set(true); - win.callback_del_add(clean_ref(bt3)); + elm::button bt3 ( efl::eo::parent = win ); + bt3.text_set("elm.text", "Button 3"); + bt3.callback_clicked_add(unpack); + dynamic.pack_end(bt3); + bt3.visible_set(true); - tdata.box = dynamic; - tdata.last_layout = evas_object_box_layout_horizontal; - tdata.transitions.push_back(evas_object_box_layout_vertical); - tdata.transitions.push_back(evas_object_box_layout_horizontal); - tdata.transitions.push_back(evas_object_box_layout_stack); - tdata.transitions.push_back(evas_object_box_layout_homogeneous_vertical); - tdata.transitions.push_back(evas_object_box_layout_homogeneous_horizontal); - tdata.transitions.push_back(evas_object_box_layout_flow_vertical); - tdata.transitions.push_back(evas_object_box_layout_flow_horizontal); - tdata.transitions.push_back(evas_object_box_layout_stack); + tdata.box = dynamic; + tdata.last_layout = evas_object_box_layout_horizontal; + tdata.transitions.push_back(evas_object_box_layout_vertical); + tdata.transitions.push_back(evas_object_box_layout_horizontal); + tdata.transitions.push_back(evas_object_box_layout_stack); + tdata.transitions.push_back(evas_object_box_layout_homogeneous_vertical); + tdata.transitions.push_back(evas_object_box_layout_homogeneous_horizontal); + tdata.transitions.push_back(evas_object_box_layout_flow_vertical); + tdata.transitions.push_back(evas_object_box_layout_flow_horizontal); + tdata.transitions.push_back(evas_object_box_layout_stack); - dynamic.layout_set(evas_object_box_layout_horizontal, nullptr, nullptr); - _test_box_transition_change(&tdata); - - win.size_set(300, 320); - win.visibility_set(true); + dynamic.layout_set(evas_object_box_layout_horizontal, nullptr, nullptr); + _test_box_transition_change(&tdata); + + win.size_set(300, 320); + win.visible_set(true); - std::cout << "references to win " << win.ref_get() << std::endl; - test = win._eo_ptr(); - win._release(); - } - std::cout << "references to win " << ::eo_ref_get(test) << std::endl; - elm_run(); - elm_shutdown(); - return 0; } ELM_MAIN() diff --git a/legacy/elementary/src/examples/bubble_cxx_example_01.cc b/legacy/elementary/src/examples/bubble_cxx_example_01.cc new file mode 100644 index 0000000000..dd2284ae05 --- /dev/null +++ b/legacy/elementary/src/examples/bubble_cxx_example_01.cc @@ -0,0 +1,62 @@ +#include +#include + +EAPI_MAIN int +elm_main (int argc, char *argv[]) +{ + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN); + + ::elm::win_standard win; + win.title_set("Bg Plain"); + win.autohide_set(true); + + ::elm::bg bg(efl::eo::parent = win); + bg.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + win.resize_object_add(bg); + bg.visible_set(true); + + ::elm::label label1(efl::eo::parent = win); + label1.text_set(nullptr, "Bubble with no icon, info or label"); + label1.visible_set(true); + + evas::rectangle icon(efl::eo::parent = win); + icon.color_set( 0, 0, 255, 255); + icon.visible_set(true); + + ::elm::bubble bubble1(efl::eo::parent = win); + bubble1.content_set("icon", icon); + bubble1.text_set("info", "INFO"); + bubble1.text_set(nullptr, "LABEL"); + bubble1.content_set(nullptr, label1); + bubble1.size_set(300, 100); + bubble1.visible_set(true); + + auto on_click = std::bind([&] () + { + static unsigned char corner = 0; + ++corner; + if (corner > 3) + bubble1.pos_set(ELM_BUBBLE_POS_TOP_LEFT); + else + bubble1.pos_set(static_cast(corner)); + }); + + bubble1.callback_clicked_add(on_click); + + ::elm::label label2(efl::eo::parent = win); + label2.text_set(nullptr, "Bubble with no icon, info or label"); + label2.visible_set(true); + + ::elm::bubble bubble2(efl::eo::parent = win); + bubble2.content_set(nullptr, label2); + bubble2.size_set(200, 50); + bubble2.position_set(0, 110); + bubble2.visible_set(true); + + win.size_set(300, 200); + win.visible_set(true); + + elm_run(); + return 0; +} +ELM_MAIN() diff --git a/legacy/elementary/src/examples/button_cxx_example_00.cc b/legacy/elementary/src/examples/button_cxx_example_00.cc new file mode 100644 index 0000000000..a18d652146 --- /dev/null +++ b/legacy/elementary/src/examples/button_cxx_example_00.cc @@ -0,0 +1,35 @@ +#include + +EAPI_MAIN int +elm_main (int argc, char *argv[]) +{ + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN); + + ::elm::win_standard win; + win.title_set("Hello, World!"); + win.autohide_set(true); + + ::elm::bg bg(efl::eo::parent = win); + bg.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + win.resize_object_add(bg); + bg.visible_set(true); + + ::elm::button btn(efl::eo::parent = win); + btn.text_set("elm.text","Good-Bye, World!"); + btn.size_set(120, 30); + btn.position_set(60, 15); + btn.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + btn.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL); + btn.visible_set(true); + + auto on_click = std::bind([] () { elm_exit(); }); + + btn.callback_clicked_add( on_click ); + + win.size_set(240, 60); + win.visible_set(true); + + elm_run(); + return 0; +} +ELM_MAIN() diff --git a/legacy/elementary/src/examples/button_cxx_example_01.cc b/legacy/elementary/src/examples/button_cxx_example_01.cc new file mode 100644 index 0000000000..72096a3a48 --- /dev/null +++ b/legacy/elementary/src/examples/button_cxx_example_01.cc @@ -0,0 +1,233 @@ +#include + +EAPI_MAIN int +elm_main(int argc, char *argv[]) +{ + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN); + + ::elm::win_standard win; + win.title_set("Button example"); + win.autohide_set(true); + + ::evas::object icon_still(nullptr); + ::elm::button mid(efl::eo::parent = win); + ::elm::button up(efl::eo::parent = win); + ::elm::button down(efl::eo::parent = win); + ::elm::button left(efl::eo::parent = win); + ::elm::button right(efl::eo::parent = win); + + ::elm::box box(efl::eo::parent = win); + box.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + win.resize_object_add(box); + box.visible_set(true); + + ::elm::box box_initial(efl::eo::parent = win); + box_initial.horizontal_set(true); + box_initial.size_hint_weight_set(EVAS_HINT_EXPAND, 0.0); + box.pack_end(box_initial); + box_initial.visible_set(true); + + ::elm::button btn(efl::eo::parent = win); + btn.text_set("elm.text", "Initial: 0.0"); + box_initial.pack_end(btn); + btn.visible_set(true); + + auto btn_options = std::bind([&] (evas::clickable_interface ci) + { + ::elm::button b(eo_ref(ci._eo_ptr())); + std::string::size_type ptr; + efl::eina::optional lbl = b.text_get("elm.text"); + + ptr = lbl->find(":"); + ptr += 2; + double t = std::stod(lbl->substr(ptr)); + + if (lbl->compare(0,7,"Initial") == 0) + { + up.autorepeat_initial_timeout_set(t); + down.autorepeat_initial_timeout_set(t); + left.autorepeat_initial_timeout_set(t); + right.autorepeat_initial_timeout_set(t); + } + else if (lbl->compare(0,3,"Gap") == 0) + { + up.autorepeat_gap_timeout_set(t); + down.autorepeat_gap_timeout_set(t); + left.autorepeat_gap_timeout_set(t); + right.autorepeat_gap_timeout_set(t); + } + }, std::placeholders::_1); + + btn.callback_clicked_add(btn_options); + + ::elm::button btn2(efl::eo::parent = win); + btn2.text_set("elm.text", "Initial: 1.0"); + box_initial.pack_end(btn2); + btn2.visible_set(true); + btn2.callback_clicked_add(btn_options); + + ::elm::button btn3(efl::eo::parent = win); + btn3.text_set("elm.text", "Initial: 5.0"); + box_initial.pack_end(btn3); + btn3.visible_set(true); + btn3.callback_clicked_add(btn_options); + + ::elm::box box_gap(efl::eo::parent = win); + box_gap.horizontal_set(true); + box_gap.size_hint_weight_set(EVAS_HINT_EXPAND, 0.0); + box.pack_end(box_gap); + box_gap.visible_set(true); + + ::elm::button btn4(efl::eo::parent = win); + btn4.text_set("elm.text", "Gap: 0.1"); + box_gap.pack_end(btn4); + btn4.visible_set(true); + btn4.callback_clicked_add(btn_options); + + ::elm::button btn5(efl::eo::parent = win); + btn5.text_set("elm.text", "Gap: 0.5"); + box_gap.pack_end(btn5); + btn5.visible_set(true); + btn5.callback_clicked_add(btn_options); + + ::elm::button btn6(efl::eo::parent = win); + btn6.text_set("elm.text", "Gap: 1.0"); + box_gap.pack_end(btn6); + btn6.visible_set(true); + btn6.callback_clicked_add(btn_options); + + up.autorepeat_set(true); + up.autorepeat_initial_timeout_set(1.0); + up.autorepeat_gap_timeout_set(0.5); + up.size_hint_weight_set(EVAS_HINT_EXPAND, 0.0); + up.size_hint_align_set(EVAS_HINT_FILL, 0.0); + box.pack_end(up); + up.visible_set(true); + + auto btn_cursors_move = std::bind([&] (evas::clickable_interface ci2) + { + ::elm::button button = efl::eo::downcast(ci2); + double ax, ay; + + if (!icon_still) + { + ::elm::icon obj(efl::eo::parent = mid); + efl::eina::optional icon_still_p = mid.content_unset("icon"); + if(icon_still_p) + { + icon_still = *icon_still_p; + icon_still.visible_set(false); + } + obj.standard_set("chat"); + mid.content_set("icon", obj); + } + + mid.size_hint_align_get(&ax, &ay); + if (button == up) + { + ay -= 0.05; + if (ay < 0.0) + ay = 0.0; + } + else if (button == down) + { + ay += 0.05; + if (ay > 1.0) + ay = 1.0; + } + else if (button == left) + { + ax -= 0.05; + if (ax < 0.0) + ax = 0.0; + } + else if (button == right) + { + ax += 0.05; + if (ax > 1.0) + ax = 1.0; + } + mid.size_hint_align_set(ax, ay); + }, std::placeholders::_1); + + up.callback_repeated_add(btn_cursors_move); + + auto btn_cursors_release = std::bind([&] () + { + if (icon_still) + { + mid.content_set("icon", icon_still); + icon_still = evas::object(nullptr); + } + }); + + up.callback_unpressed_add(btn_cursors_release); + + ::elm::icon icon_up(efl::eo::parent = win); + icon_up.standard_set("arrow_up"); + up.content_set("icon", icon_up); + + ::elm::box box_inferior(efl::eo::parent = win); + box_inferior.horizontal_set(true); + box_inferior.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + box_inferior.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL); + box.pack_end(box_inferior); + box_inferior.visible_set(true); + + left.autorepeat_set(true); + left.autorepeat_initial_timeout_set(1.0); + left.autorepeat_gap_timeout_set(0.5); + left.size_hint_weight_set(0.0, EVAS_HINT_EXPAND); + left.size_hint_align_set(0.0, EVAS_HINT_FILL); + box_inferior.pack_end(left); + left.visible_set(true); + left.callback_repeated_add(btn_cursors_move); + left.callback_unpressed_add(btn_cursors_release); + + ::elm::icon icon_left(efl::eo::parent = win); + icon_left.standard_set("arrow_left"); + left.content_set("icon", icon_left); + + mid.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + box_inferior.pack_end(mid); + mid.visible_set(true); + + ::elm::icon icon_mid(efl::eo::parent = win); + icon_mid.standard_set("close"); + mid.content_set("icon", icon_mid); + + right.autorepeat_set(true); + right.autorepeat_initial_timeout_set(1.0); + right.autorepeat_gap_timeout_set(0.5); + right.size_hint_weight_set(0.0, EVAS_HINT_EXPAND); + right.size_hint_align_set(0.0, EVAS_HINT_FILL); + box_inferior.pack_end(right); + right.visible_set(true); + right.callback_repeated_add(btn_cursors_move); + right.callback_unpressed_add(btn_cursors_release); + + ::elm::icon icon_right(efl::eo::parent = win); + icon_right.standard_set("arrow_right"); + right.content_set("icon", icon_right); + + down.autorepeat_set(true); + down.autorepeat_initial_timeout_set(1.0); + down.autorepeat_gap_timeout_set(0.5); + down.size_hint_weight_set(EVAS_HINT_EXPAND, 0.0); + down.size_hint_align_set(EVAS_HINT_FILL, 0.0); + box.pack_end(down); + down.visible_set(true); + down.callback_repeated_add(btn_cursors_move); + down.callback_unpressed_add(btn_cursors_release); + + ::elm::icon icon_down(efl::eo::parent = win); + icon_down.standard_set("arrow_down"); + down.content_set("icon", icon_down); + + win.size_set(300, 320); + win.visible_set(true); + + elm_run(); + return 0; +} +ELM_MAIN() diff --git a/legacy/elementary/src/examples/calendar_cxx_example_01.cc b/legacy/elementary/src/examples/calendar_cxx_example_01.cc new file mode 100644 index 0000000000..9014b5cb51 --- /dev/null +++ b/legacy/elementary/src/examples/calendar_cxx_example_01.cc @@ -0,0 +1,21 @@ +#include + +EAPI_MAIN int +elm_main (int argc, char *argv[]) +{ + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN); + ::elm::win_standard win; + win.title_set("Calendar Creation Example"); + win.autohide_set(true); + + ::elm::calendar cal(efl::eo::parent = win); + cal.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + win.resize_object_add(cal); + cal.visible_set(true); + + win.visible_set(true); + + elm_run(); + return 0; +} +ELM_MAIN() diff --git a/legacy/elementary/src/examples/calendar_cxx_example_02.cc b/legacy/elementary/src/examples/calendar_cxx_example_02.cc new file mode 100644 index 0000000000..ce8d0eb68a --- /dev/null +++ b/legacy/elementary/src/examples/calendar_cxx_example_02.cc @@ -0,0 +1,38 @@ +#include + +static char * +_format_month_year(struct tm *format_time) +{ + char buf[32]; + if (!strftime(buf, sizeof(buf), "%b %y", format_time)) return NULL; + return strdup(buf); +} + +EAPI_MAIN int +elm_main (int argc, char *argv[]) +{ + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN); + + const char *weekdays[] = + { + "S", "M", "T", "W", "T", "F", "S" + }; + + ::elm::win_standard win; + win.title_set("Calendar Layout Formatting Example"); + win.autohide_set(true); + + ::elm::calendar cal(efl::eo::parent = win); + cal.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + win.resize_object_add(cal); + + cal.format_function_set(_format_month_year); + cal.weekdays_names_set(weekdays); + + cal.visible_set(true); + win.visible_set(true); + + elm_run(); + return 0; +} +ELM_MAIN() diff --git a/legacy/elementary/src/examples/calendar_cxx_example_03.cc b/legacy/elementary/src/examples/calendar_cxx_example_03.cc new file mode 100644 index 0000000000..9aacadee72 --- /dev/null +++ b/legacy/elementary/src/examples/calendar_cxx_example_03.cc @@ -0,0 +1,23 @@ +#include + +EAPI_MAIN int +elm_main (int argc, char *argv[]) +{ + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN); + + ::elm::win_standard win; + win.title_set("Calendar Min/Max Year Example"); + win.autohide_set(true); + + ::elm::calendar cal(efl::eo::parent = win); + cal.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + win.resize_object_add(cal); + cal.min_max_year_set(2020, 2022); + cal.visible_set(true); + + win.visible_set(true); + + elm_run(); + return 0; +} +ELM_MAIN() diff --git a/legacy/elementary/src/examples/calendar_cxx_example_04.cc b/legacy/elementary/src/examples/calendar_cxx_example_04.cc new file mode 100644 index 0000000000..9df983df91 --- /dev/null +++ b/legacy/elementary/src/examples/calendar_cxx_example_04.cc @@ -0,0 +1,43 @@ +#include + +#define SECS_DAY 86400 + +EAPI_MAIN int +elm_main (int argc, char *argv[]) +{ + struct tm selected_time; + time_t current_time; + + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN); + + ::elm::win_standard win; + win.title_set("Calendar Day Selection Example"); + win.autohide_set(true); + + ::elm::box bx(efl::eo::parent = win); + bx.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + win.resize_object_add(bx); + bx.visible_set(true); + + ::elm::calendar cal(efl::eo::parent = win); + cal.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + cal.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL); + cal.select_mode_set(ELM_CALENDAR_SELECT_MODE_NONE); + cal.visible_set(true); + bx.pack_end(cal); + + ::elm::calendar cal2(efl::eo::parent = win); + cal2.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + cal2.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL); + current_time = time(NULL) +2 * SECS_DAY; + localtime_r(¤t_time, &selected_time); + cal2.selected_time_set(&selected_time); + cal2.visible_set(true); + bx.pack_end(cal2); + + win.visible_set(true); + + elm_run(); + return 0; +} +ELM_MAIN() diff --git a/legacy/elementary/src/examples/calendar_cxx_example_05.cc b/legacy/elementary/src/examples/calendar_cxx_example_05.cc new file mode 100644 index 0000000000..b209efedfa --- /dev/null +++ b/legacy/elementary/src/examples/calendar_cxx_example_05.cc @@ -0,0 +1,50 @@ +#include + +EAPI_MAIN int +elm_main (int argc, char *argv[]) +{ + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN); + + ::elm::win_standard win; + win.title_set("Calendar Getters Example"); + win.autohide_set(true); + + ::elm::calendar cal(efl::eo::parent = win); + cal.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + win.resize_object_add(cal); + + auto print_cal_info = std::bind([] (::elm::calendar obj) + { + int year_min, year_max; + bool sel_enabled; + const char **wds; + struct tm sel_time; + double interval; + + if (!obj.selected_time_get(&sel_time)) + return; + + interval = obj.interval_get(); + obj.min_max_year_get(&year_min, &year_max); + sel_enabled = (obj.select_mode_get() != ELM_CALENDAR_SELECT_MODE_NONE); + wds = obj.weekdays_names_get(); + + std::cout << "Day: " << sel_time.tm_mday << ", Mon: " << sel_time.tm_mon << ", Year " << + sel_time.tm_year + 1900 << ", WeekDay: " << sel_time.tm_wday << "
" << std::endl; + + std::cout << "Interval: " << interval << ", Year_Min: " << year_min << ", Year_Max " << + year_max << ", Sel Enabled: " << sel_enabled << "
" << std::endl; + + std::cout << "Weekdays: " << wds[0] << ", " << wds[1] << ", " << wds[2] << ", " << wds[3] << + ", " << wds[4] << ", " << wds[5] << ", " << wds[6] << "
" << std::endl << std::endl; + } , std::placeholders::_1 ); + + cal.callback_changed_add(print_cal_info); + cal.visible_set(true); + + win.visible_set(true); + + elm_run(); + return 0; +} +ELM_MAIN() diff --git a/legacy/elementary/src/examples/clock_cxx_example.cc b/legacy/elementary/src/examples/clock_cxx_example.cc new file mode 100644 index 0000000000..546ad33bc1 --- /dev/null +++ b/legacy/elementary/src/examples/clock_cxx_example.cc @@ -0,0 +1,53 @@ +#include + +EAPI_MAIN int +elm_main (int argc, char *argv[]) +{ + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN); + + ::elm::win_standard win; + win.title_set("Clock Example"); + win.autohide_set(true); + + ::elm::box bx(efl::eo::parent = win); + bx.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + win.resize_object_add(bx); + bx.visible_set(true); + + ::elm::clock ck(efl::eo::parent = win); + bx.pack_end(ck); + ck.visible_set(true); + + ::elm::clock ck2(efl::eo::parent = win); + ck2.show_am_pm_set(true); + bx.pack_end(ck2); + ck2.visible_set(true); + + ::elm::clock ck3(efl::eo::parent = win); + ck3.show_seconds_set(true); + ck3.time_set(10, 11, 12); + bx.pack_end(ck3); + ck3.visible_set(true); + + ::elm::clock ck4(efl::eo::parent = win); + ck4.edit_set(true); + ck4.show_seconds_set(true); + ck4.show_am_pm_set(true); + ck4.time_set(10, 11, 12); + bx.pack_end(ck4); + ck4.visible_set(true); + + ::elm::clock ck5(efl::eo::parent = win); + ck5.show_seconds_set(true); + ck5.edit_set(true); + int digedit = ELM_CLOCK_EDIT_HOUR_UNIT | ELM_CLOCK_EDIT_MIN_UNIT | ELM_CLOCK_EDIT_SEC_UNIT; + ck5.edit_mode_set(static_cast(digedit)); + bx.pack_end(ck5); + ck5.visible_set(true); + + win.visible_set(true); + + elm_run(); + return 0; +} +ELM_MAIN() diff --git a/legacy/elementary/src/examples/datetime_cxx_example.cc b/legacy/elementary/src/examples/datetime_cxx_example.cc new file mode 100644 index 0000000000..1eb55ec4e3 --- /dev/null +++ b/legacy/elementary/src/examples/datetime_cxx_example.cc @@ -0,0 +1,51 @@ +#include + +EAPI_MAIN int +elm_main (int argc, char *argv[]) +{ + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN); + + ::elm::win_standard win; + win.title_set("Datetime"); + win.autohide_set(true); + + ::elm::bg bg(efl::eo::parent = win); + bg.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + win.resize_object_add(bg); + bg.visible_set(true); + + ::elm::box bx(efl::eo::parent = win); + bx.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + win.resize_object_add(bx); + bx.visible_set(true); + + ::elm::datetime datetime(efl::eo::parent = bx); + datetime.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + datetime.size_hint_align_set(EVAS_HINT_FILL, 0.5); + datetime.field_visible_set(ELM_DATETIME_HOUR, false); + datetime.field_visible_set(ELM_DATETIME_MINUTE, false); + datetime.field_visible_set(ELM_DATETIME_AMPM, false); + bx.pack_end(datetime); + datetime.visible_set(true); + + ::elm::datetime datetime2(efl::eo::parent = bx); + datetime2.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + datetime2.size_hint_align_set(EVAS_HINT_FILL, 0.5); + datetime2.field_visible_set(ELM_DATETIME_YEAR, false); + datetime2.field_visible_set(ELM_DATETIME_MONTH, false); + datetime2.field_visible_set(ELM_DATETIME_DATE, false); + bx.pack_end(datetime2); + datetime2.visible_set(true); + + ::elm::datetime datetime3(efl::eo::parent = bx); + datetime3.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + datetime3.size_hint_align_set(EVAS_HINT_FILL, 0.5); + bx.pack_end(datetime3); + datetime3.visible_set(true); + + win.visible_set(true); + + elm_run(); + return 0; +} +ELM_MAIN() diff --git a/legacy/elementary/src/examples/glview_cxx_example_01.cc b/legacy/elementary/src/examples/glview_cxx_example_01.cc new file mode 100644 index 0000000000..f8b7101e3b --- /dev/null +++ b/legacy/elementary/src/examples/glview_cxx_example_01.cc @@ -0,0 +1,263 @@ +#include + +#include +#include + +typedef struct _GLData GLData; + +struct _GLData +{ + Evas_GL_API *glapi; + GLuint program; + GLuint vtx_shader; + GLuint fgmt_shader; + GLuint vbo; + int initialized : 1; +}; + +static float red = 1.0; + +static GLuint +load_shader(GLData *gld, GLenum type, const char *shader_src ) +{ + Evas_GL_API *gl = gld->glapi; + GLuint shader; + GLint compiled; + + shader = gl->glCreateShader(type); + if (shader==0) + return 0; + + gl->glShaderSource(shader, 1, &shader_src, NULL); + gl->glCompileShader(shader); + gl->glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled); + + if (!compiled) + { + GLint info_len = 0; + gl->glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &info_len); + if (info_len > 1) + { + char* info_log = new char[sizeof(char) * info_len]; + + gl->glGetShaderInfoLog(shader, info_len, NULL, info_log); + printf("Error compiling shader:\n%s\n======\n%s\n======\n", info_log, shader_src ); + free(info_log); + } + gl->glDeleteShader(shader); + return 0; + } + + return shader; +} + +static int +init_shaders(GLData *gld) +{ + Evas_GL_API *gl = gld->glapi; + + GLbyte vShaderStr[] = + "attribute vec4 vPosition; \n" + "void main() \n" + "{ \n" + " gl_Position = vPosition; \n" + "} \n"; + + GLbyte fShaderStr[] = + "#ifdef GL_ES \n" + "precision mediump float; \n" + "#endif \n" + "void main() \n" + "{ \n" + " gl_FragColor = vec4 ( 1.0, 0.0, 0.0, 1.0 );\n" + "} \n"; + + GLint linked; + + gld->vtx_shader = load_shader(gld, GL_VERTEX_SHADER, (const char*)vShaderStr); + gld->fgmt_shader = load_shader(gld, GL_FRAGMENT_SHADER, (const char*)fShaderStr); + + gld->program = gl->glCreateProgram( ); + if (gld->program==0) + return 0; + + gl->glAttachShader(gld->program, gld->vtx_shader); + gl->glAttachShader(gld->program, gld->fgmt_shader); + + gl->glBindAttribLocation(gld->program, 0, "vPosition"); + gl->glLinkProgram(gld->program); + gl->glGetProgramiv(gld->program, GL_LINK_STATUS, &linked); + + if (!linked) + { + GLint info_len = 0; + gl->glGetProgramiv(gld->program, GL_INFO_LOG_LENGTH, &info_len); + if (info_len > 1) + { + char* info_log = new char[sizeof(char) * info_len]; + + gl->glGetProgramInfoLog(gld->program, info_len, NULL, info_log); + printf("Error linking program:\n%s\n", info_log); + free(info_log); + } + gl->glDeleteProgram(gld->program); + return 0; + } + return 1; +} + +static void +_init_gl(Evas_Object *obj) +{ + GLData *gld = static_cast(evas_object_data_get(obj, "gld")); + assert(gld != 0); + ::elm::glview glv(eo_ref(obj)); + Evas_GL_API *gl = glv.gl_api_get(); + GLfloat vVertices[] = { + 0.0f, 0.5f, 0.0f, + -0.5f, -0.5f, 0.0f, + 0.5f, -0.5f, 0.0f }; + + if (!init_shaders(gld)) + { + std::cout << "Error Initializing Shaders" << std::endl; + return; + } + + gl->glGenBuffers(1, &gld->vbo); + gl->glBindBuffer(GL_ARRAY_BUFFER, gld->vbo); + gl->glBufferData(GL_ARRAY_BUFFER, 3 * 3 * 4, vVertices, GL_STATIC_DRAW); + +} + +static void +_del_gl(Evas_Object *obj) +{ + GLData *gld = static_cast(evas_object_data_get(obj, "gld")); + if (!gld) + { + std::cout << "Unable to get GLData. " << std::endl; + return; + } + ::elm::glview glv(eo_ref(obj)); + Evas_GL_API *gl = glv.gl_api_get(); + + gl->glDeleteShader(gld->vtx_shader); + gl->glDeleteShader(gld->fgmt_shader); + gl->glDeleteProgram(gld->program); + gl->glDeleteBuffers(1, &gld->vbo); + + evas_object_data_del(obj, "..gld"); + free(gld); +} + +static void +_resize_gl(Evas_Object *obj) +{ + int w, h; + ::elm::glview glv(eo_ref(obj)); + Evas_GL_API *gl = glv.gl_api_get(); + + glv.size_get(&w, &h); + + gl->glViewport(0, 0, w, h); +} + +static void +_draw_gl(Evas_Object *obj) +{ + GLData *gld = static_cast(evas_object_data_get(obj, "gld")); + ::elm::glview glv(eo_ref(obj)); + Evas_GL_API *gl = glv.gl_api_get(); + + if (!gld) return; + int w, h; + + glv.size_get(&w, &h); + + gl->glViewport(0, 0, w, h); + gl->glClearColor(red,0.8,0.3,1); + gl->glClear(GL_COLOR_BUFFER_BIT); + + gl->glEnable(GL_BLEND); + + gl->glUseProgram(gld->program); + + gl->glBindBuffer(GL_ARRAY_BUFFER, gld->vbo); + gl->glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0); + gl->glEnableVertexAttribArray(0); + + gl->glDrawArrays(GL_TRIANGLES, 0, 3); + + gl->glFinish(); + + red -= 0.1; + if (red < 0.0) red = 1.0; +} + +static Eina_Bool +_anim(void* data) +{ + static_cast(data)->changed_set(); + + return EINA_TRUE; +} + +EAPI_MAIN int +elm_main (int argc, char *argv[]) +{ + GLData *gld = NULL; + + if (!(gld = static_cast(calloc(1, sizeof(GLData))))) return 1; + + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN); + + ::elm::win win(elm_win_util_standard_add("glview simple", "GLView Simple")); + win.autohide_set(true); + + ::elm::box bx(efl::eo::parent = win); + bx.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + win.resize_object_add(bx); + bx.visible_set(true); + + ::elm::glview gl(efl::eo::parent = win, + gl.version_constructor(EVAS_GL_GLES_2_X)); + gld->glapi = gl.gl_api_get(); + gl.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + gl.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL); + + int gl_mode = ELM_GLVIEW_ALPHA | ELM_GLVIEW_DEPTH; + gl.mode_set(static_cast(gl_mode)); + gl.resize_policy_set(ELM_GLVIEW_RESIZE_POLICY_RECREATE); + gl.render_policy_set(ELM_GLVIEW_RENDER_POLICY_ON_DEMAND); + gl.init_func_set(_init_gl); + gl.del_func_set(_del_gl); + gl.resize_func_set(_resize_gl); + gl.render_func_set(_draw_gl); + + bx.pack_end(gl); + gl.visible_set(true); + + gl.object::focus_set(true); + + Ecore_Animator *ani = ecore_animator_add(_anim, &gl); + + evas_object_data_set(gl._eo_ptr(), "ani", ani); + evas_object_data_set(gl._eo_ptr(), "gld", gld); + gl.object::callback_del_add(std::bind([&] () { ecore_animator_del(ani); })); + + ::elm::button bt(efl::eo::parent = win); + bt.text_set(nullptr, "OK"); + bt.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL); + bt.size_hint_weight_set(EVAS_HINT_EXPAND, 0.0); + bx.pack_end(bt); + bt.visible_set(true); + bt.callback_clicked_add(std::bind([] () { elm_exit(); })); + + win.size_set(320, 480); + win.visible_set(true); + + elm_run(); + return 0; +} +ELM_MAIN() diff --git a/legacy/elementary/src/examples/hoversel_cxx_example_01.cc b/legacy/elementary/src/examples/hoversel_cxx_example_01.cc new file mode 100644 index 0000000000..776d92a098 --- /dev/null +++ b/legacy/elementary/src/examples/hoversel_cxx_example_01.cc @@ -0,0 +1,84 @@ +#include +#include +#include + +static void _print_items(void *data, Evas_Object *obj, void *event_info); +static void _free(void *data, Evas_Object *obj, void *event_info); + +EAPI_MAIN int +elm_main (int argc, char *argv[]) +{ + efl::eina::eina_init eina_init; + + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN); + + ::elm::win_standard win; + win.title_set("Hoversel"); + win.autohide_set(true); + + evas::rectangle rect(efl::eo::parent = win); + rect.color_set(255, 0, 0, 255); + rect.visible_set(true); + + ::elm::hoversel hoversel(efl::eo::parent = win); + hoversel.horizontal_set(false); + hoversel.text_set("elm.text", "Add an item to Hoversel"); + hoversel.content_set(nullptr, rect); + + hoversel.item_add("Print items", nullptr, ELM_ICON_NONE, &_print_items, NULL); + hoversel.item_add( "Option 2", "home", ELM_ICON_STANDARD, NULL,NULL); + + auto add_item = std::bind([] (::elm::hoversel obj) + { + static int num = 0; + char *str = new char[sizeof(char) * 10]; + + snprintf(str, 10, "item %d", ++num); + + elm::widget_item hoversel_item = obj.item_add(str, nullptr, ELM_ICON_NONE, NULL, str); + elm_object_item_del_cb_set(hoversel_item._eo_ptr(), &_free); + }, std::placeholders::_1); + + hoversel.callback_clicked_add(add_item); + + hoversel.size_set(180, 30); + hoversel.position_set( 10, 10); + hoversel.visible_set(true); + + ::elm::button btn(efl::eo::parent = win); + btn.text_set("elm.text", "Clear all Items"); + + auto clear_btn_clicked = std::bind([&] () { hoversel.clear(); }); + + btn.callback_clicked_add(clear_btn_clicked); + btn.size_set(180, 30); + btn.position_set(10, 50); + btn.visible_set(true); + + win.size_set(200, 300); + win.visible_set(true); + + elm_run(); + + return 0; +} +ELM_MAIN() + +static void +_print_items(void *data, Evas_Object *obj, void *event_info) +{ + efl::eina::range_list items(elm_hoversel_items_get(obj)); + + for (auto i : items) + try + { + std::cout << i.part_text_get(nullptr) << std::endl; + } + catch (std::logic_error const&) {} +} + +static void +_free(void *data, Evas_Object *obj, void *event_info) +{ + delete[] static_cast(data); +} diff --git a/legacy/elementary/src/examples/icon_cxx_example_01.cc b/legacy/elementary/src/examples/icon_cxx_example_01.cc new file mode 100644 index 0000000000..399c080bbc --- /dev/null +++ b/legacy/elementary/src/examples/icon_cxx_example_01.cc @@ -0,0 +1,38 @@ +#include + +EAPI_MAIN int +elm_main (int argc, char *argv[]) +{ + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN); + + ::elm::win win(elm_win_util_standard_add("icon", "Icon")); + win.autohide_set(true); + + ::elm::icon icon(efl::eo::parent = win); + icon.order_lookup_set(ELM_ICON_LOOKUP_THEME_FDO); + icon.standard_set("home"); + + const char *path, *group; + icon.file_get(&path, &group); + std::cout << "path = " << path << ", group = "<< group; + + efl::eina::optional name; + name = icon.standard_get(); + std::cout << ", name = " << *name << std::endl; + + icon.no_scale_set(true); + icon.resizable_set(false, true); + icon.smooth_set(false); + icon.fill_outside_set(true); + + icon.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + win.resize_object_add(icon); + icon.visible_set(true); + + win.size_set(320, 320); + win.visible_set(true); + + elm_run(); + return 0; +} +ELM_MAIN() diff --git a/legacy/elementary/src/examples/location_cxx_example_01.cc b/legacy/elementary/src/examples/location_cxx_example_01.cc new file mode 100644 index 0000000000..b31adee425 --- /dev/null +++ b/legacy/elementary/src/examples/location_cxx_example_01.cc @@ -0,0 +1,82 @@ +#include + +#ifdef ELM_ELOCATION +#include +#endif + +#ifdef ELM_ELOCATION +static void +_print_position(Elocation_Position *position, ::elm::label label) +{ + char buffer[1024]; + + if (!position) return; + snprintf(buffer, sizeof(buffer), + "GeoClue position reply with data from timestamp %i
" + "Latitude: %f
" + "Longitude: %f
" + "Altitude: %f
" + "Accuracy level: %i
" + "Accuracy horizontal: %f
" + "Accuracy vertical: %f", + position->timestamp, position->latitude, position->longitude, + position->altitude, position->accur->level, + position->accur->horizontal, position->accur->vertical); + label.text_set("elm.text", buffer); +} + +static Eina_Bool +_position_changed(void *data, int ev_type, void *event) +{ + Elocation_Position *position; + + position = static_cast(event); + _print_position(position, *static_cast<::elm::label*>(data)); + return ECORE_CALLBACK_DONE; +} +#endif + +EAPI_MAIN int +elm_main(int argc, char *argv[]) +{ +#ifdef ELM_ELOCATION + Elocation_Address *address; + Elocation_Position *position; +#endif + + if (elm_need_elocation() == false) + return -1; + + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN); + + ::elm::win win(elm_win_util_standard_add("elocation", "Elocation example")); + win.autohide_set(true); + + ::elm::label label(efl::eo::parent = win); + label.line_wrap_set(ELM_WRAP_CHAR); + label.text_set("elm.text", "Getting location ..."); + label.size_hint_weight_set(EVAS_HINT_EXPAND, 0.0); + label.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL); + label.slide_mode_set(ELM_LABEL_SLIDE_MODE_ALWAYS); + label.size_set(600, 480); + label.visible_set(true); + +#ifdef ELM_ELOCATION + address = elocation_address_new(); + position = elocation_position_new(); + + ecore_event_handler_add(ELOCATION_EVENT_POSITION, _position_changed, &label); + + elocation_position_get(position); + _print_position(position, label); +#endif + + win.size_set(600, 480); + win.visible_set(true); + + elm_run(); + return 0; +} +ELM_MAIN() + + diff --git a/legacy/elementary/src/examples/menu_cxx_example_01.cc b/legacy/elementary/src/examples/menu_cxx_example_01.cc new file mode 100644 index 0000000000..9aeb35e580 --- /dev/null +++ b/legacy/elementary/src/examples/menu_cxx_example_01.cc @@ -0,0 +1,69 @@ +#include +#include +#include + +EAPI_MAIN int +elm_main (int argc, char *argv[]) +{ + efl::eina::eina_init eina_init; + + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN); + + ::elm::win_standard win; + win.title_set("Menu"); + win.autohide_set(true); + + evas::rectangle rect(efl::eo::parent = win); + win.resize_object_add(rect); + rect.size_hint_min_set(0, 0); + rect.color_set( 0, 0, 0, 0); + rect.visible_set(true); + + ::elm::widget_item no_parent(nullptr); + ::elm::menu menu(efl::eo::parent = win); + menu.item_add(no_parent, nullptr, "first item", nullptr, nullptr); + elm::widget_item + menu_it = menu.item_add(no_parent, "mail-reply-all", "second item", nullptr, nullptr); + + menu.item_add(menu_it, "object-rotate-left", "menu 1", NULL, NULL); + ::elm::button button(efl::eo::parent = win); + button.text_set("elm.text", "button - delete items"); + elm::widget_item menu_it1 + = menu.item_add(menu_it, nullptr, nullptr, NULL, NULL); + menu_it1.part_content_set(nullptr, button); + + auto del_it = std::bind([&] () + { + auto list = efl::eo::downcast(menu_it).subitems_get(); + for(auto& item : list) + { + elm_object_item_del(item._eo_ptr()); + } + }); + + button.callback_clicked_add(del_it); + menu.item_separator_add(menu_it); + menu.item_add(menu_it, nullptr, "third item", NULL, NULL); + menu.item_add(menu_it, nullptr, "fourth item", NULL, NULL); + menu.item_add(menu_it, "window-new", "sub menu", NULL, NULL); + + elm::widget_item menu_it2 = menu.item_add(no_parent, nullptr, "third item", nullptr, nullptr); + menu_it2.disabled_set(EINA_TRUE); + + auto show = std::bind([&] (void *event_info) + { + Evas_Event_Mouse_Down *ev = static_cast(event_info); + menu.move(ev->canvas.x, ev->canvas.y); + menu.visible_set(true); + }, std::placeholders::_3); + + rect.callback_mouse_down_add( show ); + menu.visible_set(true); + + win.size_set(250, 350); + win.visible_set(true); + + elm_run(); + return 0; +} +ELM_MAIN() diff --git a/legacy/elementary/src/examples/popup_cxx_example_01.cc b/legacy/elementary/src/examples/popup_cxx_example_01.cc new file mode 100644 index 0000000000..a678533114 --- /dev/null +++ b/legacy/elementary/src/examples/popup_cxx_example_01.cc @@ -0,0 +1,32 @@ +#include + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN); + + ::elm::win_standard win; + win.title_set("Popup"); + win.autohide_set(true); + + ::elm::popup popup(efl::eo::parent = win); + popup.timeout_set(3.0); + popup.text_set(nullptr, "Title"); + popup.visible_set(true); + + auto popup_hide = std::bind ( [&] () + { + popup.visible_set(false); + }); + + popup.callback_timeout_add(popup_hide); + popup.callback_block_clicked_add(popup_hide); + win.size_set(480, 800); + win.visible_set(true); + + elm_run(); + return 0; +} +ELM_MAIN() + + diff --git a/legacy/elementary/src/examples/radio_cxx_example_01.cc b/legacy/elementary/src/examples/radio_cxx_example_01.cc new file mode 100644 index 0000000000..34a9f09abe --- /dev/null +++ b/legacy/elementary/src/examples/radio_cxx_example_01.cc @@ -0,0 +1,79 @@ +#include + +EAPI_MAIN int +elm_main (int argc, char *argv[]) +{ + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN); + + static int val = 1; + + ::elm::win_standard win; + win.title_set("Radio"); + win.autohide_set(true); + + ::elm::box bx(efl::eo::parent = win); + bx.horizontal_set(true); + bx.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + win.resize_object_add(bx); + bx.visible_set(true); + + ::elm::radio radio(efl::eo::parent = win); + ::elm::radio group(efl::eo::parent = win); + group = radio; + radio.text_set("elm.text", "Radio 1"); + radio.state_value_set(1); + radio.value_pointer_set(&val); + ::elm::icon ic(efl::eo::parent = win); + ic.standard_set("home"); + radio.content_set("icon", ic); + bx.pack_end(radio); + radio.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + radio.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL); + radio.visible_set(true); + + auto cb_val = std::bind([] () { std::cout << "val is now: " << val << std::endl; }); + + radio.callback_changed_add(cb_val); + + ::elm::radio radio2(efl::eo::parent = win); + radio2.text_set("elm.text", "Radio 2"); + radio2.state_value_set(2); + radio2.value_pointer_set(&val); + radio2.group_add(group); + ::elm::icon ic2(efl::eo::parent = win); + ic2.standard_set("file"); + radio2.content_set("icon", ic2); + bx.pack_end(radio2); + radio2.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + radio2.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL); + radio2.visible_set(true); + radio2.callback_changed_add(cb_val); + + ::elm::radio radio3(efl::eo::parent = win); + radio3.text_set("elm.text", "Radio 3"); + radio3.state_value_set(3); + radio3.value_pointer_set(&val); + radio3.group_add(group); + bx.pack_end(radio3); + radio3.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + radio3.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL); + radio3.visible_set(true); + radio3.callback_changed_add(cb_val); + + ::elm::radio radio4(efl::eo::parent = win); + radio4.text_set("elm.text", "Radio 4"); + radio4.state_value_set(4); + radio4.value_pointer_set(&val); + radio4.group_add(group); + bx.pack_end(radio4); + radio4.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + radio4.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL); + radio4.visible_set(true); + radio4.callback_changed_add(cb_val); + + win.visible_set(true); + + elm_run(); + return 0; +} +ELM_MAIN() diff --git a/legacy/elementary/src/examples/separator_cxx_example_01.cc b/legacy/elementary/src/examples/separator_cxx_example_01.cc new file mode 100644 index 0000000000..98bf264f16 --- /dev/null +++ b/legacy/elementary/src/examples/separator_cxx_example_01.cc @@ -0,0 +1,51 @@ +#include +#include + +EAPI_MAIN int +elm_main (int argc, char *argv[]) +{ + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN); + + ::elm::win_standard win; + win.title_set("Separator"); + win.autohide_set(true); + + ::elm::bg bg(efl::eo::parent = win); + bg.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + win.resize_object_add(bg); + bg.visible_set(true); + + ::elm::box bx(efl::eo::parent = win); + bx.horizontal_set(true); + bx.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + win.resize_object_add(bx); + bx.visible_set(true); + + evas::rectangle rect(efl::eo::parent = win); + rect.color_set( 0, 255, 0, 255); + rect.size_hint_min_set( 90, 200); + rect.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + rect.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL); + rect.visible_set(true); + bx.pack_end(rect); + + ::elm::separator separator(efl::eo::parent = win); + separator.horizontal_set(true); + separator.visible_set(true); + bx.pack_end(separator); + + evas::rectangle rect2(efl::eo::parent = win); + rect2.color_set( 0, 0, 255, 255); + rect2.size_hint_min_set( 90, 200); + rect2.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + rect2.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL); + rect2.visible_set(true); + bx.pack_end(rect2); + + win.visible_set(true); + + elm_run(); + return 0; +} +ELM_MAIN() + diff --git a/legacy/elementary/src/examples/slider_cxx_example.cc b/legacy/elementary/src/examples/slider_cxx_example.cc new file mode 100644 index 0000000000..273abea1eb --- /dev/null +++ b/legacy/elementary/src/examples/slider_cxx_example.cc @@ -0,0 +1,109 @@ +#include + +EAPI_MAIN int +elm_main (int argc, char *argv[]) +{ + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN); + + ::elm::win win(elm_win_util_standard_add("slider", "Slider Example")); + win.autohide_set(true); + + ::elm::box bx(efl::eo::parent = win); + bx.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + win.resize_object_add(bx); + bx.visible_set(true); + + ::elm::slider sl(efl::eo::parent = win); + sl.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + sl.size_hint_align_set(EVAS_HINT_FILL, 0.5); + bx.pack_end(sl); + sl.visible_set(true); + + ::elm::slider sl2(efl::eo::parent = win); + sl2.text_set("elm.text", "Counter"); + ::elm::icon ic(efl::eo::parent = win); + ic.standard_set("home"); + ic.resizable_set(false, false); + sl2.content_set("icon", ic); + + ::elm::icon ic2(efl::eo::parent = win); + ic2.standard_set("folder"); + ic2.resizable_set(false, false); + sl2.content_set("end", ic2); + + sl2.size_hint_align_set(EVAS_HINT_FILL, 0.5); + sl2.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + bx.pack_end(sl2); + sl2.visible_set(true); + + ::elm::slider sl3(efl::eo::parent = win); + sl3.value_set(1); + sl3.span_size_set(200); + sl3.size_hint_align_set(EVAS_HINT_FILL, 0.5); + sl3.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + bx.pack_end(sl3); + sl3.visible_set(true); + + ::elm::slider sl4(efl::eo::parent = win); + sl4.unit_format_set("%1.0f units"); + sl4.min_max_set(0, 100); + sl4.size_hint_align_set(EVAS_HINT_FILL, 0.5); + sl4.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + bx.pack_end(sl4); + sl4.visible_set(true); + + ::elm::slider sl5(efl::eo::parent = win); + sl5.indicator_format_set("%1.2f"); + sl5.inverted_set(true); + sl5.size_hint_align_set(EVAS_HINT_FILL, 0.5); + sl5.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + bx.pack_end(sl5); + sl5.visible_set(true); + + ::elm::slider sl6(efl::eo::parent = win); + sl6.horizontal_set(false); + + auto indicator_format = [] (double val) { + char *indicator = new char[32]; + snprintf(indicator, 32, "%1.2f u", val); + return indicator; + }; + + auto indicator_free = [] (char *obj) {delete obj;} ; + + sl6.indicator_format_function_set(indicator_format, indicator_free); + + sl6.size_hint_align_set(0.5, EVAS_HINT_FILL); + sl6.size_hint_weight_set(0, EVAS_HINT_EXPAND); + bx.pack_end(sl6); + sl6.visible_set(true); + + ::elm::slider sl7(efl::eo::parent = win); + sl7.unit_format_set("%1.3f units"); + sl7.indicator_format_function_set(indicator_format, indicator_free); + sl7.size_hint_align_set(EVAS_HINT_FILL, 0.5); + sl7.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + bx.pack_end(sl7); + sl7.visible_set(true); + + auto changed = std::bind ( [] (::elm::slider obj) + { + double val = obj.value_get(); + std::cout << "Changed to " << val << std::endl; + } , std::placeholders::_1 ); + + auto delay = std::bind ( [] (::elm::slider obj) + { + double val = obj.value_get(); + std::cout << "Delay changed to " << val << std::endl; + } , std::placeholders::_1 ); + + sl7.callback_changed_add(changed); + sl7.callback_delay_changed_add(delay); + + win.visible_set(true); + + elm_run(); + return 0; +} +ELM_MAIN() diff --git a/legacy/elementary/src/examples/spinner_cxx_example.cc b/legacy/elementary/src/examples/spinner_cxx_example.cc new file mode 100644 index 0000000000..561c6adfa2 --- /dev/null +++ b/legacy/elementary/src/examples/spinner_cxx_example.cc @@ -0,0 +1,95 @@ +#include + +EAPI_MAIN int +elm_main (int argc, char *argv[]) +{ + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN); + + ::elm::win win(elm_win_util_standard_add("spinner", "Spinner Example")); + win.autohide_set(true); + + ::elm::box bx(efl::eo::parent = win); + bx.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + win.resize_object_add(bx); + bx.visible_set(true); + + ::elm::spinner sp(efl::eo::parent = win); + sp.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + sp.size_hint_align_set(EVAS_HINT_FILL, 0.5); + bx.pack_end(sp); + sp.visible_set(true); + + ::elm::spinner sp2(efl::eo::parent = win); + sp2.label_format_set("Percentage %%%1.2f something"); + sp2.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + sp2.size_hint_align_set(EVAS_HINT_FILL, 0.5); + bx.pack_end(sp2); + sp2.visible_set(true); + + ::elm::spinner sp3(efl::eo::parent = win); + sp3.label_format_set("%1.1f units"); + sp3.step_set(1.5); + sp3.wrap_set(true); + sp3.min_max_set(-50.0, 250.0); + sp3.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + sp3.size_hint_align_set(EVAS_HINT_FILL, 0.5); + bx.pack_end(sp3); + sp3.visible_set(true); + + ::elm::spinner sp4(efl::eo::parent = win); + sp4.style_set("vertical"); + sp4.interval_set(0.2); + sp4.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + sp4.size_hint_align_set(EVAS_HINT_FILL, 0.5); + bx.pack_end(sp4); + sp4.visible_set(true); + + ::elm::spinner sp5(efl::eo::parent = win); + sp5.editable_set(false); + sp5.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + sp5.size_hint_align_set(EVAS_HINT_FILL, 0.5); + bx.pack_end(sp5); + sp5.visible_set(true); + + ::elm::spinner sp6(efl::eo::parent = win); + sp6.editable_set(false); + sp6.min_max_set(1, 12); + sp6.special_value_add(1, "January"); + sp6.special_value_add(2, "February"); + sp6.special_value_add(3, "March"); + sp6.special_value_add(4, "April"); + sp6.special_value_add(5, "May"); + sp6.special_value_add(6, "June"); + sp6.special_value_add(7, "July"); + sp6.special_value_add(8, "August"); + sp6.special_value_add(9, "September"); + sp6.special_value_add(10, "October"); + sp6.special_value_add(11, "November"); + sp6.special_value_add(12, "December"); + sp6.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + sp6.size_hint_align_set(EVAS_HINT_FILL, 0.5); + bx.pack_end(sp6); + sp6.visible_set(true); + + ::elm::spinner sp7(efl::eo::parent = win); + sp7.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + sp7.size_hint_align_set(EVAS_HINT_FILL, 0.5); + bx.pack_end(sp7); + sp7.visible_set(true); + sp7.editable_set(true); + + auto changed = std::bind([&] () { std::cout << "Value changed to " << sp7.value_get() << std::endl; }); + + sp7.callback_changed_add( changed ); + + auto delay = std::bind([&] () {std::cout << "Value delay changed to " << sp7.value_get() << std::endl;}); + + sp7.callback_delay_changed_add( delay ); + + win.visible_set(true); + + elm_run(); + return 0; +} +ELM_MAIN() + diff --git a/legacy/elementary/src/examples/table_cxx_example_01.cc b/legacy/elementary/src/examples/table_cxx_example_01.cc new file mode 100644 index 0000000000..1af3b45b28 --- /dev/null +++ b/legacy/elementary/src/examples/table_cxx_example_01.cc @@ -0,0 +1,43 @@ +#include + +EAPI_MAIN int +elm_main (int argc, char *argv[]) +{ + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN); + + ::elm::win win(elm_win_util_standard_add("table", "Table")); + win.autohide_set(true); + + ::elm::table table(efl::eo::parent = win); + win.resize_object_add(table); + table.visible_set(true); + table.padding_set(5, 5); + table.homogeneous_set(true); + + ::elm::label label(efl::eo::parent = win); + label.text_set(nullptr, "label 0"); + label.visible_set(true); + table.pack(label, 0, 0, 1, 1); + + ::elm::label label1(efl::eo::parent = win); + label1.text_set(nullptr, "label 1"); + label1.visible_set(true); + table.pack(label1, 1, 0, 1, 1); + + ::elm::label label2(efl::eo::parent = win); + label2.text_set(nullptr, "label 2"); + label2.visible_set(true); + table.pack(label2, 0, 1, 1, 1); + + ::elm::label label3(efl::eo::parent = win); + label3.text_set(nullptr, "label 3"); + label3.visible_set(true); + table.pack(label3, 1, 1, 1, 1); + + win.visible_set(true); + + elm_run(); + return 0; +} +ELM_MAIN() + diff --git a/legacy/elementary/src/examples/table_cxx_example_02.cc b/legacy/elementary/src/examples/table_cxx_example_02.cc new file mode 100644 index 0000000000..9ab119c077 --- /dev/null +++ b/legacy/elementary/src/examples/table_cxx_example_02.cc @@ -0,0 +1,46 @@ +#include +#include + +EAPI_MAIN int +elm_main (int argc, char *argv[]) +{ + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN); + + ::elm::win win(elm_win_util_standard_add("table", "Table")); + win.autohide_set(true); + + ::elm::table table(efl::eo::parent = win); + win.resize_object_add(table); + table.visible_set(true); + table.homogeneous_set(false); + + evas::rectangle rect(efl::eo::parent = win); + rect.color_set( 255, 0, 0, 255); + rect.size_hint_min_set( 100, 50); + rect.visible_set(true); + table.pack(rect, 0, 0, 2, 1); + + evas::rectangle rect2(efl::eo::parent = win); + rect2.color_set( 0, 255, 0, 255); + rect2.size_hint_min_set(50, 100); + rect2.visible_set(true); + table.pack(rect2, 0, 1, 1, 2); + + evas::rectangle rect3(efl::eo::parent = win); + rect3.color_set( 0, 0, 255, 255); + rect3.size_hint_min_set(50, 50); + rect3.visible_set(true); + table.pack(rect3, 1, 1, 1, 1); + + evas::rectangle rect4(efl::eo::parent = win); + rect4.color_set( 255, 255, 0, 255); + rect4.size_hint_min_set(50, 50); + rect4.visible_set(true); + table.pack(rect4, 1, 2, 1, 1); + + win.visible_set(true); + + elm_run(); + return 0; +} +ELM_MAIN() diff --git a/legacy/elementary/src/examples/thumb_cxx_example_01.cc b/legacy/elementary/src/examples/thumb_cxx_example_01.cc new file mode 100644 index 0000000000..abca9acc75 --- /dev/null +++ b/legacy/elementary/src/examples/thumb_cxx_example_01.cc @@ -0,0 +1,48 @@ +#include + +#include +#include + +EAPI_MAIN int +elm_main(int argc, char *argv[]) +{ + elm_need_ethumb(); + + elm_app_info_set(reinterpret_cast(elm_main), "elementary", "images/plant_01.jpg"); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN); + + ::elm::win_standard win; + win.title_set("Thumbnailer"); + win.autohide_set(true); + + ::elm::thumb thumb(efl::eo::parent = win); + + auto generation_started = std::bind([] { std::cout << "thumbnail generation started." << std::endl; }); + + auto generation_finished = std::bind([] { std::cout << "thumbnail generation finished." << std::endl; }); + + auto generation_error = std::bind([] { std::cout << "thumbnail generation error." << std::endl; }); + + thumb.callback_generate_start_add( generation_started ); + thumb.callback_generate_stop_add( generation_finished ); + thumb.callback_generate_error_add( generation_error ); + + thumb.size_set(160, 160); + thumb.editable_set(false); + std::stringstream ss; + ss << elm_app_data_dir_get() << "/images/plant_01.jpg"; + thumb.file_set(ss.str(), "image"); + thumb.reload(); + + thumb.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + win.resize_object_add(thumb); + thumb.visible_set(true); + + win.size_set(320, 320); + win.visible_set(true); + + elm_run(); + return 0; +} +ELM_MAIN() + diff --git a/legacy/elementary/src/lib/.gitignore b/legacy/elementary/src/lib/.gitignore index d79d065490..0015d39f9c 100644 --- a/legacy/elementary/src/lib/.gitignore +++ b/legacy/elementary/src/lib/.gitignore @@ -1,9 +1,11 @@ /Elementary.h +/Elementary.hh /elm_intro.h /*.eo.c /*.eo.h /*.eo.legacy.h /*.eo.hh +/*.eo.impl.hh /*.eot.h /eldbus_elementary_colorclass.c /eldbus_elementary_colorclass.h diff --git a/legacy/elementary/src/lib/Elementary.hh.in b/legacy/elementary/src/lib/Elementary.hh.in new file mode 100644 index 0000000000..9075c3c099 --- /dev/null +++ b/legacy/elementary/src/lib/Elementary.hh.in @@ -0,0 +1,146 @@ +/* This is the prmary Elementary header file that includes all other useful + * headers. + * + * Elementary is distributed under the LGPLv2 license. Please see the COPYING + * file that was distributed with this source. + */ +#ifndef ELEMENTARY_CXX_HH +#define ELEMENTARY_CXX_HH + +#if defined(ELEMENTARY_H) || defined(ELM_WIDGET_H) +#error Do not include Elm C API headers before including Elementary.hh +#endif + +#ifdef HAVE_CONFIG_H +extern "C" { +#include +} +#endif + +#define ELM_INTERNAL_API_ARGESFSDFEFC +#define ELM_WIDGET_ITEM_PROTECTED + +extern "C" { + +#include "Elementary.h" + +#include "elm_widget.h" + +} + +#ifdef EFL_BETA_API_SUPPORT +@ELM_ELOCATION_DEF@ ELM_ELOCATION +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#endif +#endif diff --git a/legacy/elementary/src/lib/Makefile.am b/legacy/elementary/src/lib/Makefile.am index d965c1c14f..b7ce8b40cf 100644 --- a/legacy/elementary/src/lib/Makefile.am +++ b/legacy/elementary/src/lib/Makefile.am @@ -641,6 +641,7 @@ elm_eolian_c = $(elm_eolian_files:%.eo=%.eo.c) elm_eolian_h = $(elm_eolian_files:%.eo=%.eo.h) elm_eolian_legacy_h = $(elm_eolian_files:%.eo=%.eo.legacy.h) elm_eolian_hh = $(elm_eolian_files:%.eo=%.eo.hh) +elm_eolian_impl_hh = $(elm_eolian_files:%.eo=%.eo.impl.hh) elm_eolian_eot_h = $(elm_eolian_type_files:%.eot=%.eot.h) @@ -657,134 +658,14 @@ EXTRA_DIST += ${elementaryeolianfiles_DATA} nodist_includesunstable_HEADERS = $(elm_eolian_h) $(elm_eolian_legacy_h) $(elm_eolian_eot_h) CLEANFILES += $(nodist_includesunstable_HEADERS) -elementaryeolianfilesdir = $(datadir)/eolian/include/elementary-@VMAJ@ -elementaryeolianfiles_DATA = \ - elm_widget.eo \ - elm_container.eo \ - elm_layout.eo \ - elm_interface_scrollable.eo \ - elm_pan.eo \ - elm_frame.eo \ - elm_hover.eo \ - elm_access.eo \ - elm_actionslider.eo \ - elm_app_client.eo \ - elm_app_client_view.eo \ - elm_app_server.eo \ - elm_app_server_view.eo \ - elm_atspi_app_object.eo \ - elm_atspi_bridge.eo \ - elm_interface_atspi_accessible.eo \ - elm_interface_atspi_action.eo \ - elm_interface_atspi_component.eo \ - elm_interface_atspi_editable_text.eo \ - elm_interface_atspi_image.eo \ - elm_interface_atspi_selection.eo \ - elm_interface_atspi_text.eo \ - elm_interface_atspi_value.eo \ - elm_interface_atspi_widget_action.eo \ - elm_interface_atspi_window.eo \ - elm_bg.eo \ - elm_box.eo \ - elm_bubble.eo \ - elm_button.eo \ - elm_calendar.eo \ - elm_check.eo \ - elm_clock.eo \ - elm_colorselector.eo \ - elm_conformant.eo \ - elm_ctxpopup.eo \ - elm_datetime.eo \ - elm_dayselector.eo \ - elm_diskselector.eo \ - elm_entry.eo \ - elm_fileselector.eo \ - elm_fileselector_button.eo \ - elm_fileselector_entry.eo \ - elm_flipselector.eo \ - elm_flip.eo \ - elm_general.eot \ - elm_gengrid.eo \ - elm_gengrid_pan.eo \ - elm_genlist.eo \ - elm_genlist_pan.eo \ - elm_gesture_layer.eo \ - elm_glview.eo \ - elm_grid.eo \ - elm_hoversel.eo \ - elm_image.eo \ - elm_icon.eo \ - elm_index.eo \ - elm_interface_fileselector.eo \ - elm_inwin.eo \ - elm_label.eo \ - elm_list.eo \ - elm_map_pan.eo \ - elm_map.eo \ - elm_menu.eo \ - elm_multibuttonentry.eo \ - elm_naviframe.eo \ - elm_panel.eo \ - elm_mapbuf.eo \ - elm_notify.eo \ - elm_panes.eo \ - elm_photocam.eo \ - elm_photocam_pan.eo \ - elm_photo.eo \ - elm_player.eo \ - elm_plug.eo \ - elm_popup.eo \ - elm_prefs.eo \ - elm_progressbar.eo \ - elm_radio.eo \ - elm_route.eo \ - elm_scroller.eo \ - elm_segment_control.eo \ - elm_separator.eo \ - elm_slider.eo \ - elm_slideshow.eo \ - elm_spinner.eo \ - elm_systray.eo \ - elm_table.eo \ - elm_thumb.eo \ - elm_toolbar.eo \ - elm_video.eo \ - elm_view_list.eo \ - elm_view_form.eo \ - elm_web.eo \ - elm_win.eo \ - elm_win_standard.eo \ - elm_widget_item.eo \ - elm_color_item.eo \ - elm_dayselector_item.eo \ - elm_hoversel_item.eo \ - elm_segment_control_item.eo \ - elm_slideshow_item.eo \ - elm_flipselector_item.eo \ - elm_menu_item.eo \ - elm_ctxpopup_item.eo \ - elm_index_item.eo \ - elm_multibuttonentry_item.eo \ - elm_naviframe_item.eo \ - elm_genlist_item.eo \ - elm_gengrid_item.eo \ - elm_list_item.eo \ - elm_toolbar_item.eo \ - elm_diskselector_item.eo \ - elm_popup_item.eo - EXTRA_DIST += ${elementaryeolianfiles_DATA} includecxxbindingsdir = $(includedir)/elementary-cxx-@VMAJ@ if HAVE_CXX11 -nodist_includecxxbindings_HEADERS = Elementary.hh $(elm_eolian_hh) -CLEANFILES += Elementary.hh $(nodist_includecxxbindings_HEADERS) -Elementary.hh: $(elm_eolian_hh) - @echo @ECHO_E@ "#ifndef ELEMENTARY_CXX_HH\n#define ELEMENTARY_CXX_HH\n" > $(top_builddir)/src/lib/Elementary.hh - @echo @ECHO_E@ "#ifdef EFL_BETA_API_SUPPORT" >> $(top_builddir)/src/lib/Elementary.hh - @for i in $(elm_eolian_hh); do echo "#include <$$(basename $$i)>" >> $(top_builddir)/src/lib/Elementary.hh; done - @echo @ECHO_E@ "#endif\n\n#endif\n" >> $(top_builddir)/src/lib/Elementary.hh +nodist_includecxxbindings_HEADERS = Elementary.hh $(elm_eolian_hh) $(elm_eolian_impl_hh) +CLEANFILES += $(nodist_includecxxbindings_HEADERS) +EXTRA_DIST += Elementary.hh.in endif diff --git a/legacy/elementary/src/tests/.gitignore b/legacy/elementary/src/tests/.gitignore index 4a2ff4da7a..b14d3623bf 100644 --- a/legacy/elementary/src/tests/.gitignore +++ b/legacy/elementary/src/tests/.gitignore @@ -3,3 +3,6 @@ /elm_suite.log /elm_suite.trs /test-suite.log +/elm_cxx_suite +/elm_cxx_suite.log +/elm_cxx_suite.trs diff --git a/legacy/elementary/src/tests/elm_cxx_suite.cc b/legacy/elementary/src/tests/elm_cxx_suite.cc index 8a658dacde..1e7a5d63a0 100644 --- a/legacy/elementary/src/tests/elm_cxx_suite.cc +++ b/legacy/elementary/src/tests/elm_cxx_suite.cc @@ -1,124 +1,4 @@ - -extern "C" -{ - -#ifdef HAVE_CONFIG_H -# include "elementary_config.h" -#endif - -#define ELM_INTERNAL_API_ARGESFSDFEFC -#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED -#define ELM_INTERFACE_ATSPI_COMPONENT_PROTECTED -#define ELM_INTERFACE_ATSPI_ACTION_PROTECTED -#define ELM_INTERFACE_ATSPI_VALUE_PROTECTED -#define ELM_INTERFACE_ATSPI_EDITABLE_TEXT_PROTECTED -#define ELM_INTERFACE_ATSPI_TEXT_PROTECTED -#define ELM_INTERFACE_ATSPI_SELECTION_PROTECTED -#define ELM_INTERFACE_ATSPI_IMAGE_PROTECTED -#define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED - -#include -#include -#include - -#include -#include -#include -#include -#include -} - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include int main() {