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

5107 lines
181 KiB

/**
* @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 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 approach 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 <b> only @a a </b> by reference and <b> only
* @a b </b> by copy
* @li [&, a] - Capture variables by reference and <b> only @a a </b>
* 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:
* <b>First Example</b> - @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.
* <b>Second Example</b> - @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 opposed 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 opposed 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 opposed 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 opposed 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 opposed 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 alignment, choose our packing method and making out
* up button visible.
* @skip up
* @until visibility
* For this directional buttons we'll have a different 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 opposed 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