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.
 
 
 
 
 
 

5106 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
* "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 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.
* 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 <tt> struct tm </tt>.
* <tt> struct tm </tt>, declared on @c time.h, is a structure
* composed by nine integers:
* @li <tt> tm_sec seconds [0,59] </tt>
* @li <tt> tm_min minutes [0,59] </tt>
* @li <tt> tm_hour hour [0,23] </tt>
* @li <tt> tm_mday day of month [1,31] </tt>
* @li <tt> tm_mon month of year [0,11] </tt>
* @li <tt> tm_year years since 1900 </tt>
* @li <tt> tm_wday day of week [0,6] (Sunday = 0) </tt>
* @li <tt> tm_yday day of year [0,365] </tt>
* @li <tt> tm_isdst daylight savings flag </tt>
* @note Glib version has 2 additional fields.
* For our function @p _format_month_year , only stuff that matters
* are <tt>tm_mon</tt> and <tt>tm_year</tt>. 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 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.
* 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 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 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 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.
* 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
* <tt> struct tm </tt> is declared on @c time.h. You can check @c
* ctime manpage to read about it.
* To register this callback, that will be called every time user
* selects a day or goes to next or previous month, just add a
* callback for signal @b changed.
* @skipline 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 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.
* 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 the 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 <b>edition
* mode</b>. See how you can change each of the sheets on it, and be
* sure to try holding the mouse pressed over one of the sheet
* arrows. The forth one also starts with a custom time set:
* @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 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 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 <b>"only Date display"</b>. 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 fields 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 function.
* @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 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.
* 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 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.
* 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 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.
* 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
<