2 * @page Examples-cxx Examples with C++ Bindings.
4 * Here is a list of Elementary C++ Examples.
6 * @ref bg_cxx_example_01
8 * @ref bg_cxx_example_02
10 * @ref bubble_cxx_example_01
12 * @ref button_cxx_example_00
14 * @ref button_cxx_example_01
16 * @ref calendar_cxx_example_01
18 * @ref calendar_cxx_example_02
20 * @ref calendar_cxx_example_03
22 * @ref calendar_cxx_example_04
24 * @ref calendar_cxx_example_05
26 * @ref clock_cxx_example
28 * @ref datetime_cxx_example
30 * @ref glview_cxx_example_01
32 * @ref hoversel_cxx_example_01
34 * @ref icon_cxx_example_01
36 * @ref location_cxx_example_01
38 * @ref menu_cxx_example_01
40 * @ref popup_cxx_example_01
42 * @ref radio_cxx_example_01
44 * @ref separator_cxx_example_01
46 * @ref slider_cxx_example
48 * @ref spinner_cxx_example
50 * @ref table_cxx_example_01
52 * @ref table_cxx_example_02
54 * @ref thumb_cxx_example_01
59 * @page lambda Lambda Functions with Elementary - C++11
61 * With this tutorial we'll give you a better view of how the lambda
62 * function can and will be constantly use in the C++ bindings. For a
63 * more broad aproach you should do a little web research.
65 * The syntax adopted for these examples:
67 * @c [capture] @c (parameters) @c {body}
69 * @a capture: Determinate how and if the capture occurs. Possible
70 * indicators, two or more should be intercalated by commas:
72 * @li [ ] - Capture nothing
74 * @li [&] - Capture variables by reference
76 * @li [=] - Capture variables by copy
78 * @li [&a, b] - Capture <b> only @a a </b> by reference and <b> only
81 * @li [&, a] - Capture variables by reference and <b> only @a a </b>
84 * @li [this] - Capture @c this pointer by copy
86 * @a parameters: List of parameters necessary for each specific
89 * @a body: Function body
91 * Let's start with a more simple lambda and later a more complex one,
92 * all extracted from elementary examples:
94 * <b>First Example</b> - @ref button_cxx_example_00 :
96 * @image html screenshots/button_cxx_example_00.png
97 * @image latex screenshots/button_cxx_example_00.eps width=\textwidth
99 * @dontinclude button_cxx_example_00.cc
104 * In this example we use a @a lambda function for elm::button
105 * btn that will be called when that button is clicked in
106 * callback_clicked_add( on_click ). This lambda will then ask to exit
107 * Elementary's main loop with @a elm_exit(). If this call is issued,
108 * it will flag the main loop to cease processing and return back to
109 * its parent function, usually your elm_main() function.
111 * Now let's analize the sintax used for this lambda:
113 * With @a [] we are signaling that we don't want to capture any
114 * variables and with @a () we are indicating that this lambda doesn't
115 * need parameters to work as it should. Now the important part of this
116 * function it's the @a body represented by @a {} where we are applying
117 * elm_exit() everytime this lambda is called.
119 * In this case we are using @a std::bind to bind the parameters of
120 * our lambda function to return as @a std::function object to
121 * on_click which was declare as auto.
123 * For this example with std::bind we simplified our work simply
124 * because we didn't have to search in the code or documentation of
125 * Elementary to look for the parameters and/or values that the
126 * callback_clicked_add requires of the function we are adding.
128 * <b>Second Example</b> - @ref hoversel_cxx_example_01 :
130 * @image html screenshots/hoversel_cxx_example_01.png
131 * @image latex screenshots/hoverse_cxx_example_01.eps width=\textwidth
133 * @dontinclude hoversel_cxx_example_01.cc
137 * In this example we use a @a lambda function for @a hoversel that
138 * will be called when that hoversel is clicked in
139 * callback_clicked_add( add_item ). This lambda will then add an item
140 * to heversel, note that since we allocate memory for the item we
141 * need to know when the item dies so we can free that memory.
143 * Now let's analize the sintax used for this lambda:
145 * @li @a [] : signaling that we don't want to capture any
148 * @li @a (::elm::hoversel obj ) : indicating that this lambda needs
149 * the parameter @p obj to work as it should. Bbecause we are only
150 * adding the parameter we need instead of all the parameters this
151 * callback requires we need to use placeholders in std::bind,
152 * indicating the place that @obj should occupy in our
153 * callback_clicked_add.
155 * When the function object returned by bind is called, an argument
156 * with placeholder _1 is replaced by the first argument in the call,
157 * _2 is replaced by the second argument in the call, and so on.
159 * @li @a body represented by @a {} where we are adding ervery
160 * function and local variables that will be needed.
162 * In this case we are using @a std::bind to bind the parameters of
163 * our lambda function to return as @a std::function object to
164 * add_item which was declare as auto.
166 * @see Consult all examples from elementary with C++ Bindings @ref
167 * Examples-cxx "here"
171 * @page bg_cxx_example_01 elm::bg - Plain color background with C++ binding
172 * @dontinclude bg_cxx_example_01.cc
174 * This example just sets a default background with a plain color.
176 * The first part consists of including the headers. In this case we
177 * are only working with the Elementary C++ binding and thus we need
178 * only to include him.
180 * @skipline Elementary.hh
182 * @attention If necessary the C and/or the C++ headers should be
183 * include here as well.
185 * Now we need to actually start the code and set the elm_policy,
186 * which defines for a given policy group/identifier a new policy's
187 * value, respectively. In this example the only policy we need to
188 * set a value for is @c ELM_POLICY_QUIT, possibles values for it are:
190 * @li @p ELM_POLICY_QUIT_NONE: Never quit the application
193 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the
194 * application's last window is closed;
196 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the
197 * application's last window is hidden;
200 * @until elm_policy_set
202 * As you can see, the policy we chose was to quit when the last win
203 * is hidden as opose to examples with the C bindings where we
204 * perpetually set it to quit when last win was closed. This changed
205 * was necessary because in C++ binding as the elm mainloop stop
206 * running all object are destroyed, references are unreferenced and
207 * events are stopped at ELM_MAIN().
209 * @see For more details consult elm_policy_set
211 * Next step is creating an Elementary window, where win calls a
212 * constructor and sets the type of the win to ELM_WIN_BASIC
213 * (Elm_Win_Type), which is the indicated type for most of our
214 * examples. Here we also set the title that will appear at the top of
215 * our window and then the autohide state for it.
217 * The autohide works similarly to @p autodel, automatically handling
218 * "delete,request" signals when set to @p true, with the difference
219 * that it will hide the window, instead of destroying it.
221 * It is specially designed to work together with @p
222 * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting
223 * Elementary's main loop when all the windows are hidden.
226 * @until autohide_set
228 * @note @p autodel and @a autohide are not mutually exclusive. The
229 * window will be destructed if both autodel and autohide is set to @p
230 * EINA_TRUE or @p true.
232 * Now we construct the elm background and for this we use the C++
233 * method below, setting it's parent.
235 * @skipline ::elm::bg
237 * To better understand, the function @c size_hint_weight_set for C++
238 * bindings originated from C bindings function
239 * evas_object_size_hint_weight_set, that is EFL Evas type function.
240 * With this function we set the hints for an object's weight. The
243 * @li x - Nonnegative double value to use as horizontal weight hint.
245 * @li y - Nonnegative double value to use as vertical weight hint.
247 * This is not a size enforcement in any way, it's just a hint that
248 * should be used whenever appropriate. This is a hint on how a
249 * container object should resize a given child within its area.
251 * Containers may adhere to the simpler logic of just expanding the
252 * child object's dimensions to fit its own (see the EVAS_HINT_EXPAND
253 * helper weight macro in the EFL Evas Documentation) or the complete
254 * one of taking each child's weight hint as real weights to how much
255 * of its size to allocate for them in each axis. A container is
256 * supposed to, after normalizing the weights of its children (with
257 * weight hints), distribute the space it has to layout them by those
258 * factors – most weighted children get larger in this process than
261 * @skipline weight_set
263 * @note Default weight hint values are 0.0, for both axis.
265 * Now we add the background as a resize_object to win informing that
266 * when the size of the win changes so should the background's
267 * size. And finally we make it visible.
270 * @until visibility_set
272 * @remarks If a color it's not setted the default color will be used.
274 * Now we set the size for the window, making it visible in the end.
277 * @until visibility_set
279 * Finally we just have to start the elm mainloop, starting to handle
280 * events and drawing operations.
285 * The full code for this example can be found at @ref
286 * bg_cxx_example_01.cc .
288 * @example bg_cxx_example_01.cc
292 * @page bg_cxx_example_02 elm::bg - Image background using C++ binding
293 * @dontinclude bg_cxx_example_02.cc
295 * This is the second background example and shows how to use the
296 * Elementary background object to set an image as background of your
299 * The first part consists of including the headers. In this case we
300 * are only working with the Elementary C++ binding and thus we need
301 * only to include him.
303 * @skipline Elementary.hh
305 * @attention If necessary the C and/or the C++ headers should be
306 * include here as well.
308 * Now we need to actually start the code and set the elm_policy,
309 * which defines for a given policy group/identifier a new policy's
310 * value, respectively. In this example the only policy we need to
311 * set a value for is @c ELM_POLICY_QUIT, possibles values for it are:
313 * @li @p ELM_POLICY_QUIT_NONE: Never quit the application
316 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the
317 * application's last window is closed;
319 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the
320 * application's last window is hidden;
323 * @until elm_policy_set
325 * As you can see, the policy we chose was to quit when the last win
326 * is hidden as opose to examples with the C bindings where we
327 * perpetually set it to quit when last win was closed. This changed
328 * was necessary because in C++ binding as the elm mainloop stop
329 * running all object are destroyed, references are unreferenced and
330 * events are stopped at ELM_MAIN().
332 * @see For more details consult elm_policy_set
334 * Next step is creating an Elementary window, where win calls a
335 * constructor and sets the type of the win to ELM_WIN_BASIC
336 * (Elm_Win_Type), which is the indicated type for most of our
337 * examples. Here we also set the title that will appear at the top of
338 * our window and then the autohide state for it.
340 * The autohide works similarly to @p autodel, automatically handling
341 * "delete,request" signals when set to @p true, with the difference
342 * that it will hide the window, instead of destroying it.
344 * It is specially designed to work together with @p
345 * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting
346 * Elementary's main loop when all the windows are hidden.
349 * @until autohide_set
351 * @note @p autodel and @a autohide are not mutually exclusive. The
352 * window will be destructed if both autodel and autohide is set to @p
353 * EINA_TRUE or @p true.
355 * Our background will have an image, that will be displayed over the
358 * To do so, first we set the directory and archive for the image. And
359 * create the background that will display it.
361 * @skip elm_app_info_set
364 * Before loading this image, we set the load size of the image. The
365 * load size is a hint about the size that we want the image displayed
366 * in the screen. It's not the exact size that the image will have,
367 * but usually a bit bigger. The background object can still be scaled
368 * to a size bigger than the one set here. Setting the image load size
369 * to something smaller than its real size will reduce the memory used
370 * to keep the pixmap representation of the image, and the time to
371 * load it. Here we set the load size to 20x20 pixels, but the image
372 * is loaded with a size bigger than that (since it's just a hint):
374 * @skipline load_size_set
376 * And set our background image to be centered, instead of stretched
377 * or scaled, so the effect of the load_size_set() can be easily
380 * @skipline option_set
382 * We need a filename to set, so we get one from the previous
383 * installed images in the @c PACKAGE_DATA_DIR, and write its full
384 * path to a std::stringstream. Then we use this stringstream to set
385 * the file name in the background object:
387 * @skip std::stringstream
390 * Notice that the second argument of the file_set() function is @c
391 * nullptr, since we are setting an image to this background. This
392 * function also supports setting an Eet file as background, in which
393 * case the @c key parameter wouldn't be @c nullptr, but be the name
394 * of the Eet key instead.
396 * To better understand, the function @c size_hint_weight_set for C++
397 * bindings originated from C bindings function
398 * evas_object_size_hint_weight_set, that is EFL Evas type function.
399 * With this function we set the hints for an object's weight. The
402 * @li x - Nonnegative double value to use as horizontal weight hint.
404 * @li y - Nonnegative double value to use as vertical weight hint.
406 * This is not a size enforcement in any way, it's just a hint that
407 * should be used whenever appropriate.
409 * This is a hint on how a container object should resize a given
410 * child within its area.
412 * Containers may adhere to the simpler logic of just expanding the
413 * child object's dimensions to fit its own (see the EVAS_HINT_EXPAND
414 * helper weight macro in the EFL Evas Documentation) or the complete
415 * one of taking each child's weight hint as real weights to how much
416 * of its size to allocate for them in each axis. A container is
417 * supposed to, after normalizing the weights of its children (with
418 * weight hints), distribute the space it has to layout them by those
419 * factors – most weighted children get larger in this process than
422 * @skipline weight_set
424 * @note Default weight hint values are 0.0, for both axis.
426 * Now we add the background as a resize_object to win informing that
427 * when the size of the win changes so should the background's
428 * size. And finally we make background.
433 * Now we only have to set the size for our window and make it
437 * @until visibility_set
439 * Finally we just have to start the elm mainloop, starting to handle
440 * events and drawing operations.
445 * The full code for this example can be found at @ref
446 * bg_cxx_example_02.cc .
448 * This example will look like this:
450 * @image html screenshots/bg_cxx_example_02.png
451 * @image latex screenshots/bg_cxx_example_02.eps width=\textwidth
452 * @example bg_cxx_example_02.cc
456 * @page bubble_cxx_example_01 elm::bubble - Simple use with C++ binding
457 * @dontinclude bubble_cxx_example_01.cc
459 * This example shows a bubble with all fields set - label, info,
460 * content and icon - and the selected corner changing when the bubble
463 * The first part consists of including the headers. In this case we
464 * are working with the Elementary and Evas C++ bindings and thus we
465 * need only to include them.
470 * @attention If necessary the C and/or the C++ headers should be
471 * include here as well.
473 * Now we need to actually start the code and set the elm_policy,
474 * which defines for a given policy group/identifier a new policy's
475 * value, respectively. In this example the only policy we need to
476 * set a value for is @c ELM_POLICY_QUIT, possibles values for it are:
478 * @li @p ELM_POLICY_QUIT_NONE: Never quit the application
481 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the
482 * application's last window is closed;
484 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the
485 * application's last window is hidden;
488 * @until elm_policy_set
490 * As you can see, the policy we chose was to quit when the last win
491 * is hidden as opose to examples with the C bindings where we
492 * perpetually set it to quit when last win was closed. This changed
493 * was necessary because in C++ binding as the elm mainloop stop
494 * running all object are destroyed, references are unreferenced and
495 * events are stopped at ELM_MAIN().
497 * @see For more details consult elm_policy_set
499 * Next step is creating an Elementary window, where win calls a
500 * constructor and sets the type of the win to ELM_WIN_BASIC
501 * (Elm_Win_Type), which is the indicated type for most of our
502 * examples. Here we also set the title that will appear at the top of
503 * our window and then the autohide state for it.
505 * The autohide works similarly to @p autodel, automatically handling
506 * "delete,request" signals when set to @p true, with the difference
507 * that it will hide the window, instead of destroying it.
509 * It is specially designed to work together with @p
510 * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting
511 * Elementary's main loop when all the windows are hidden.
514 * @until autohide_set
516 * @note @p autodel and @a autohide are not mutually exclusive. The
517 * window will be destructed if both autodel and autohide is set to @p
518 * EINA_TRUE or @p true.
520 * Now we construct the elm background using the C++ method below,
521 * setting it's parent.
525 * To better understand, the function @c size_hint_weight_set for C++
526 * bindings originated from C bindings function
527 * evas_object_size_hint_weight_set, that is EFL Evas type function.
528 * With this function we set the hints for an object's weight.
530 * The parameters are:
532 * @li x - Nonnegative double value to use as horizontal weight hint.
534 * @li y - Nonnegative double value to use as vertical weight hint.
536 * This is not a size enforcement in any way, it's just a hint that
537 * should be used whenever appropriate.
539 * This is a hint on how a container object should resize a given
540 * child within its area.
542 * Containers may adhere to the simpler logic of just expanding the
543 * child object's dimensions to fit its own (see the EVAS_HINT_EXPAND
544 * helper weight macro in the EFL Evas Documentation) or the complete
545 * one of taking each child's weight hint as real weights to how much
546 * of its size to allocate for them in each axis. A container is
547 * supposed to, after normalizing the weights of its children (with
548 * weight hints), distribute the space it has to layout them by those
549 * factors – most weighted children get larger in this process than
552 * @skipline weight_set
554 * @note Default weight hint values are 0.0, for both axis.
556 * Now we add the background as a resize_object to win informing that
557 * when the size of the win changes so should the background's
558 * size. And finally we make it visible.
561 * @until visibility_set
563 * @note If a color it's not setted the standard color will be used.
565 * Here we are creating an elm::label that is going to be used as the
566 * content for our bubble:
569 * @until visibility_set
571 * Despite it's name the bubble's icon in this case it's actually
572 * evas::rectangle, that we set it's color to blue and at the end make
575 * @skip evas::rectangle
576 * @until visibility_set
578 * And finally we have the actual bubble creation and the setting of
579 * it's label, info and content:
582 * @until visibility_set
584 * @remark Because we didn't set a corner, the default "top_left" will be used.
586 * To have the selected corner change in a clockwise motion we are going to
587 * use the following callback using lambda:
592 * @see To learn more about consult @ref lambda.
594 * Now that we have our bubble and callback all that is left is adding our
595 * lambda as a clicked callback:
597 * @line callback_clicked_add
599 * This last bubble we created was very complete, so it's pertinent to show
600 * that most of that stuff is optional a bubble can be created with nothing
604 * @until bubble2.visibility_set
606 * Now we only have to set the size for our window and make it
610 * @until visibility_set
612 * And finally, start the elm mainloop, starting to handle events and
613 * drawing operations.
618 * Our example will look like this:
620 * @image html screenshots/bubble_cxx_example_01.png
621 * @image latex screenshots/bubble_cxx_example_01.eps width=\textwidth
623 * @see Full source code @ref bubble_cxx_example_01.cc .
625 * @example bubble_cxx_example_01.cc
629 * @page button_cxx_example_00 Button - Hello, Button!
630 * @dontinclude button_cxx_example_00.cc
632 * Keeping the tradition, this is a simple "Hello, World" button
633 * example. We will show how to create a button and associate an
634 * action to be performed when you click on it.
636 * The first part consists of including the headers. In this case we
637 * are only working with the Elementary C++ binding and thus we need
638 * only to include him.
640 * @skipline Elementary.hh
642 * @attention If necessary the C and/or the C++ headers should be
643 * include here as well.
645 * Now we need to actually start the code and set the elm_policy,
646 * which defines for a given policy group/identifier a new policy's
647 * value, respectively. In this example the only policy we need to
648 * set a value for is @c ELM_POLICY_QUIT, possibles values for it are:
650 * @li @p ELM_POLICY_QUIT_NONE: Never quit the application
653 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the
654 * application's last window is closed;
656 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the
657 * application's last window is hidden;
660 * @until elm_policy_set
662 * As you can see, the policy we chose was to quit when the last win
663 * is hidden as opose to examples with the C bindings where we
664 * perpetually set it to quit when last win was closed. This changed
665 * was necessary because in C++ binding as the elm mainloop stop
666 * running all object are destroyed, references are unreferenced and
667 * events are stopped at ELM_MAIN().
669 * @see For more details consult elm_policy_set
671 * Next step is creating an Elementary window, where win calls a
672 * constructor and sets the type of the win to ELM_WIN_BASIC
673 * (Elm_Win_Type), which is the indicated type for most of our
674 * examples. Here we also set the title that will appear at the top of
675 * our window and then the autohide state for it.
677 * The autohide works similarly to @p autodel, automatically handling
678 * "delete,request" signals when set to @p true, with the difference
679 * that it will hide the window, instead of destroying it.
681 * It is specially designed to work together with @p
682 * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting
683 * Elementary's main loop when all the windows are hidden.
686 * @until autohide_set
688 * @note @p autodel and @a autohide are not mutually exclusive. The
689 * window will be destructed if both autodel and autohide is set to @p
690 * EINA_TRUE or @p true.
692 * Now we construct the elm background and for this we use the C++
693 * method below, setting it's parent.
695 * @skipline ::elm::bg
697 * The function @c size_hint_weight_set for C++ bindings originated
698 * from C bindings function evas_object_size_hint_weight_set, that is
699 * EFL Evas type function. With this function we set the hints for an
700 * object's weight. The parameters are:
702 * @li x - Nonnegative double value to use as horizontal weight hint.
704 * @li y - Nonnegative double value to use as vertical weight hint.
706 * This is not a size enforcement in any way, it's just a hint that
707 * should be used whenever appropriate. This is a hint on how a
708 * container object should resize a given child within its area.
710 * Containers may adhere to the simpler logic of just expanding the
711 * child object's dimensions to fit its own (see the EVAS_HINT_EXPAND
712 * helper weight macro in the EFL Evas Documentation) or the complete
713 * one of taking each child's weight hint as real weights to how much
714 * of its size to allocate for them in each axis. A container is
715 * supposed to, after normalizing the weights of its children (with
716 * weight hints), distribute the space it has to layout them by those
717 * factors – most weighted children get larger in this process than
720 * @skipline weight_set
722 * @note Default weight hint values are 0.0, for both axis.
724 * Now we add the background as a resize_object to win informing that
725 * when the size of the win changes so should the background's
726 * size. And finally we make it visible.
729 * @until visibility_set
731 * @remarks If a color it's not setted the default color will be used.
733 * There is only one button on this interface. We need to create this
734 * button with the C++ method, set the text to be displayed, the size,
735 * position and the size hint for weight.
740 * For alignment we'll use the function @c size_hint_align_set for C++
741 * bindings originated from C bindings function
742 * evas_object_size_hint_align_set, that is EFL Evas type
743 * function. With this function we set the hints for an object's
744 * alignment. The parameters are:
746 * @li x - Double, ranging from 0.0 to 1.0 or with the special value
747 * EVAS_HINT_FILL, to use as horizontal alignment hint.
749 * @li y - Double, ranging from 0.0 to 1.0 or with the special value
750 * EVAS_HINT_FILL, to use as vertical alignment hint.
752 * These are hints on how to align an object inside the boundaries of
753 * a container/manager. Accepted values are in the 0.0 to 1.0 range,
754 * with the special value EVAS_HINT_FILL used to specify "justify" or
755 * "fill" by some users. In this case, maximum size hints should be
756 * enforced with higher priority, if they are set. Also, any padding
757 * hint set on objects should add up to the alignment space on the
758 * final scene composition.
760 * For the horizontal component, 0.0 means to the left, 1.0 means to
761 * the right. Analogously, for the vertical component, 0.0 to the top,
762 * 1.0 means to the bottom.
764 * This is not a size enforcement in any way, it's just a hint that
765 * should be used whenever appropriate.
769 * @note Default alignment hint values are 0.5, for both axis.
771 * Continuing with our button we make it visible.
773 * @skipline visibility
775 * This button performs a basic action: close the application. This
776 * behavior is described by on_click() which is a lambda function,
777 * that interrupt the program invoking elm_exit(). The lambda function
778 * on_click is the added as a clicked callback to btn.
783 * @see For more details consult @ref lambda
785 * Now we set the size for the window, making it visible in the end:
788 * @until visibility_set
790 * Finally we just have to start the elm mainloop, starting to handle
791 * events and drawing operations.
796 * The full code for this example can be found at @ref
797 * button_cxx_example_00.cc .
799 * This example will look like this:
800 * @image html screenshots/button_cxx_example_00.png
801 * @image latex screenshots/button_cxx_example_00.eps width=\textwidth
802 * @example button_cxx_example_00.cc
806 * @page button_cxx_example_01 Button - Complete example
807 * @dontinclude button_cxx_example_01.cc
809 * A button is simple, you click on it and something happens. That said,
810 * we'll go through an example to show in detail the button API less
813 * The first part consists of including the headers. In this case we
814 * are only working with the Elementary C++ binding and thus we need
815 * only to include him.
817 * @skipline Elementary.hh
819 * @attention If necessary the C and/or the C++ headers should be
820 * include here as well.
822 * Now we need to actually start the code and set the elm_policy,
823 * which defines for a given policy group/identifier a new policy's
824 * value, respectively. In this example the only policy we need to
825 * set a value for is @c ELM_POLICY_QUIT, possibles values for it are:
827 * @li @p ELM_POLICY_QUIT_NONE: Never quit the application
830 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the
831 * application's last window is closed;
833 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the
834 * application's last window is hidden;
837 * @until elm_policy_set
839 * As you can see, the policy we chose was to quit when the last win
840 * is hidden as opose to examples with the C bindings where we
841 * perpetually set it to quit when last win was closed. This changed
842 * was necessary because in C++ binding as the elm mainloop stop
843 * running all object are destroyed, references are unreferenced and
844 * events are stopped at ELM_MAIN().
846 * @see For more details consult elm_policy_set
848 * Next step is creating an Elementary window, in this example we use
849 * the C++ binding method with the elm_win_util_standard_add that is a
850 * elm_win_legacy function, better explained below. And then we set
851 * the autohide state for it.
853 * @p elm_win_util_standard_add (const char *name, const char *tittle)
854 * Adds a window object with standard setup.
857 * @li @p name - The name of the window;
859 * @li @p title - The title for the window.
861 * This creates a window but also puts in a standard background with
862 * @p elm_bg_add(), as well as setting the window title to @p
863 * title. The window type created is of type @c ELM_WIN_BASIC, with
864 * the @c NULL as the parent widget. Returns the created object or @c
867 * The autohide works similarly to @p autodel, automatically handling
868 * "delete,request" signals when set to @p true, with the difference
869 * that it will hide the window, instead of destroying it.
871 * It is specially designed to work together with @p
872 * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting
873 * Elementary's main loop when all the windows are hidden.
876 * @until autohide_set
878 * @note @p autodel and @a autohide are not mutually exclusive. The
879 * window will be destructed if both autodel and autohide is set to @p
880 * EINA_TRUE or @p true.
882 * In this example we'll have several buttons that will be arranged in
883 * two boxes that will be inserted in a bigger box. One of the smaller
884 * boxes will contain a set of buttons that will set different times
885 * for the autorepeat timeouts of the buttons that will be contained in
886 * the other smaller box.
888 * For all this to work, we will construct the three smaller boxes and
889 * all the button that will be needed. The smaller boxes will be then
890 * packed in the bigger one.
892 * In this part we'll create our directional buttons, that we'll be
893 * added in the third smaller box, this is necessary for our callback
899 * Now let's create our bigger box using the C++ method and setting
900 * it's parent as win.
904 * The function @c size_hint_weight_set for C++ bindings originated
905 * from C bindings function evas_object_size_hint_weight_set, that is
906 * EFL Evas type function. With this function we set the hints for an
907 * object's weight. The parameters are:
909 * @li x - Nonnegative double value to use as horizontal weight hint.
911 * @li y - Nonnegative double value to use as vertical weight hint.
913 * This is not a size enforcement in any way, it's just a hint that
914 * should be used whenever appropriate. This is a hint on how a
915 * container object should resize a given child within its area.
917 * Containers may adhere to the simpler logic of just expanding the
918 * child object's dimensions to fit its own (see the EVAS_HINT_EXPAND
919 * helper weight macro in the EFL Evas Documentation) or the complete
920 * one of taking each child's weight hint as real weights to how much
921 * of its size to allocate for them in each axis. A container is
922 * supposed to, after normalizing the weights of its children (with
923 * weight hints), distribute the space it has to layout them by those
924 * factors – most weighted children get larger in this process than
927 * @skipline weight_set
929 * @note Default weight hint values are 0.0, for both axis.
931 * Now we add the box as a resize_object to win informing that when
932 * the size of the win changes so should the box's size. And finally
933 * we make it visible.
936 * @until visibility_set
938 * Creating our initial box, again using the C++ method, in this case
939 * we want the arrangement of the objects, that this box will contain,
940 * to be displayed horizontally and fot this we will set horizontal to
941 * @p true, vertical by default.
946 * Again we'll set the size hint for weight, but in this box we will
947 * set the packing method to include this box inside the bigger one.
949 * When using the elm box the packing method of the subobj - box in
950 * this case - should be defined. There are four possible methods:
952 * @li @c pack_start(subobj_) - Add an object to the beginning of the
953 * pack list. Pack @c subobj_ into the box obj, placing it first in
954 * the list of children objects. The actual position the object will
955 * get on screen depends on the layout used. If no custom layout is
956 * set, it will be at the top or left, depending if the box is
957 * vertical or horizontal, respectively.
959 * @li @c pack_end(subobj_) - Add an object at the end of the pack
960 * list. Pack @c subobj_ into the box obj, placing it last in the list
961 * of children objects. The actual position the object will get on
962 * screen depends on the layout used. If no custom layout is set, it
963 * will be at the bottom or right, depending if the box is vertical or
964 * horizontal, respectively.
966 * @li @c pack_before(subobj_, before_) - Adds an object to the box
967 * before the indicated object. This will add the @c subobj_ to the
968 * box indicated before the object indicated with @c before_. If
969 * before is not already in the box, results are undefined. Before
970 * means either to the left of the indicated object or above it
971 * depending on orientation.
973 * @li @c pack_after(subobj_, after_) - Adds an object to the box
974 * after the indicated object. This will add the @c subobj_ to the box
975 * indicated after the object indicated with @c after_. If after is
976 * not already in the box, results are undefined. After means either
977 * to the right of the indicated object or below it depending on
980 * In this and most examples we use pack_end by choice and
981 * practicality. In this part of the code we also make calendar
987 * Now let's start creating the buttons that will be included in this
988 * first small box, this will contain the initial timeout button.
990 * We'll use again the C++ method to create this button, set a text,
991 * packing method for btn and finally make it visible.
996 * In this part we'll use Lambda type function that will be added in
997 * the clicked callback for all buttons in the first smaller box,
998 * that'll identify the current initial and gap to be use in the
999 * autorepeat timeout that will move the central button.
1004 * @note To learn more about Lambda Function and its use in Elementary
1005 * consult @ref lambda.
1007 * The second and third button will also set the initial timeout but
1008 * with different values.
1011 * @until btn3.callback
1013 * Now for our gap timeout buttons will create our second smaller box,
1014 * the same way with the initial box, we'll use the C++ method, set to
1015 * be horizontal, set the size hint weight, choose the packing method
1016 * and set the visibility to true.
1021 * For our gap buttons we'll again, use the C++ method, set the texts
1022 * with the different values for gap, choose the packing method, set
1023 * the visibility and the clicked callback.
1026 * @until btn6.callback
1028 * Now we'll give our directional buttons more options so that it will
1029 * visible and also have all the caracteristics that is require.
1031 * For the up button, we'll set to @p true the autorepeat,
1032 * autorepeat_initial_timeout, autoreapet_gap_timeout, the size hints
1033 * for weight and alignement, choose our packing method and making out
1034 * up button visible.
1039 * For this directional buttons we'll have a diferent repeated
1040 * callback that will insure the timeouts of our middle button in the
1041 * gap and initial timeout that is current setted.
1046 * For our second callback, we'll detail the release of our
1047 * directional buttons.
1052 * Finishing our up button, we'll create an icon, that'll will be the
1053 * standard "arrow_up".
1058 * This last box, will content all the directional buttons and the
1059 * middle button. As before, we use the C++ method, horizontal set,
1060 * weight and align hints, chose the packing method and make it
1066 * Now we'll create all the directional and middle buttons, the same as we did with the up button,
1067 * changing only the icon.
1070 * @until down.content
1072 * Now we set the size for the window, making it visible in the end:
1075 * @until visibility_set
1077 * Finally we just have to start the elm mainloop, starting to handle
1078 * events and drawing operations.
1083 * The full code for this example can be found at @ref
1084 * button_cxx_example_01.cc .
1086 * This example will look like this:
1087 * @image html screenshots/button_cxx_example_01.png
1088 * @image latex screenshots/button_cxx_example_01.eps width=\textwidth
1089 * @example button_cxx_example_01.cc
1093 * @page calendar_cxx_example_01 Calendar - Simple creation with C++ binding
1094 * @dontinclude calendar_cxx_example_01.cc
1096 * As a first example, let's just display a calendar in our window,
1097 * explaining all steps required to do so.
1099 * The first part consists of including the headers. In this case we
1100 * are only working with the Elementary C++ binding and thus we need
1101 * only to include him.
1103 * @skipline Elementary.hh
1105 * @attention If necessary the C and/or the C++ headers should be
1106 * include here as well.
1108 * Now we need to actually start the code and set the elm_policy,
1109 * which defines for a given policy group/identifier a new policy's
1110 * value, respectively. In this example the only policy we need to
1111 * set a value for is @c ELM_POLICY_QUIT, possibles values for it are:
1113 * @li @p ELM_POLICY_QUIT_NONE: Never quit the application
1116 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the
1117 * application's last window is closed;
1119 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the
1120 * application's last window is hidden;
1123 * @until elm_policy_set
1125 * As you can see, the policy we chose was to quit when the last win
1126 * is hidden as opose to examples with the C bindings where we
1127 * perpetually set it to quit when last win was closed. This changed
1128 * was necessary because in C++ binding as the elm mainloop stop
1129 * running all object are destroyed, references are unreferenced and
1130 * events are stopped at ELM_MAIN().
1132 * @see For more details consult elm_policy_set
1134 * Next step is creating an Elementary window, in this example we use
1135 * the C++ binding method with the elm_win_util_standard_add that is a
1136 * elm_win_legacy function, better explained below. And then we set
1137 * the autohide state for it.
1139 * @p elm_win_util_standard_add (const char *name, const char *tittle)
1140 * Adds a window object with standard setup.
1143 * @li @p name - The name of the window;
1145 * @li @p title - The title for the window.
1147 * This creates a window but also puts in a standard background with
1148 * @p elm_bg_add(), as well as setting the window title to @p
1149 * title. The window type created is of type @c ELM_WIN_BASIC, with
1150 * the @c NULL as the parent widget. Returns the created object or @c
1153 * The autohide works similarly to @p autodel, automatically handling
1154 * "delete,request" signals when set to @p true, with the difference
1155 * that it will hide the window, instead of destroying it.
1157 * It is specially designed to work together with @p
1158 * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting
1159 * Elementary's main loop when all the windows are hidden.
1162 * @until autohide_set
1164 * @note @p autodel and @a autohide are not mutually exclusive. The
1165 * window will be destructed if both autodel and autohide is set to @p
1166 * EINA_TRUE or @p true.
1168 * Now, the exciting part, let's create the calendar with the C++
1169 * binding method, passing our window object as parent.
1171 * @skipline elm::calendar
1173 * The function @c size_hint_weight_set for C++ bindings originated
1174 * from C bindings function evas_object_size_hint_weight_set, that is
1175 * EFL Evas type function. With this function we set the hints for an
1176 * object's weight. The parameters are:
1178 * @li x - Nonnegative double value to use as horizontal weight hint.
1180 * @li y - Nonnegative double value to use as vertical weight hint.
1182 * This is not a size enforcement in any way, it's just a hint that
1183 * should be used whenever appropriate. This is a hint on how a
1184 * container object should resize a given child within its area.
1186 * Containers may adhere to the simpler logic of just expanding the
1187 * child object's dimensions to fit its own (see the EVAS_HINT_EXPAND
1188 * helper weight macro in the EFL Evas Documentation) or the complete
1189 * one of taking each child's weight hint as real weights to how much
1190 * of its size to allocate for them in each axis. A container is
1191 * supposed to, after normalizing the weights of its children (with
1192 * weight hints), distribute the space it has to layout them by those
1193 * factors – most weighted children get larger in this process than
1196 * @skipline weight_set
1198 * @note Default weight hint values are 0.0, for both axis.
1200 * Now we add the calendar as a resize-object to win informing that
1201 * when the size of the win changes so should the calendar's
1202 * size. And finally we make it visible.
1207 * Finally we just have to start the elm mainloop, starting to handle
1208 * events and drawing operations.
1213 * Our example will look like this:
1215 * @image html screenshots/calendar_cxx_example_01.png
1217 * @image latex screenshots/calendar_cxx_example_01.eps width=\textwidth
1219 * See the full source code @ref calendar_cxx_example_01.cc here.
1221 * @example calendar_cxx_example_01.cc
1225 * @page calendar_cxx_example_02 Calendar - Layout strings formatting with C++ binding
1226 * @dontinclude calendar_cxx_example_02.cc
1228 * In this simple example, we'll explain how to format the labels
1229 * displaying month and year, and also set weekday names.
1231 * The first part consists of including the headers. In this case we
1232 * are only working with the Elementary C++ binding and thus we need
1233 * only to include him.
1235 * @skipline Elementary.hh
1237 * @attention If necessary the C and/or the C++ headers should be
1238 * include here as well.
1240 * Now we will jump to the actual code and later explain the function
1241 * to make this tutorial more didactical.
1243 * We must set the elm_policy, which defines for a given policy
1244 * group/identifier a new policy's value, respectively. In this
1245 * example the only policy we need to set a value for is @c
1246 * ELM_POLICY_QUIT, possibles values for it are:
1248 * @li @p ELM_POLICY_QUIT_NONE: Never quit the application
1251 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the
1252 * application's last window is closed;
1254 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the
1255 * application's last window is hidden;
1258 * @until elm_policy_set
1260 * As you can see, the policy we chose was to quit when the last win
1261 * is hidden as opose to examples with the C bindings where we
1262 * perpetually set it to quit when last win was closed. This changed
1263 * was necessary because in C++ binding as the elm mainloop stop
1264 * running all object are destroyed, references are unreferenced and
1265 * events are stopped at ELM_MAIN().
1267 * @see For more details consult elm_policy_set
1269 * Next step is creating an Elementary window, in this example we use
1270 * the C++ binding method with the elm_win_util_standard_add that is a
1271 * elm_win_legacy function, better explained below. And then we set
1272 * the autohide state for it.
1274 * @p elm_win_util_standard_add (const char *name, const char *tittle)
1275 * Adds a window object with standard setup.
1278 * @li @p name - The name of the window;
1280 * @li @p title - The title for the window.
1282 * This creates a window but also puts in a standard background with
1283 * @p elm_bg_add(), as well as setting the window title to @p
1284 * title. The window type created is of type @c ELM_WIN_BASIC, with
1285 * the @c NULL as the parent widget. Returns the created object or @c
1288 * The autohide works similarly to @p autodel, automatically handling
1289 * "delete,request" signals when set to @p true, with the difference
1290 * that it will hide the window, instead of destroying it.
1292 * It is specially designed to work together with @p
1293 * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting
1294 * Elementary's main loop when all the windows are hidden.
1297 * @until autohide_set
1299 * @note @p autodel and @a autohide are not mutually exclusive. The
1300 * window will be destructed if both autodel and autohide is set to @p
1301 * EINA_TRUE or @p true.
1303 * Now let's create the calendar with the C++ binding method, passing
1304 * our window object as parent.
1306 * @skipline elm::calendar
1308 * The function @c size_hint_weight_set for C++ bindings originated
1309 * from C bindings function evas_object_size_hint_weight_set, that is
1310 * EFL Evas type function. With this function we set the hints for an
1311 * object's weight. The parameters are:
1313 * @li x - Nonnegative double value to use as horizontal weight hint.
1315 * @li y - Nonnegative double value to use as vertical weight hint.
1317 * This is not a size enforcement in any way, it's just a hint that
1318 * should be used whenever appropriate. This is a hint on how a
1319 * container object should resize a given child within its area.
1321 * Containers may adhere to the simpler logic of just expanding the
1322 * child object's dimensions to fit its own (see the EVAS_HINT_EXPAND
1323 * helper weight macro in the EFL Evas Documentation) or the complete
1324 * one of taking each child's weight hint as real weights to how much
1325 * of its size to allocate for them in each axis. A container is
1326 * supposed to, after normalizing the weights of its children (with
1327 * weight hints), distribute the space it has to layout them by those
1328 * factors – most weighted children get larger in this process than
1331 * @skipline weight_set
1333 * @note Default weight hint values are 0.0, for both axis.
1335 * Now we add the calendar as a resize-object to win informing that
1336 * when the size of the win changes so should the calendar's
1341 * To format month and year labels, we need to create a callback
1342 * function to create a string given the selected time, declared under
1343 * a <tt> struct tm </tt>.
1345 * <tt> struct tm </tt>, declared on @c time.h, is a structure
1346 * composed by nine integers:
1348 * @li <tt> tm_sec seconds [0,59] </tt>
1349 * @li <tt> tm_min minutes [0,59] </tt>
1350 * @li <tt> tm_hour hour [0,23] </tt>
1351 * @li <tt> tm_mday day of month [1,31] </tt>
1352 * @li <tt> tm_mon month of year [0,11] </tt>
1353 * @li <tt> tm_year years since 1900 </tt>
1354 * @li <tt> tm_wday day of week [0,6] (Sunday = 0) </tt>
1355 * @li <tt> tm_yday day of year [0,365] </tt>
1356 * @li <tt> tm_isdst daylight savings flag </tt>
1358 * @note Glib version has 2 additional fields.
1360 * For our function @p _format_month_year , only stuff that matters
1361 * are <tt>tm_mon</tt> and <tt>tm_year</tt>. But we don't need to
1362 * access it directly, since there are nice functions to format date
1363 * and time, as @c strftime.
1365 * We will get abbreviated month (%b) and year (%y) (check strftime
1366 * manpage for more) in our example:
1368 * @dontinclude calendar_cxx_example_02.cc
1372 * We need to alloc the string to be returned, and calendar widget
1373 * will free it when it's not needed, what is done by @c strdup.
1375 * So let's register our callback to calendar object:
1377 * @skipline format_function_set
1379 * To set weekday names, we should declare them as an array of
1382 * @dontinclude calendar_cxx_example_02.cc
1386 * And then set them to calendar:
1387 * @skipline weekdays_names_set
1389 * Finally we just have to make the calendar and window visible and
1390 * then start the elm mainloop, starting to handle events and drawing
1396 * Our example will look like this:
1398 * @image html screenshots/calendar_cxx_example_02.png
1399 * @image latex screenshots/calendar_cxx_example_02.eps width=\textwidth
1401 * See the full source code @ref calendar_cxx_example_02.cc here.
1402 * @example calendar_cxx_example_02.cc
1406 * @page calendar_cxx_example_03 Calendar - Years restrictions with C++ binding
1407 * @dontinclude calendar_cxx_example_03.cc
1409 * This example explains how to set max and min year to be displayed
1410 * by a calendar object. This means that user won't be able to see or
1411 * select a date before and after selected years. By default, limits
1412 * are 1902 and maximum value will depends on platform architecture
1413 * (year 2037 for 32 bits); You can read more about time functions on
1416 * The first part consists of including the headers. In this case we
1417 * are only working with the Elementary C++ binding and thus we need
1418 * only to include him.
1420 * @skipline Elementary.hh
1422 * @attention If necessary the C and/or the C++ headers should be
1423 * include here as well.
1425 * Now we need to actually start the code and set the elm_policy,
1426 * which defines for a given policy group/identifier a new policy's
1427 * value, respectively. In this example the only policy we need to set
1428 * a value for is @c ELM_POLICY_QUIT, possibles values for it are:
1429 * function to make this tutorial more didactical.
1431 * @li @p ELM_POLICY_QUIT_NONE: Never quit the application
1434 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the
1435 * application's last window is closed;
1437 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the
1438 * application's last window is hidden;
1441 * @until elm_policy_set
1443 * As you can see, the policy we chose was to quit when the last win
1444 * is hidden as opose to examples with the C bindings where we
1445 * perpetually set it to quit when last win was closed. This changed
1446 * was necessary because in C++ binding as the elm mainloop stop
1447 * running all object are destroyed, references are unreferenced and
1448 * events are stopped at ELM_MAIN().
1450 * @see For more details consult elm_policy_set
1452 * Next step is creating an elementary window, in this example we use
1453 * the C++ binding method with the elm_win_util_standard_add that is a
1454 * elm_win_legacy function, better explained below. And then we set
1455 * the autohide state for it.
1457 * @p elm_win_util_standard_add (const char *name, const char *tittle)
1458 * Adds a window object with standard setup.
1461 * @li @p name - The name of the window;
1463 * @li @p title - The title for the window.
1465 * This creates a window but also puts in a standard background with
1466 * @p elm_bg_add(), as well as setting the window title to @p
1467 * title. The window type created is of type @c ELM_WIN_BASIC, with
1468 * the @c NULL as the parent widget. Returns the created object or @c
1471 * The autohide works similarly to @p autodel, automatically handling
1472 * "delete,request" signals when set to @p true, with the difference
1473 * that it will hide the window, instead of destroying it.
1475 * It is specially designed to work together with @p
1476 * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting
1477 * Elementary's main loop when all the windows are hidden.
1480 * @until autohide_set
1482 * @note @p autodel and @a autohide are not mutually exclusive. The
1483 * window will be destructed if both autodel and autohide is set to @p
1484 * EINA_TRUE or @p true.
1486 * Now let's create the calendar with the C++ binding method, passing
1487 * our window object as parent.
1489 * @skipline elm::calendar
1491 * The function @c size_hint_weight_set for C++ bindings originated
1492 * from C bindings function evas_object_size_hint_weight_set, that is
1493 * EFL Evas type function. With this function we set the hints for an
1494 * object's weight. The parameters are:
1496 * @li x - Nonnegative double value to use as horizontal weight hint.
1498 * @li y - Nonnegative double value to use as vertical weight hint.
1500 * This is not a size enforcement in any way, it's just a hint that
1501 * should be used whenever appropriate. This is a hint on how a
1502 * container object should resize a given child within its area.
1504 * Containers may adhere to the simpler logic of just expanding the
1505 * child object's dimensions to fit its own (see the EVAS_HINT_EXPAND
1506 * helper weight macro in the EFL Evas Documentation) or the complete
1507 * one of taking each child's weight hint as real weights to how much
1508 * of its size to allocate for them in each axis. A container is
1509 * supposed to, after normalizing the weights of its children (with
1510 * weight hints), distribute the space it has to layout them by those
1511 * factors – most weighted children get larger in this process than
1514 * @skipline weight_set
1516 * @note Default weight hint values are 0.0, for both axis.
1518 * Now we add the calendar as a resize-object to win informing that
1519 * when the size of the win changes so should the calendar's
1524 * Straigh to the point, to set it is enough to call
1525 * min_max_year_set(). First value is minimum year, second is
1526 * maximum. If first value is negative, it won't apply limit for min
1527 * year, if the second one is negative, won't apply for max year.
1528 * Setting both to negative value will clear limits (default state):
1530 * @skipline min_max_year_set
1532 * Finally we just have to make the calendar and window visible and
1533 * then start the elm mainloop, starting to handle events and drawing
1539 * Our example will look like this:
1541 * @image html screenshots/calendar_cxx_example_03.png
1542 * @image latex screenshots/calendar_cxx_example_03.eps width=\textwidth
1544 * See the full source code @ref calendar_cxx_example_03.cc here.
1546 * @example calendar_cxx_example_03.cc
1550 * @page calendar_cxx_example_04 Calendar - Days selection with C++ binding.
1551 * @dontinclude calendar_cxx_example_04.cc
1553 * It's possible to disable date selection and to select a date
1554 * from your program, and that's what we'll see on this example.
1556 * The first part consists of including the headers. In this case we
1557 * are only working with the Elementary C++ binding and thus we need
1558 * only to include him.
1560 * @skipline Elementary.hh
1562 * @attention If necessary the C and/or the C++ headers should be
1563 * include here as well.
1565 * Now we need to actually start the code and set the elm_policy,
1566 * which defines for a given policy group/identifier a new policy's
1567 * value, respectively. In this example the only policy we need to set
1568 * a value for is @c ELM_POLICY_QUIT, possibles values for it are:
1570 * @li @p ELM_POLICY_QUIT_NONE: Never quit the application
1573 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the
1574 * application's last window is closed;
1576 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the
1577 * application's last window is hidden;
1580 * @until elm_policy_set
1582 * As you can see, the policy we chose was to quit when the last win
1583 * is hidden as opose to examples with the C bindings where we
1584 * perpetually set it to quit when last win was closed. This changed
1585 * was necessary because in C++ binding as the elm mainloop stop
1586 * running all object are destroyed, references are unreferenced and
1587 * events are stopped at ELM_MAIN().
1589 * @see For more details consult elm_policy_set
1591 * Next step is creating an elementary window, in this example we use
1592 * the C++ binding method with the elm_win_util_standard_add that is a
1593 * elm_win_legacy function, better explained below. And then we set
1594 * the autohide state for it.
1596 * @p elm_win_util_standard_add (const char *name, const char *tittle)
1597 * Adds a window object with standard setup.
1600 * @li @p name - The name of the window;
1602 * @li @p title - The title for the window.
1604 * This creates a window but also puts in a standard background with
1605 * @p elm_bg_add(), as well as setting the window title to @p
1606 * title. The window type created is of type @c ELM_WIN_BASIC, with
1607 * the @c NULL as the parent widget. Returns the created object or @c
1610 * The autohide works similarly to @p autodel, automatically handling
1611 * "delete,request" signals when set to @p true, with the difference
1612 * that it will hide the window, instead of destroying it.
1614 * It is specially designed to work together with @p
1615 * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting
1616 * Elementary's main loop when all the windows are hidden.
1619 * @until autohide_set
1621 * @note @p autodel and @a autohide are not mutually exclusive. The
1622 * window will be destructed if both autodel and autohide is set to @p
1623 * EINA_TRUE or @p true.
1625 * In this example we'll need to use a elm::box to layout the two
1626 * calendars that'll be created. A box arranges objects in a linear
1627 * fashion, governed by a layout function that defines the details of
1628 * this arrangement. The box will use an internal function
1629 * to set the layout to a single row, vertical by default.
1631 * Now let's create the box with the C++ binding method, passing
1632 * our window object as parent.
1634 * @skipline elm::box
1636 * The function @c size_hint_weight_set for C++ bindings originated
1637 * from C bindings function evas_object_size_hint_weight_set, that is
1638 * EFL Evas type function. With this function we set the hints for an
1639 * object's weight. The parameters are:
1641 * @li x - Nonnegative double value to use as horizontal weight hint.
1643 * @li y - Nonnegative double value to use as vertical weight hint.
1645 * This is not a size enforcement in any way, it's just a hint that
1646 * should be used whenever appropriate. This is a hint on how a
1647 * container object should resize a given child within its area.
1649 * Containers may adhere to the simpler logic of just expanding the
1650 * child object's dimensions to fit its own (see the EVAS_HINT_EXPAND
1651 * helper weight macro in the EFL Evas Documentation) or the complete
1652 * one of taking each child's weight hint as real weights to how much
1653 * of its size to allocate for them in each axis. A container is
1654 * supposed to, after normalizing the weights of its children (with
1655 * weight hints), distribute the space it has to layout them by those
1656 * factors – most weighted children get larger in this process than
1659 * @skipline weight_set
1661 * @note Default weight hint values are 0.0, for both axis.
1663 * Now we add the box as a resize-object to win informing that when
1664 * the size of the win changes so should the box's size. Remember
1665 * always to set the box visibility to true.
1670 * Now let's create the calendar with the C++ binding method, passing
1671 * our window object as parent. The function size_hint_weight_set
1672 * works with calendar the same way as with box, for more, search
1675 * @skip elm::calendar
1678 * The function @c size_hint_align_set for C++ bindings originated
1679 * from C bindings function evas_object_size_hint_align_set, that is
1680 * EFL Evas type function. With this function we set the hints for an
1681 * object's alignment. The parameters are:
1683 * @li x - Double, ranging from 0.0 to 1.0 or with the special value
1684 * EVAS_HINT_FILL, to use as horizontal alignment hint.
1686 * @li y - Double, ranging from 0.0 to 1.0 or with the special value
1687 * EVAS_HINT_FILL, to use as vertical alignment hint.
1689 * These are hints on how to align an object inside the boundaries of
1690 * a container/manager. Accepted values are in the 0.0 to 1.0 range,
1691 * with the special value EVAS_HINT_FILL used to specify "justify" or
1692 * "fill" by some users. In this case, maximum size hints should be
1693 * enforced with higher priority, if they are set. Also, any padding
1694 * hint set on objects should add up to the alignment space on the
1695 * final scene composition.
1697 * For the horizontal component, 0.0 means to the left, 1.0 means to
1698 * the right. Analogously, for the vertical component, 0.0 to the top,
1699 * 1.0 means to the bottom.
1701 * This is not a size enforcement in any way, it's just a hint that
1702 * should be used whenever appropriate.
1704 * @note Default alignment hint values are 0.5, for both axis.
1706 * @skipline align_set
1708 * If isn't required that users could select a day on calendar, only
1709 * interacting going through months, disabling days selection could be
1710 * a good idea to avoid confusion. For that:
1712 * @skipline select_mode_set
1714 * When using the elm box the packing method of the subobj - calendar
1715 * in this case - should be defined. There are four possible methods:
1717 * @li @c pack_start(subobj_) - Add an object to the beginning of the
1718 * pack list. Pack @c subobj_ into the box obj, placing it first in
1719 * the list of children objects. The actual position the object will
1720 * get on screen depends on the layout used. If no custom layout is
1721 * set, it will be at the top or left, depending if the box is
1722 * vertical or horizontal, respectively.
1724 * @li @c pack_end(subobj_) - Add an object at the end of the pack
1725 * list. Pack @c subobj_ into the box obj, placing it last in the list
1726 * of children objects. The actual position the object will get on
1727 * screen depends on the layout used. If no custom layout is set, it
1728 * will be at the bottom or right, depending if the box is vertical or
1729 * horizontal, respectively.
1731 * @li @c pack_before(subobj_, before_) - Adds an object to the box
1732 * before the indicated object. This will add the @c subobj_ to the
1733 * box indicated before the object indicated with @c before_. If
1734 * before is not already in the box, results are undefined. Before
1735 * means either to the left of the indicated object or above it
1736 * depending on orientation.
1738 * @li @c pack_after(subobj_, after_) - Adds an object to the box
1739 * after the indicated object. This will add the @c subobj_ to the box
1740 * indicated after the object indicated with @c after_. If after is
1741 * not already in the box, results are undefined. After means either
1742 * to the right of the indicated object or below it depending on
1745 * In this and most examples we use pack_end by choice and
1746 * practicality. In this part of the code we also make calendar
1752 * Also, regarding days selection, you could be interested to set a
1753 * date to be highlighted on calendar from your code, maybe when a
1754 * specific event happens or after calendar creation. As @c time
1755 * output is in seconds, we define the number of seconds contained
1756 * within a day as a constant:
1758 * @dontinclude calendar_cxx_example_04.cc
1759 * @skipline SECS_DAY
1761 * As with the first calendar, we'll also construct cal2, set it's
1762 * hint_weight and hint_align, make cal2 visible and choose the
1770 * Now let's select two days from current day:
1772 * @dontinclude calendar_cxx_example_04.cc
1774 * @until selected_time_set
1776 * Finally we just have to make window visible and then start the elm
1777 * mainloop, starting to handle events and drawing operations.
1782 * Our example will look like this:
1784 * @image html screenshots/calendar_cxx_example_04.png
1785 * @image latex screenshots/calendar_cxx_example_04.eps width=\textwidth
1787 * See the full source code @ref calendar_cxx_example_04.cc here.
1788 * @example calendar_cxx_example_04.cc
1792 * @page calendar_cxx_example_05 Calendar - Signal callback and getters with C++ binding.
1793 * @dontinclude calendar_cxx_example_05.cc
1795 * Most of setters explained on previous examples have associated
1796 * getters. That's the subject of this example. We'll add a callback
1797 * to display all calendar information every time user interacts with
1798 * the calendar. To be more didatical we'll start with the basics.
1800 * The first part consists of including the headers. In this case we
1801 * are only working with the Elementary C++ binding and thus we need
1802 * only to include him.
1804 * @skipline Elementary.hh
1806 * @attention If necessary the C and/or the C++ headers should be
1807 * included here as well.
1809 * Now we need to actually start the code and set the elm_policy,
1810 * which defines for a given policy group/identifier a new policy's
1811 * value, respectively. In this example the only policy we need to set
1812 * a value for is @c ELM_POLICY_QUIT, possibles values for it are:
1813 * function to make this tutorial more didactical.
1815 * @li @p ELM_POLICY_QUIT_NONE: Never quit the application
1818 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the
1819 * application's last window is closed;
1821 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the
1822 * application's last window is hidden;
1825 * @until elm_policy_set
1827 * As you can see, the policy we chose was to quit when the last win
1828 * is hidden as opose to examples with the C bindings where we
1829 * perpetually set it to quit when last win was closed. This changed
1830 * was necessary because in C++ binding as the elm mainloop stop
1831 * running all object are destroyed, references are unreferenced and
1832 * events are stopped at ELM_MAIN().
1834 * @see For more details consult elm_policy_set
1836 * Next step is creating an elementary window, in this example we use
1837 * the C++ binding method with the elm_win_util_standard_add that is a
1838 * elm_win_legacy function, better explained below. And then we set
1839 * the autohide state for it.
1841 * @p elm_win_util_standard_add (const char *name, const char *tittle)
1842 * Adds a window object with standard setup.
1845 * @li @p name - The name of the window;
1847 * @li @p title - The title for the window.
1849 * This creates a window but also puts in a standard background with
1850 * @p elm_bg_add(), as well as setting the window title to @p
1851 * title. The window type created is of type @c ELM_WIN_BASIC, with
1852 * the @c NULL as the parent widget. Returns the created object or @c
1855 * The autohide works similarly to @p autodel, automatically handling
1856 * "delete,request" signals when set to @p true, with the difference
1857 * that it will hide the window, instead of destroying it.
1859 * It is specially designed to work together with @p
1860 * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting
1861 * Elementary's main loop when all the windows are hidden.
1864 * @until autohide_set
1866 * @note @p autodel and @a autohide are not mutually exclusive. The
1867 * window will be destructed if both autodel and autohide is set to @p
1868 * EINA_TRUE or @p true.
1870 * Now let's create the calendar with the C++ binding method, passing
1871 * our window object as parent.
1873 * @skipline elm::calendar
1875 * The function @c size_hint_weight_set for C++ bindings originated
1876 * from C bindings function evas_object_size_hint_weight_set, that is
1877 * EFL Evas type function. With this function we set the hints for an
1878 * object's weight. The parameters are:
1880 * @li x - Nonnegative double value to use as horizontal weight hint.
1882 * @li y - Nonnegative double value to use as vertical weight hint.
1884 * This is not a size enforcement in any way, it's just a hint that
1885 * should be used whenever appropriate. This is a hint on how a
1886 * container object should resize a given child within its area.
1888 * Containers may adhere to the simpler logic of just expanding the
1889 * child object's dimensions to fit its own (see the EVAS_HINT_EXPAND
1890 * helper weight macro in the EFL Evas Documentation) or the complete
1891 * one of taking each child's weight hint as real weights to how much
1892 * of its size to allocate for them in each axis. A container is
1893 * supposed to, after normalizing the weights of its children (with
1894 * weight hints), distribute the space it has to layout them by those
1895 * factors – most weighted children get larger in this process than
1898 * @skipline weight_set
1900 * @note Default weight hint values are 0.0, for both axis.
1902 * Now we add the calendar as a resize-object to win informing that
1903 * when the size of the win changes so should the calendar's
1906 * Let's check our callback function, type lambda:
1907 * @skip print_cal_info
1908 * @until double interval;
1910 * To learn more about consult @ref lambda.
1912 * To get selected day, we need to call selected_time_get(), but to
1913 * assure nothing wrong happened, we must check for function return.
1914 * It'll return @c EINA_FALSE if fail. Otherwise we can use time set
1915 * to our structure @p stime.
1917 * @skip selected_time_get
1920 * Next we'll get information from calendar and place on declared
1924 * @until weekdays_names_get
1926 * The only tricky part is that last line gets an array of strings
1927 * (char arrays), one for each weekday.
1929 * Then we can simple print that with std::cout and finish the lambda
1933 * @until std::placeholders::_1
1935 * <tt> struct tm </tt> is declared on @c time.h. You can check @c
1936 * ctime manpage to read about it.
1938 * To register this callback, that will be called every time user
1939 * selects a day or goes to next or previous month, just add a
1940 * callback for signal @b changed.
1942 * @skipline callback_changed_add
1944 * Finally we just have to make calendar and window visibles and then
1945 * start the elm mainloop, starting to handle events and drawing
1951 * Our example will look like this:
1953 * @image html screenshots/calendar_cxx_example_05.png
1954 * @image latex screenshots/calendar_cxx_example_05.eps width=\textwidth
1956 * See the full source code @ref calendar_cxx_example_05.cc here.
1957 * @example calendar_cxx_example_05.cc
1961 * @page clock_cxx_example Clock widget example wit C++ binding.
1962 * @dontinclude clock_cxx_example.cc
1964 * This code places five Elementary clock widgets on a window, each of
1965 * them exemplifying a part of the widget's API. Before explaining
1966 * each clock to be more didatical let's start with the basics.
1968 * The first part consists of including the headers. In this
1969 * case we are only working with the Elementary C++ binding and thus
1970 * we need only to include him.
1972 * @skipline Elementary.hh
1974 * @attention If necessary the C and/or the C++ headers should be
1975 * include here as well.
1977 * Now we need to actually start the code and set the elm_policy,
1978 * which defines for a given policy group/identifier a new policy's
1979 * value, respectively. In this example the only policy we need to
1980 * set a value for is @c ELM_POLICY_QUIT, possibles values for it are:
1982 * @li @p ELM_POLICY_QUIT_NONE: Never quit the application
1985 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the
1986 * application's last window is closed;
1988 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the
1989 * application's last window is hidden;
1992 * @until elm_policy_set
1994 * As you can see, the policy we chose was to quit when the last win
1995 * is hidden as opose to examples with the C bindings where we
1996 * perpetually set it to quit when last win was closed. This changed
1997 * was necessary because in C++ binding as the elm mainloop stop
1998 * running all object are destroyed, references are unreferenced and
1999 * events are stopped at ELM_MAIN().
2001 * @see For more details consult elm_policy_set
2003 * Next step is creating an Elementary window, in this example we use
2004 * the C++ binding method with the elm_win_util_standard_add that is a
2005 * elm_win_legacy function, better explained below. And then we set
2006 * the autohide state for it.
2008 * @p elm_win_util_standard_add (const char *name, const char *tittle)
2009 * Adds a window object with standard setup.
2012 * @li @p name - The name of the window;
2014 * @li @p title - The title for the window.
2016 * This creates a window but also puts in a standard background with
2017 * @p elm_bg_add(), as well as setting the window title to @p
2018 * title. The window type created is of type @c ELM_WIN_BASIC, with
2019 * the @c NULL as the parent widget. Returns the created object or @c
2022 * And we also set the autohide state for win, autohide works
2023 * similarly to @p autodel, automatically handling "delete,request"
2024 * signals when set to @p true, with the difference that it will hide
2025 * the window, instead of destroying it.
2027 * It is specially designed to work together with @p
2028 * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting
2029 * Elementary's main loop when all the windows are hidden.
2032 * @until autohide_set
2034 * @note @p autodel and @a autohide are not mutually exclusive. The
2035 * window will be destructed if both autodel and autohide is set to @p
2036 * EINA_TRUE or @p true.
2038 * @see For more details consult elm::win::autohide_set().
2040 * A box arranges objects in a linear fashion, governed by a layout
2041 * function that defines the details of this arrangement. The box will
2042 * use an internal function to set the layout to a single row,
2043 * vertical by default.
2045 * Now let's create the box with the C++ binding method, passing our
2046 * window object as parent.
2048 * @skipline elm::box
2050 * To better understand, the function @c size_hint_weight_set for C++
2051 * bindings originated from C bindings function
2052 * evas_object_size_hint_weight_set, that is EFL Evas type function.
2053 * With this function we set the hints for an object's weight. The
2056 * @li x - Nonnegative double value to use as horizontal weight hint.
2058 * @li y - Nonnegative double value to use as vertical weight hint.
2060 * This is not a size enforcement in any way, it's just a hint that
2061 * should be used whenever appropriate. This is a hint on how a
2062 * container object should resize a given child within its area.
2064 * Containers may adhere to the simpler logic of just expanding the
2065 * child object's dimensions to fit its own (see the EVAS_HINT_EXPAND
2066 * helper weight macro in the EFL Evas Documentation) or the complete
2067 * one of taking each child's weight hint as real weights to how much
2068 * of its size to allocate for them in each axis. A container is
2069 * supposed to, after normalizing the weights of its children (with
2070 * weight hints), distribute the space it has to layout them by those
2071 * factors – most weighted children get larger in this process than
2074 * @skipline weight_set
2076 * @note Default weight hint values are 0.0, for both axis.
2078 * Then we add the box as a resize-object to win informing that when
2079 * the size of the win changes so should the box's size. Remember
2080 * always to set the box visibility to true.
2085 * We create each clock with the C++ binding method, passing our
2086 * window object as parent. The first of them is the pristine clock,
2087 * using the defaults for a clock, which are military time with no
2092 * When using the elm::box the packing method of the subobj - clock
2093 * in this case - should be defined. There are four possible methods:
2095 * @li @c pack_start(subobj_) - Add an object to the beginning of the
2096 * pack list. Pack @c subobj_ into the box obj, placing it first in
2097 * the list of children objects. The actual position the object will
2098 * get on screen depends on the layout used. If no custom layout is
2099 * set, it will be at the top or left, depending if the box is
2100 * vertical or horizontal, respectively.
2102 * @li @c pack_end(subobj_) - Add an object at the end of the pack
2103 * list. Pack @c subobj_ into the box obj, placing it last in the list
2104 * of children objects. The actual position the object will get on
2105 * screen depends on the layout used. If no custom layout is set, it
2106 * will be at the bottom or right, depending if the box is vertical or
2107 * horizontal, respectively.
2109 * @li @c pack_before(subobj_, before_) - Adds an object to the box
2110 * before the indicated object. This will add the @c subobj_ to the
2111 * box indicated before the object indicated with @c before_. If
2112 * before is not already in the box, results are undefined. Before
2113 * means either to the left of the indicated object or above it
2114 * depending on orientation.
2116 * @li @c pack_after(subobj_, after_) - Adds an object to the box
2117 * after the indicated object. This will add the @c subobj_ to the box
2118 * indicated after the object indicated with @c after_. If after is
2119 * not already in the box, results are undefined. After means either
2120 * to the right of the indicated object or below it depending on
2123 * In this and most examples we use pack_end by choice and
2124 * practicality. In this part of the code we also make clock
2130 * The second clock shows ther am/pm time, that we also create with
2131 * the C++ binding method, passing our window object as
2132 * parent. Setting show_am_pm to true and again choosing the packing
2133 * method and making clock visible.
2138 * The third one will show the seconds digits, which will flip in
2139 * synchrony with system time. Note, besides, that the time itself is
2140 * @b different from the system's -- it was customly set with
2146 * In both fourth and fifth ones, we turn on the <b>edition
2147 * mode</b>. See how you can change each of the sheets on it, and be
2148 * sure to try holding the mouse pressed over one of the sheet
2149 * arrows. The forth one also starts with a custom time set:
2154 * The fifth, besides editable, has only the time @b units editable,
2155 * for hours, minutes and seconds. This exemplifies edit_mode_set():
2160 * Finally we just have to make our window visible and then run the
2161 * elm mainloop, starting to handle events and drawing operations.
2166 * See the full @ref clock_cxx_example.cc, whose window should look
2167 * like this picture:
2169 * @image html screenshots/clock_cxx_example.png
2170 * @image latex screenshots/clock_cxx_example.eps width=\textwidth
2171 * @example clock_cxx_example.cc
2175 * @page datetime_cxx_example Datetime Example with C++ binding
2176 * @dontinclude datetime_cxx_example.cc
2178 * This example places three Elementary Datetime widgets on a window,
2179 * each of them exemplifying the widget's different usage.
2181 * The first part consists of including the headers. In this
2182 * case we are only working with the Elementary C++ binding and thus
2183 * we need only to include him.
2185 * @skipline Elementary.hh
2187 * @attention If necessary the C and/or the C++ headers should be
2188 * include here as well.
2190 * Now we need to actually start the code and set the elm_policy,
2191 * which defines for a given policy group/identifier a new policy's
2192 * value, respectively. In this example the only policy we need to
2193 * set a value for is @c ELM_POLICY_QUIT, possibles values for it are:
2195 * @li @p ELM_POLICY_QUIT_NONE: Never quit the application
2198 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the
2199 * application's last window is closed;
2201 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the
2202 * application's last window is hidden;
2205 * @until elm_policy_set
2207 * As you can see, the policy we chose was to quit when the last win
2208 * is hidden as opose to examples with the C bindings where we
2209 * perpetually set it to quit when last win was closed. This changed
2210 * was necessary because in C++ binding as the elm mainloop stop
2211 * running all object are destroyed, references are unreferenced and
2212 * events are stopped at ELM_MAIN().
2214 * @see For more details consult elm_policy_set
2216 * Next step is creating an Elementary window, where win calls a
2217 * constructor and sets the type of the win to ELM_WIN_BASIC
2218 * (Elm_Win_Type), which is the indicated type for most of our
2219 * examples. Here we also set the title that will appear at the top of
2220 * our window and then the autohide state for win.
2222 * The autohide works similarly to @p autodel, automatically handling
2223 * "delete,request" signals when set to @p true, with the difference
2224 * that it will hide the window, instead of destroying it.
2226 * It is specially designed to work together with @p
2227 * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting
2228 * Elementary's main loop when all the windows are hidden.
2231 * @until autohide_set
2233 * @note @p autodel and @a autohide are not mutually exclusive. The
2234 * window will be destructed if both autodel and autohide is set to @p
2235 * EINA_TRUE or @p true.
2237 * Now we construct the elm background and for this we use the C++
2238 * method below, setting it's parent.
2240 * @skipline ::elm::bg
2242 * To better understand, the function @c size_hint_weight_set for C++
2243 * bindings originated from C bindings function
2244 * evas_object_size_hint_weight_set, that is EFL Evas type function.
2245 * With this function we set the hints for an object's weight. The
2248 * @li x - Nonnegative double value to use as horizontal weight hint.
2250 * @li y - Nonnegative double value to use as vertical weight hint.
2252 * This is not a size enforcement in any way, it's just a hint that
2253 * should be used whenever appropriate. This is a hint on how a
2254 * container object should resize a given child within its area.
2256 * Containers may adhere to the simpler logic of just expanding the
2257 * child object's dimensions to fit its own (see the EVAS_HINT_EXPAND
2258 * helper weight macro in the EFL Evas Documentation) or the complete
2259 * one of taking each child's weight hint as real weights to how much
2260 * of its size to allocate for them in each axis. A container is
2261 * supposed to, after normalizing the weights of its children (with
2262 * weight hints), distribute the space it has to layout them by those
2263 * factors – most weighted children get larger in this process than
2266 * @skipline weight_set
2268 * @note Default weight hint values are 0.0, for both axis.
2270 * Now we add the background as a resize_object to win informing that
2271 * when the size of the win changes so should the background's
2272 * size. And finally we make it visible.
2275 * @until visibility_set
2277 * @remarks If a color it's not setted the default color will be used.
2279 * A box arranges objects in a linear fashion, governed by a layout
2280 * function that defines the details of this arrangement. The box will
2281 * use an internal function to set the layout to a single row,
2282 * vertical by default.
2284 * Now let's create the box with the C++ binding method, passing our
2285 * window object as parent. Using Evas weight_set function again to
2286 * hint on how a container object should resize a given child within
2289 * @skipline elm::box
2292 * Then we add the box as a resize-object to win informing that when
2293 * the size of the win changes so should the box's size. Remember
2294 * always to set the box visibility to true.
2299 * The first of them is <b>"only Date display"</b>. We will create it
2300 * using the C++ method below. The weight hint works with datetime the
2301 * same as it did with background and box.
2306 * Now we have to The function @c size_hint_align_set for C++ bindings
2307 * originated from C bindings function
2308 * evas_object_size_hint_align_set, that is EFL Evas type
2309 * function. With this function we set the hints for an object's
2310 * alignment. The parameters are:
2312 * @li x - Double, ranging from 0.0 to 1.0 or with the special value
2313 * EVAS_HINT_FILL, to use as horizontal alignment hint.
2315 * @li y - Double, ranging from 0.0 to 1.0 or with the special value
2316 * EVAS_HINT_FILL, to use as vertical alignment hint.
2318 * These are hints on how to align an object inside the boundaries of
2319 * a container/manager. Accepted values are in the 0.0 to 1.0 range,
2320 * with the special value EVAS_HINT_FILL used to specify "justify" or
2321 * "fill" by some users. In this case, maximum size hints should be
2322 * enforced with higher priority, if they are set. Also, any padding
2323 * hint set on objects should add up to the alignment space on the
2324 * final scene composition.
2326 * For the horizontal component, 0.0 means to the left, 1.0 means to
2327 * the right. Analogously, for the vertical component, 0.0 to the top,
2328 * 1.0 means to the bottom.
2330 * This is not a size enforcement in any way, it's just a hint that
2331 * should be used whenever appropriate.
2335 * @note Default alignment hint values are 0.5, for both axis.
2337 * An important feature for the datetime is the setting of what we
2338 * want it to display. We can achieve that by using:
2340 * @p field_visible_set ( Elm_Datetime_Field_Type fieldtype_, bool
2345 * @li @p fieldtype_: type of the field, supports 6 fields:
2347 * @p ELM_DATETIME_YEAR: Indicates Year field.
2349 * @p ELM_DATETIME_MONTH: Indicates Month field.
2351 * @p ELM_DATETIME_DATE: Indicates Date field.
2353 * @p ELM_DATETIME_HOUR: Indicates Hour field,
2355 * @p ELM_DATETIME_MINUTE: Indicates Minute field.
2357 * @p ELM_DATETIME_AMPM: Indicates AM/PM field.
2359 * @li @p visible_: @p true field can be visible, @p false otherwise.
2361 * @attention Setting this API True does not ensure that the field is
2362 * visible, apart from this, the field's format must be present in
2363 * Datetime overall format. If a field's visibility is set to False
2364 * then it won't appear even though its format is present in overall
2365 * format. So if and only if this API is set true and the
2366 * corresponding field's format is present in Datetime format, the
2369 * @note By default the field visibility is set to @p true.
2371 * For this first datetime we are setting the HOUR, MINUTE and AM/PM
2372 * to not be visible, doing this we'll display in our datetime the
2373 * year, month and date.
2375 * @note Hour format 12hr(1-12) or 24hr(0-23) display can be selected
2376 * by setting the corresponding user format. The corresponding Month
2377 * and AM/PM strings are displayed according to the system’s language
2383 * When using the elm box the packing method of the subobj - datetime
2384 * in this case - should be defined. There are four possible methods:
2386 * @li @c pack_start(subobj_) - Add an object to the beginning of the
2387 * pack list. Pack @c subobj_ into the box obj, placing it first in
2388 * the list of children objects. The actual position the object will
2389 * get on screen depends on the layout used. If no custom layout is
2390 * set, it will be at the top or left, depending if the box is
2391 * vertical or horizontal, respectively.
2393 * @li @c pack_end(subobj_) - Add an object at the end of the pack
2394 * list. Pack @c subobj_ into the box obj, placing it last in the list
2395 * of children objects. The actual position the object will get on
2396 * screen depends on the layout used. If no custom layout is set, it
2397 * will be at the bottom or right, depending if the box is vertical or
2398 * horizontal, respectively.
2400 * @li @c pack_before(subobj_, before_) - Adds an object to the box
2401 * before the indicated object. This will add the @c subobj_ to the
2402 * box indicated before the object indicated with @c before_. If
2403 * before is not already in the box, results are undefined. Before
2404 * means either to the left of the indicated object or above it
2405 * depending on orientation.
2407 * @li @c pack_after(subobj_, after_) - Adds an object to the box
2408 * after the indicated object. This will add the @c subobj_ to the box
2409 * indicated after the object indicated with @c after_. If after is
2410 * not already in the box, results are undefined. After means either
2411 * to the right of the indicated object or below it depending on
2414 * In this and most examples we use pack_end by choice and
2415 * practicality. In this part of the code we also make datetime
2421 * For our second datetime, we'll also set the size hints weight and
2422 * align, but in this case, the filds YEAR, MONTH and DATE will be not
2423 * visible, and thus displaying in our datetime the hour, minute and
2424 * AM/PM. Finally we choose it's packing method and set the visibility
2425 * of datetime to @p true.
2430 * For our third and last datetime, we setted the weight and align as
2431 * before, chose our packing method and made it visible. Note that in
2432 * this case we didn't exclude any type of field leaving all visible.
2437 * And finally, we set our win's visibility and start the elm
2438 * mainloop, starting to handle events and drawing operations.
2443 * See the full @ref datetime_cxx_example.cc .
2445 * This example should look like:
2447 * @image html screenshots/datetime_cxx_example.png
2448 * @image latex screenshots/datetime_cxx_example.eps width=\textwidth
2450 * @example datetime_cxx_example.cc
2454 * @page glview_cxx_example_01 Glview example with C++ Binding
2455 * @dontinclude glview_cxx_example_01.cc
2457 * In this example we'll illustrate how to use Glview and it's
2460 * The first part consists of including the headers. In this case we
2461 * need to include @p Elementary.hh, @p Evas_GL.h and @p stdio.h.
2463 *@li @p Elementary.hh: library for Elementary with support for C++
2466 *@li @p Evas_GL.h: has functions that are used to do OpenGL rendering
2467 * on Evas, Evas allows us to use OpenGL to render to specially set up
2468 * image objects, which act as render target surfaces.
2470 *@li @p stdio.h is a C library with functions tha perform
2471 * Input/Output operations.
2473 * @skip Elementary.hh
2476 * Continuing with the code, at this point we create a GL related
2479 *@li @p Evas_GL_API that is the structure type of the Evas GL API object
2480 * that contains the GL APIs to be used in Evas GL.
2482 *@li @p GLuint one of the pre-defined types of OpenGL which is a unsigned binary integer.
2484 *@li @p int AKA @p int.
2489 * Here we're simply initializing a type float, that we named red.
2493 * In this example we'll need a type C helper function to load shaders
2494 * from a shader source.
2499 * Inside this function we create the shader objectand load/compile
2503 * @until return shader;
2505 * Completing our load shader function.
2509 * This example will also need a function to initialize the shader and
2515 * In this function we load the vertex/fragment shaders, create the
2516 * program object and finish our funtion.
2522 * We need the following callbacks:
2524 * @li initialize callback: that get called once for
2531 * @li delete callback: gets called when glview is deleted;
2537 * @li resize callback: gets called every time object is resized;
2542 * @li draw callback: is where all the main GL rendering happens.
2545 * @until COLOR_BUFFER
2547 * Inside this callback, we'll draw a triangle.
2552 * Still inside as an option we are going to flush the GL pipeline and
2558 * We create @p _anim to notify that glview has changed so it can
2564 * Now that we finished with the GL preparations, we'll start the main
2565 * code and initialize our GLData pointer object to NULL and run a
2566 * check just in case.
2571 * Let's set the elm_policy, which defines for a given policy
2572 * group/identifier a new policy's value, respectively. In this
2573 * example the only policy we need to set a value for is @c
2574 * ELM_POLICY_QUIT, possibles values for it are:
2576 * @li @p ELM_POLICY_QUIT_NONE: Never quit the application
2579 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the
2580 * application's last window is closed;
2582 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the
2583 * application's last window is hidden;
2585 * @skipline elm_policy_set
2587 * As you can see, the policy we chose was to quit when the last win
2588 * is hidden as opose to examples with the C bindings where we
2589 * perpetually set it to quit when last win was closed. This changed
2590 * was necessary because in C++ binding as the elm mainloop stop
2591 * running all object are destroyed, references are unreferenced and
2592 * events are stopped at ELM_MAIN().
2594 * @see For more details consult elm_policy_set
2596 * Next step is creating an elementary window, in this example we use
2597 * the C++ binding method with the elm_win_util_standard_add that is a
2598 * elm_win_legacy function, better explained below. And then we set
2599 * the autohide state for it.
2601 * @p elm_win_util_standard_add (const char *name, const char *tittle)
2602 * Adds a window object with standard setup.
2605 * @li @p name - The name of the window;
2607 * @li @p title - The title for the window.
2609 * This creates a window but also puts in a standard background with
2610 * @p elm_bg_add(), as well as setting the window title to @p
2611 * title. The window type created is of type @c ELM_WIN_BASIC, with
2612 * the @c NULL as the parent widget. Returns the created object or @c
2615 * The autohide works similarly to @p autodel, automatically handling
2616 * "delete,request" signals when set to @p true, with the difference
2617 * that it will hide the window, instead of destroying it.
2619 * It is specially designed to work together with @p
2620 * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting
2621 * Elementary's main loop when all the windows are hidden.
2624 * @until autohide_set
2626 * @note @p autodel and @a autohide are not mutually exclusive. The
2627 * window will be destructed if both autodel and autohide is set to @p
2628 * EINA_TRUE or @p true.
2630 * Now let's create a box with the C++ binding method, passing our
2631 * window object as parent, we'll use this box to contain our glview
2636 * To better understand, the function @c size_hint_weight_set for C++
2637 * bindings originated from C bindings function
2638 * evas_object_size_hint_weight_set, that is EFL Evas type function.
2639 * With this function we set the hints for an object's weight. The
2642 * @li x - Nonnegative double value to use as horizontal weight hint.
2644 * @li y - Nonnegative double value to use as vertical weight hint.
2646 * This is not a size enforcement in any way, it's just a hint that
2647 * should be used whenever appropriate. This is a hint on how a
2648 * container object should resize a given child within its area.
2650 * Containers may adhere to the simpler logic of just expanding the
2651 * child object's dimensions to fit its own (see the EVAS_HINT_EXPAND
2652 * helper weight macro in the EFL Evas Documentation) or the complete
2653 * one of taking each child's weight hint as real weights to how much
2654 * of its size to allocate for them in each axis. A container is
2655 * supposed to, after normalizing the weights of its children (with
2656 * weight hints), distribute the space it has to layout them by those
2657 * factors – most weighted children get larger in this process than
2660 * @skipline weight_set
2662 * @note Default weight hint values are 0.0, for both axis.
2664 * Then we add the box as a resize-object to win informing that when
2665 * the size of the win changes so should the box's size. Remember
2666 * always to set the box visibility to true.
2671 * In this part we'll create a new elm glview, using the C++ method,
2672 * in this case it requires that we set @p Evas_GL_Context_Version
2673 * with the version_constructor. @p Evas_GL_Context_Version is a
2674 * enumeration that defines the available OpenGL ES version numbers,
2675 * it can be used to create OpenGL-ES 1.1 contexts.
2680 * The function size_hint_weight_set works with glview the same way as
2681 * with box, for more, search above.
2683 * The function @c size_hint_align_set for C++ bindings originated
2684 * from C bindings function evas_object_size_hint_align_set, that is
2685 * EFL Evas type function. With this function we set the hints for an
2686 * object's alignment. The parameters are:
2688 * @li x - Double, ranging from 0.0 to 1.0 or with the special value
2689 * EVAS_HINT_FILL, to use as horizontal alignment hint.
2691 * @li y - Double, ranging from 0.0 to 1.0 or with the special value
2692 * EVAS_HINT_FILL, to use as vertical alignment hint.
2694 * These are hints on how to align an object inside the boundaries of
2695 * a container/manager. Accepted values are in the 0.0 to 1.0 range,
2696 * with the special value EVAS_HINT_FILL used to specify "justify" or
2697 * "fill" by some users. In this case, maximum size hints should be
2698 * enforced with higher priority, if they are set. Also, any padding
2699 * hint set on objects should add up to the alignment space on the
2700 * final scene composition.
2702 * For the horizontal component, 0.0 means to the left, 1.0 means to
2703 * the right. Analogously, for the vertical component, 0.0 to the top,
2704 * 1.0 means to the bottom.
2706 * This is not a size enforcement in any way, it's just a hint that
2707 * should be used whenever appropriate.
2709 * @note Default alignment hint values are 0.5, for both axis.
2711 * @skipline align_set
2713 * Mode is simply for supporting alpha, depth buffering and stencil
2719 * Resize policy tells glview what to do with the surface when it
2720 * resizes. ELM_VIEW_RESIZE_POLICY_RECREATE will tell it to destroy
2721 * the current surface and recreate it to the new size.
2725 * Render policy tells glview how it would like glview to render gl
2726 * code. ELM_GLVIEW_RENDER_POLICY_ON_DEMAND will have the gl calls
2727 * called in the pixel_get callback, which only gets called if the
2728 * object is visible, hence ON_DEMAND. ALWAYS mode renders it despite
2729 * the visibility of the object.
2733 * Now we'll register our callbacks.
2738 * When using the elm box the packing method of the subobj - glview in
2739 * this case - should be defined. There are four possible methods:
2741 * @li @c pack_start(subobj_) - Add an object to the beginning of the
2742 * pack list. Pack @c subobj_ into the box obj, placing it first in
2743 * the list of children objects. The actual position the object will
2744 * get on screen depends on the layout used. If no custom layout is
2745 * set, it will be at the top or left, depending if the box is
2746 * vertical or horizontal, respectively.
2748 * @li @c pack_end(subobj_) - Add an object at the end of the pack
2749 * list. Pack @c subobj_ into the box obj, placing it last in the list
2750 * of children objects. The actual position the object will get on
2751 * screen depends on the layout used. If no custom layout is set, it
2752 * will be at the bottom or right, depending if the box is vertical or
2753 * horizontal, respectively.
2755 * @li @c pack_before(subobj_, before_) - Adds an object to the box
2756 * before the indicated object. This will add the @c subobj_ to the
2757 * box indicated before the object indicated with @c before_. If
2758 * before is not already in the box, results are undefined. Before
2759 * means either to the left of the indicated object or above it
2760 * depending on orientation.
2762 * @li @c pack_after(subobj_, after_) - Adds an object to the box
2763 * after the indicated object. This will add the @c subobj_ to the box
2764 * indicated after the object indicated with @c after_. If after is
2765 * not already in the box, results are undefined. After means either
2766 * to the right of the indicated object or below it depending on
2769 * In this and most examples we use pack_end by choice and
2770 * practicality, in this part of the code we also make glview visible
2776 * For a simple demonstration of the animation we'll have to use
2777 * ecore::animator. As long as tou trigger an update on the image via
2778 * @p changed_set() it will be updated.
2783 * If you delete gl, this animator will keep running trying to access
2784 * gl so it's better to delete this animator with
2785 * ecore_animator_del(), as seen inside the lambda function.
2787 * @skipline callback_del
2789 * @note To learn more about Lambda Function and its use in Elementary
2790 * consult @ref lambda.
2792 * We're going to add a "OK" button to end the program. First step is
2793 * to create it using the C++ method, setting it's parent.
2797 * Second, set the text, alignment and weight hints, the hints work
2798 * the same as with box and glview.
2803 * Pack our button in the same box as glview and set the visibility for
2809 * As a final step for our button, we are going to add a clicked
2810 * callback, using again Lambda Type Function.
2814 * @note To learn more about Lambda Function and its use in Elementary
2815 * consult @ref lambda.
2817 * Now we only have to set the size for our window and make it
2821 * @until visibility_set
2823 * And finally, start the elm mainloop, starting to handle events and
2824 * drawing operations.
2829 * See full code for this example @ref glview_cxx_example_01.cc "here" .
2831 * @example glview_cxx_example_01.cc
2835 * @page hoversel_cxx_example_01 Hoversel example with C++ Binding
2836 * @dontinclude hoversel_cxx_example_01.cc
2838 * In this example we'll create a hoversel with 3 items, one with a
2839 * label but no icon and two with both a label and an icon. Every item
2840 * that is clicked will be deleted, but everytime the hoversel is
2841 * activated we will also add an item. In addition our first item will
2842 * print all items when clicked and our third item will clear all
2843 * items in the hoversel.
2845 * The first part consists of including the headers. We'll include @p
2846 * Elementary.hh, @p Eina.hh and @p Evas.hh, that are C++ bindings
2847 * that are needed in this example.
2852 * Before our main code we'll need the following callbacks:
2854 *@li @p _print_items: callback for our first item which prints all
2855 * items in the hoversel.
2859 *@li @p _free: callback that frees the allocated memory.
2863 * Starting the main code and initializing Eina C++ Lybrary, always
2864 * initiate Eina when included.
2869 * Now let's set the elm_policy, which defines for a given policy
2870 * group/identifier a new policy's value, respectively. In this
2871 * example the only policy we need to set a value for is @c
2872 * ELM_POLICY_QUIT, possibles values for it are:
2874 * @li @p ELM_POLICY_QUIT_NONE: Never quit the application
2877 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the
2878 * application's last window is closed;
2880 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the
2881 * application's last window is hidden;
2883 * @skipline elm_policy_set
2885 * As you can see, the policy we chose was to quit when the last win
2886 * is hidden as opose to examples with the C bindings where we
2887 * perpetually set it to quit when last win was closed. This changed
2888 * was necessary because in C++ binding as the elm mainloop stop
2889 * running all object are destroyed, references are unreferenced and
2890 * events are stopped at ELM_MAIN().
2892 * @see For more details consult elm_policy_set
2894 * Next step is creating an elementary window, in this example we use
2895 * the C++ binding method with the elm_win_util_standard_add that is a
2896 * elm_win_legacy function, better explained below. And then we set
2897 * the autohide state for it.
2899 * @p elm_win_util_standard_add (const char *name, const char *tittle)
2900 * Adds a window object with standard setup.
2903 * @li @p name - The name of the window;
2905 * @li @p title - The title for the window.
2907 * This creates a window but also puts in a standard background with
2908 * @p elm_bg_add(), as well as setting the window title to @p
2909 * title. The window type created is of type @c ELM_WIN_BASIC, with
2910 * the @c NULL as the parent widget. Returns the created object or @c
2913 * The autohide works similarly to @p autodel, automatically handling
2914 * "delete,request" signals when set to @p true, with the difference
2915 * that it will hide the window, instead of destroying it.
2917 * It is specially designed to work together with @p
2918 * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting
2919 * Elementary's main loop when all the windows are hidden.
2922 * @until autohide_set
2924 * @note @p autodel and @a autohide are not mutually exclusive. The
2925 * window will be destructed if both autodel and autohide is set to @p
2926 * EINA_TRUE or @p true.
2928 * Next we'll create a red evas::rectangle to use as the icon of our
2929 * hoversel, for thus using the C++ method, setting the color and
2930 * making it visible.
2935 * And now we create our hoversel and set some of it's properties. We
2936 * set @p win as its parent, set it to be vertical and give it a label
2937 * and content, that will work as icon:
2942 * Next we will add callbacks to be called for the first and third:
2947 * We also set a pair of callbacks to be called whenever any item is
2948 * selected or when the hoversel is activated, for this we'll use
2949 * Lambda type function, @p add_item is called when the hoversel is
2950 * activated and adds an item to the hoversel. Note that since we
2951 * allocate memory for the item we need to know when the item dies so
2952 * we can free that memory.
2957 * @see For more on Lambda check @ref lambda "here"
2959 * Finishing with hoversel we set its size, position and make it
2965 * In our second hoversel we'll add a button and for this we need
2966 * create it using C++ method, set a text, add a callback for when
2967 * button is clicked. This callback is type Lambda, it will clear
2968 * hoversel when clicked.
2973 * Concluding our button options, we will set the size, position and
2979 * Now we set the size for the window, making it visible in the end:
2982 * @until visibility_set
2984 * Finally we just have to start the elm mainloop, starting to handle
2985 * events and drawing operations.
2990 * Our example will look like this:
2992 * @image html screenshots/hoversel_cxx_example_01.png
2993 * @image latex screenshots/hoversel_cxx_example_01.eps width=\textwidth
2995 * @example hoversel_cxx_example_01.cc
2999 * @page icon_cxx_example_01 Icon Example with C++ binding
3000 * @dontinclude icon_cxx_example_01.cc
3002 * This example is as simple as possible. An icon object will be added
3003 * to the window over a blank background, and set to be resizable
3004 * together with the window. All the options set through the example
3005 * will affect the behavior of this icon.
3007 * The first part consists of including the headers. In this case we
3008 * are only working with the Elementary C++ binding and thus we need
3009 * only to include him.
3011 * @skipline Elementary.hh
3013 * @attention If necessary the C and/or the C++ headers should be
3014 * include here as well.
3016 * Now we need to actually start the code and set the elm_policy,
3017 * which defines for a given policy group/identifier a new policy's
3018 * value, respectively. In this example the only policy we need to set
3019 * a value for is @c ELM_POLICY_QUIT, possibles values for it are:
3021 * @li @p ELM_POLICY_QUIT_NONE: Never quit the application
3024 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the
3025 * application's last window is closed;
3027 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the
3028 * application's last window is hidden;
3031 * @until elm_policy_set
3033 * As you can see, the policy we chose was to quit when the last win
3034 * is hidden as opose to examples with the C bindings where we
3035 * perpetually set it to quit when last win was closed. This changed
3036 * was necessary because in C++ binding as the elm mainloop stop
3037 * running all object are destroyed, references are unreferenced and
3038 * events are stopped at ELM_MAIN().
3040 * @see For more details consult elm_policy_set
3042 * Next step is creating an elementary window, in this example we use
3043 * the C++ binding method with the elm_win_util_standard_add that is a
3044 * elm_win_legacy function, better explained below. And then we set
3045 * the autohide state for it.
3047 * @p elm_win_util_standard_add (const char *name, const char *tittle)
3048 * Adds a window object with standard setup.
3051 * @li @p name - The name of the window;
3053 * @li @p title - The title for the window.
3055 * This creates a window but also puts in a standard background with
3056 * @p elm_bg_add(), as well as setting the window title to @p
3057 * title. The window type created is of type @c ELM_WIN_BASIC, with
3058 * the @c NULL as the parent widget. Returns the created object or @c
3061 * The autohide works similarly to @p autodel, automatically handling
3062 * "delete,request" signals when set to @p true, with the difference
3063 * that it will hide the window, instead of destroying it.
3065 * It is specially designed to work together with @p
3066 * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting
3067 * Elementary's main loop when all the windows are hidden.
3070 * @until autohide_set
3072 * @note @p autodel and @a autohide are not mutually exclusive. The
3073 * window will be destructed if both autodel and autohide is set to @p
3074 * EINA_TRUE or @p true.
3076 * Now we construct the elm icon and for this we use the C++ method
3077 * below, setting it's parent. An icon object is used to display
3078 * standard icon images ("delete", "edit", "arrows", etc.) or images
3079 * coming from a custom file (PNG, JPG, EDJE, etc.), on icon contexts.
3081 * @skipline ::elm::icon
3083 * The icon image requested can be in the Elementary theme in use, or
3084 * in the freedesktop.org theme paths. It's possible to set the order
3085 * of preference from where an image will be fetched and for that
3086 * we'll use the function @ order_lookup_set(order_) that will be use
3087 * by standard_set. Possibles values for @p order_ are:
3089 * @li @p ELM_ICON_LOOKUP_FDO_THEME: icon look up order is freedesktop
3092 * @li @p ELM_ICON_LOOKUP_THEME_FDO: icon look up order is theme then
3095 * @li @p ELM_ICON_LOOKUP_FDO: icon look up order is only freedesktop;
3097 * @li @p ELM_ICON_LOOKUP_THEME: icon look up order is only theme;
3101 * Now that we setted the order value we can set the standard "home"
3102 * icon, chosen for this example.
3104 * @skipline standard
3106 * An interesting thing is that after setting this, it's possible to
3107 * check where in the filesystem is the theme used by this icon, and
3108 * the name of the group used, using file_get.
3113 * We can also get the name of the standard icon that we setted
3119 * We can now go setting our options.
3121 * no_scale_set() is used just to set this value to true as we don't
3122 * actually want to scale our icon, just resize it.
3124 * resizable_set() is used to allow the icon to be resized to a size
3125 * smaller than the original one, but not to a size bigger than it.
3127 * smooth_set() will disable the smooth scaling, so the scale
3128 * algorithm used to scale the icon to the new object size is going to
3129 * be faster, but with a lower quality.
3131 * fill_outside_set() is used to ensure that the icon will fill the
3132 * entire area available to it, even if keeping the aspect ratio. The
3133 * icon will overflow its width or height (any of them that is
3134 * necessary) to the object area, instead of resizing the icon down
3135 * until it can fit entirely in this area.
3137 * This is the code for setting these options:
3139 * @until fill_outside
3141 * However, if you try this example you may notice that this image is
3142 * not being affected by all of these options. This happens because
3143 * the used icon will be from elementary theme, and thus it has its
3144 * own set of options like smooth scaling and fill_outside
3145 * options. You can change the "home" icon to use some image (from
3146 * your system) and see that then those options will be respected.
3148 * To better understand, the function @c size_hint_weight_set for C++
3149 * bindings originated from C bindings function
3150 * evas_object_size_hint_weight_set, that is EFL Evas type function.
3151 * With this function we set the hints for an object's weight. The
3154 * @li x - Nonnegative double value to use as horizontal weight hint.
3156 * @li y - Nonnegative double value to use as vertical weight hint.
3158 * This is not a size enforcement in any way, it's just a hint that
3159 * should be used whenever appropriate.
3161 * This is a hint on how a container object should resize a given
3162 * child within its area.
3164 * Containers may adhere to the simpler logic of just expanding the
3165 * child object's dimensions to fit its own (see the EVAS_HINT_EXPAND
3166 * helper weight macro in the EFL Evas Documentation) or the complete
3167 * one of taking each child's weight hint as real weights to how much
3168 * of its size to allocate for them in each axis. A container is
3169 * supposed to, after normalizing the weights of its children (with
3170 * weight hints), distribute the space it has to layout them by those
3171 * factors – most weighted children get larger in this process than
3174 * @skipline weight_set
3176 * @note Default weight hint values are 0.0, for both axis.
3178 * Now we add the icon as a resize_object to win informing that
3179 * when the size of the win changes so should the icon's
3180 * size. And finally we make icon visible.
3182 * Now we set the size for the window, making it visible in the end:
3185 * @until visibility_set
3187 * Finally we just have to start the elm mainloop, starting to handle
3188 * events and drawing operations.
3193 * The full code for this example can be found at @ref icon_cxx_example_01.cc
3195 * This example will look like this:
3197 * @image html screenshots/icon_cxx_example_01.png
3198 * @image latex screenshots/icon_cxx_example_01.eps width=\textwidth
3200 * @example icon_cxx_example_01.cc
3204 * @page location_cxx_example_01 Location example with C++ Binding
3205 * @dontinclude location_cxx_example_01.cc
3207 * This example shows how to integrate the Elocation.h library with
3210 * The first part consists of including the headers. In this case we
3211 * need to include both Elementary C++ binding and Elocation,
3213 * @skip Elementary.hh
3216 * @attention All necessary libraries from Elementary, Elightenment, C
3217 * and/or C++ headers should be include here.
3219 * Before our main code, we need a set of callbacks to react on
3220 * incoming elocation events. They are standard ecore events and we
3221 * register callbacks on these events in the main function.
3224 * @until ECORE_CALLBACK_DONE
3227 * Now we need to actually start the code and initializing pointers
3228 * for address, addr_geocode, position and pos_geocode and an integer
3229 * status. We also run a check for elm_need_elocation.
3234 * Now let's set the elm_policy, which defines for a given policy
3235 * group/identifier a new policy's value, respectively. In this
3236 * example the only policy we need to set a value for is @c
3237 * ELM_POLICY_QUIT, possibles values for it are:
3239 * @li @p ELM_POLICY_QUIT_NONE: Never quit the application
3242 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the
3243 * application's last window is closed;
3245 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the
3246 * application's last window is hidden;
3248 * @skipline elm_policy_set
3250 * As you can see, the policy we chose was to quit when the last win
3251 * is hidden as opose to examples with the C bindings where we
3252 * perpetually set it to quit when last win was closed. This changed
3253 * was necessary because in C++ binding as the elm mainloop stop
3254 * running all object are destroyed, references are unreferenced and
3255 * events are stopped at ELM_MAIN().
3257 * @see For more details consult elm_policy_set
3259 * Next step is creating an elementary window, in this example we use
3260 * the C++ binding method with the elm_win_util_standard_add that is a
3261 * elm_win_legacy function, better explained below. And then we set
3262 * the autohide state for it.
3264 * @p elm_win_util_standard_add (const char *name, const char *tittle)
3265 * Adds a window object with standard setup.
3268 * @li @p name - The name of the window;
3270 * @li @p title - The title for the window.
3272 * This creates a window but also puts in a standard background with
3273 * @p elm_bg_add(), as well as setting the window title to @p
3274 * title. The window type created is of type @c ELM_WIN_BASIC, with
3275 * the @c NULL as the parent widget. Returns the created object or @c
3278 * The autohide works similarly to @p autodel, automatically handling
3279 * "delete,request" signals when set to @p true, with the difference
3280 * that it will hide the window, instead of destroying it.
3282 * It is specially designed to work together with @p
3283 * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting
3284 * Elementary's main loop when all the windows are hidden.
3287 * @until autohide_set
3289 * @note @p autodel and @a autohide are not mutually exclusive. The
3290 * window will be destructed if both autodel and autohide is set to @p
3291 * EINA_TRUE or @p true.
3293 * For this example we're using a label that will display the text
3294 * "Getting location ...". First we'll create our label, setting it's
3295 * parent, then setting the following label's options:
3297 * @li @p line_wrap_set: Set the wrapping behavior of the label, by
3298 * default no wrapping is done. Possible values for wrap are:
3299 * @p ELM_WRAP_NONE - No wrapping;
3300 * @p ELM_WRAP_CHAR - wrap between characters;
3301 * @p ELM_WRAP_WORD - wrap between words;
3302 * @p ELM_WRAP_MIXED - Word wrap, and if that fails, char wrap.
3306 * @li @p text_set: Set the text that label will display.
3310 * @li @p slide_mode_set: Set the slide mode of the label widget. By
3311 * default, slide mode is none. Possible values for mode are:
3313 * ELM_LABEL_SLIDE_MODE_NONE - no slide effect
3315 * ELM_LABEL_SLIDE_MODE_AUTO - slide only if the label area is bigger
3316 * than the text width length
3318 * ELM_LABEL_SLIDE_MODE_ALWAYS -slide always
3320 * @attention ELM_LABEL_SLIDE_MODE_AUTO, ELM_LABEL_SLIDE_MODE_ALWAYS
3321 * only work with the themes "slide_short", "slide_long" and
3322 * "slide_bounce". ELM_LABEL_SLIDE_MODE_AUTO,
3323 * ELM_LABEL_SLIDE_MODE_ALWAYS don't work if the line
3324 * wrap(elm_label_line_wrap_set()) or
3325 * ellipsis(elm_label_ellipsis_set()) is set.
3329 * To better understand, the function @c size_hint_weight_set for C++
3330 * bindings originated from C bindings function
3331 * evas_object_size_hint_weight_set, that is EFL Evas type function.
3332 * With this function we set the hints for an object's weight. The
3335 * @li x - Nonnegative double value to use as horizontal weight hint.
3337 * @li y - Nonnegative double value to use as vertical weight hint.
3339 * This is not a size enforcement in any way, it's just a hint that
3340 * should be used whenever appropriate. This is a hint on how a
3341 * container object should resize a given child within its area.
3343 * Containers may adhere to the simpler logic of just expanding the
3344 * child object's dimensions to fit its own (see the EVAS_HINT_EXPAND
3345 * helper weight macro in the EFL Evas Documentation) or the complete
3346 * one of taking each child's weight hint as real weights to how much
3347 * of its size to allocate for them in each axis. A container is
3348 * supposed to, after normalizing the weights of its children (with
3349 * weight hints), distribute the space it has to layout them by those
3350 * factors – most weighted children get larger in this process than
3353 * @dontinclude location_cxx_example_01.cc
3354 * @skipline weight_set
3356 * @note Default weight hint values are 0.0, for both axis.
3358 * The function @c size_hint_align_set for C++ bindings originated
3359 * from C bindings function evas_object_size_hint_align_set, that is
3360 * EFL Evas type function. With this function we set the hints for an
3361 * object's alignment. The parameters are:
3363 * @li x - Double, ranging from 0.0 to 1.0 or with the special value
3364 * EVAS_HINT_FILL, to use as horizontal alignment hint.
3366 * @li y - Double, ranging from 0.0 to 1.0 or with the special value
3367 * EVAS_HINT_FILL, to use as vertical alignment hint.
3369 * These are hints on how to align an object inside the boundaries of
3370 * a container/manager. Accepted values are in the 0.0 to 1.0 range,
3371 * with the special value EVAS_HINT_FILL used to specify "justify" or
3372 * "fill" by some users. In this case, maximum size hints should be
3373 * enforced with higher priority, if they are set. Also, any padding
3374 * hint set on objects should add up to the alignment space on the
3375 * final scene composition.
3377 * For the horizontal component, 0.0 means to the left, 1.0 means to
3378 * the right. Analogously, for the vertical component, 0.0 to the top,
3379 * 1.0 means to the bottom.
3381 * This is not a size enforcement in any way, it's just a hint that
3382 * should be used whenever appropriate.
3384 * @note Default alignment hint values are 0.5, for both axis.
3386 * @skipline align_set
3388 * Setting the size for label and make it visible.
3393 * Going back to our elocation, first we'll create an address
3394 * and position object that we'll use for all our operations.
3399 * We also have to register our callback so we get updates later on.
3403 * Now we need to get the elocation position and print it, using our
3404 * label. This fills in the object with the data from GeoClue.
3409 * Now we only have to set the size for our window and make it
3413 * @until visibility_set
3415 * And finally, start the elm mainloop, starting to handle events and
3416 * drawing operations.
3421 * The full code for this example can be found at @ref location_cxx_example_01.cc
3423 * @example location_cxx_example_01.cc
3428 * @page menu_cxx_example_01 Menu Example with C++ Binding
3429 * @dontinclude menu_cxx_example_01.cc
3431 * This example shows how to create a menu with regular items, object
3432 * items, submenus and how to delete items from a menu.
3434 * The first part consists of including the headers. We'll include @p
3435 * Elementary.hh, @p Eina.hh and @p Evas.hh, that are C++ bindings
3436 * that are needed in this example.
3441 * Starting the main code and initializing Eina C++ Lybrary, always
3442 * initiate Eina when included. We'll also initialize a couple of
3448 * Now let's set the elm_policy, which defines for a given policy
3449 * group/identifier a new policy's value, respectively. In this
3450 * example the only policy we need to set a value for is @c
3451 * ELM_POLICY_QUIT, possibles values for it are:
3453 * @li @p ELM_POLICY_QUIT_NONE: Never quit the application
3456 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the
3457 * application's last window is closed;
3459 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the
3460 * application's last window is hidden;
3462 * @skipline elm_policy_set
3464 * As you can see, the policy we chose was to quit when the last win
3465 * is hidden as opose to examples with the C bindings where we
3466 * perpetually set it to quit when last win was closed. This changed
3467 * was necessary because in C++ binding as the elm mainloop stop
3468 * running all object are destroyed, references are unreferenced and
3469 * events are stopped at ELM_MAIN().
3471 * @see For more details consult elm_policy_set
3473 * Next step is creating an elementary window, in this example we use
3474 * the C++ binding method with the elm_win_util_standard_add that is a
3475 * elm_win_legacy function, better explained below. And then we set
3476 * the autohide state for it.
3478 * @p elm_win_util_standard_add (const char *name, const char *tittle)
3479 * Adds a window object with standard setup.
3482 * @li @p name - The name of the window;
3484 * @li @p title - The title for the window.
3486 * This creates a window but also puts in a standard background with
3487 * @p elm_bg_add(), as well as setting the window title to @p
3488 * title. The window type created is of type @c ELM_WIN_BASIC, with
3489 * the @c NULL as the parent widget. Returns the created object or @c
3492 * The autohide works similarly to @p autodel, automatically handling
3493 * "delete,request" signals when set to @p true, with the difference
3494 * that it will hide the window, instead of destroying it.
3496 * It is specially designed to work together with @p
3497 * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting
3498 * Elementary's main loop when all the windows are hidden.
3501 * @until autohide_set
3503 * @note @p autodel and @a autohide are not mutually exclusive. The
3504 * window will be destructed if both autodel and autohide is set to @p
3505 * EINA_TRUE or @p true.
3507 * Next we'll create a evas::rectangle to use as the icon of our menu
3508 * for thus using the C++ method, adding our rect as a resize-object
3509 * to win informing that when the size of the win changes so should
3515 * We'll also set, for rect, the hint for it's minimum size, it's
3516 * color and making it visible.
3521 * Creating the menu using the C++ method, setting it's parent and
3522 * adding an item to this menu. We are going to add more items, but
3523 * these icons are going to have a parent, which will put them in a
3529 * We'll add a button to a menu_item, where this button will delete
3530 * the first item of our sub-menu when clicked, we'll do this
3531 * using @p elm_object_item_content_set().
3534 * @until content_set
3536 * Now, for the callback that will be used in this button we're use
3537 * lambda type function and then add as clicked callback to button.
3542 * @see To learn more about consult @ref lambda.
3544 * We now add a separator and three more regular items:
3550 * We now add another item, however this time it won't go the sub-menu
3551 * and it'll be disabled:
3553 * @until disabled_set
3555 * To make sure that our menu is shown whenever the window is
3556 * clicked, we use the following callback, also lambda:
3561 * Finally. we just make menu visible, set a size for our window
3562 * making it visible and then start the elm mainloop, starting to
3563 * handle events and drawing operations.
3568 * Our example will look like this:
3570 * @image html screenshots/menu_cxx_example_01.png
3571 * @image latex screenshots/menu_cxx_example_01.eps width=\textwidth
3573 * @example menu_cxx_example_01.cc
3577 * @page popup_cxx_example_01 Popup example with C++ Binding
3578 * @dontinclude popup_cxx_example_01.cc
3580 * The first part consists of including the headers. In this
3581 * case we are only working with the Elementary C++ binding and thus
3582 * we need only to include him.
3584 * @skipline Elementary.hh
3586 * @attention If necessary the C and/or the C++ headers should be
3587 * include here as well.
3589 * Now we need to actually start the code and set the elm_policy,
3590 * which defines for a given policy group/identifier a new policy's
3591 * value, respectively. In this example the only policy we need to
3592 * set a value for is @c ELM_POLICY_QUIT, possibles values for it are:
3594 * @li @p ELM_POLICY_QUIT_NONE: Never quit the application
3597 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the
3598 * application's last window is closed;
3600 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the
3601 * application's last window is hidden;
3604 * @until elm_policy_set
3606 * As you can see, the policy we chose was to quit when the last win
3607 * is hidden as opose to examples with the C bindings where we
3608 * perpetually set it to quit when last win was closed. This changed
3609 * was necessary because in C++ binding as the elm mainloop stop
3610 * running all object are destroyed, references are unreferenced and
3611 * events are stopped at ELM_MAIN().
3613 * @see For more details consult elm_policy_set
3615 * Next step is creating an Elementary window, in this example we use
3616 * the C++ binding method with the elm_win_util_standard_add that is a
3617 * elm_win_legacy function, better explained below. And then we set
3618 * the autohide state for it.
3620 * @p elm_win_util_standard_add (const char *name, const char *tittle)
3621 * Adds a window object with standard setup.
3625 * @li @p name - The name of the window;
3627 * @li @p title - The title for the window.
3629 * This creates a window but also puts in a standard background with
3630 * @p elm_bg_add(), as well as setting the window title to @p
3631 * title. The window type created is of type @c ELM_WIN_BASIC, with
3632 * the @c NULL as the parent widget. Returns the created object or @c
3635 * The autohide works similarly to @p autodel, automatically handling
3636 * "delete,request" signals when set to @p true, with the difference
3637 * that it will hide the window, instead of destroying it.
3639 * It is specially designed to work together with @p
3640 * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting
3641 * Elementary's main loop when all the windows are hidden.
3644 * @until autohide_set
3646 * @note @p autodel and @a autohide are not mutually exclusive. The
3647 * window will be destructed if both autodel and autohide is set to @p
3648 * EINA_TRUE or @p true.
3650 * Now let's create the label with the C++ binding method, passing our
3651 * window object as parent. We'll also set to this label the text that
3652 * we'll use later on the popup.
3657 * Using the same method we'll create our popup passing our window
3658 * object as parent. We'll also set the timeout to 3.0 seconds, label
3659 * as content, the title and visibility true for our popup.
3664 * Our popup will hide every time the lambda type function is called.
3665 * The lambda function get the popup object by reference and set it's
3666 * visibility to false, making it invisible. In this example we are
3667 * using @a std::bind to bind the parameters of our lambda function to
3668 * return as @a std::function object to popup_hide which was declare
3674 * To learn more consult @ref lambda.
3676 * In this example we'll add the popup_hide in the timeout callback
3677 * and the block_clicked callback. This results in hiding the popup in
3678 * maximum of 3.0 seconds or when the popup block is clicked.
3683 * Finally we just have to make our window visible and set it's size,
3684 * then run the elm mainloop, starting to handle events and drawing
3690 * This example will initially look like this:
3692 * @image html screenshots/popup_cxx_example_01.png
3693 * @image latex screenshots/popup_cxx_example_01.eps width=\textwidth
3695 * Once the popup is hidden after timeout:
3697 * @image html screenshots/popup_cxx_example_01_a.png
3698 * @image latex screenshots/popup_cxx_example_01_a.eps width=\textwidth
3700 * @example popup_cxx_example_01.cc
3704 * @page radio_cxx_example_01 Radio example with C++ Binding
3705 * @dontinclude radio_cxx_example_01.cc
3707 * In this example we will create 4 radios, and add them to the same
3708 * group. We will also have the radios in the group change the value
3709 * of a variable directly and have then print it when the value
3712 * The first part consists of including the headers. In this
3713 * case we are only working with the Elementary C++ binding and thus
3714 * we need only to include him.
3716 * @skipline Elementary.hh
3718 * @attention If necessary the C and/or the C++ headers should be
3719 * include here as well.
3721 * Now we need to actually start the code and set the elm_policy,
3722 * which defines for a given policy group/identifier a new policy's
3723 * value, respectively. In this example the only policy we need to
3724 * set a value for is @c ELM_POLICY_QUIT, possibles values for it are:
3726 * @li @p ELM_POLICY_QUIT_NONE: Never quit the application
3729 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the
3730 * application's last window is closed;
3732 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the
3733 * application's last window is hidden;
3736 * @until elm_policy_set
3738 * As you can see, the policy we chose was to quit when the last win
3739 * is hidden as opose to examples with the C bindings where we
3740 * perpetually set it to quit when last win was closed. This changed
3741 * was necessary because in C++ binding as the elm mainloop stop
3742 * running all object are destroyed, references are unreferenced and
3743 * events are stopped at ELM_MAIN().
3745 * @see For more details consult elm_policy_set
3747 * And move right to declaring a static variable, the one whose value
3748 * the radios will change:
3752 * Next step is creating an Elementary window, in this example we use
3753 * the C++ binding method with the elm_win_util_standard_add that is a
3754 * elm_win_legacy function, better explained below. And then we set
3755 * the autohide state for it.
3757 * @p elm_win_util_standard_add (const char *name, const char *tittle)
3758 * Adds a window object with standard setup.
3762 * @li @p name - The name of the window;
3764 * @li @p title - The title for the window.
3766 * This creates a window but also puts in a standard background with
3767 * @p elm_bg_add(), as well as setting the window title to @p
3768 * title. The window type created is of type @c ELM_WIN_BASIC, with
3769 * the @c NULL as the parent widget. Returns the created object or @c
3772 * The autohide works similarly to @p autodel, automatically handling
3773 * "delete,request" signals when set to @p true, with the difference
3774 * that it will hide the window, instead of destroying it.
3776 * It is specially designed to work together with @p
3777 * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting
3778 * Elementary's main loop when all the windows are hidden.
3781 * @until autohide_set
3783 * @note @p autodel and @a autohide are not mutually exclusive. The
3784 * window will be destructed if both autodel and autohide is set to @p
3785 * EINA_TRUE or @p true.
3787 * A box arranges objects in a linear fashion, governed by a layout
3788 * function that defines the details of this arrangement. The box will
3789 * use an internal function to set the layout to a single row,
3790 * vertical by default.
3792 * Now let's create the box with the C++ binding method, passing our
3793 * window object as parent and then setting box's layout as
3796 * @skipline elm::box
3799 * To better understand, the function @c size_hint_weight_set for C++
3800 * bindings originated from C bindings function
3801 * evas_object_size_hint_weight_set, that is EFL Evas type function.
3802 * With this function we set the hints for an object's weight. The
3805 * @li x - Nonnegative double value to use as horizontal weight hint.
3807 * @li y - Nonnegative double value to use as vertical weight hint.
3809 * This is not a size enforcement in any way, it's just a hint that
3810 * should be used whenever appropriate. This is a hint on how a
3811 * container object should resize a given child within its area.
3813 * Containers may adhere to the simpler logic of just expanding the
3814 * child object's dimensions to fit its own (see the EVAS_HINT_EXPAND
3815 * helper weight macro in the EFL Evas Documentation) or the complete
3816 * one of taking each child's weight hint as real weights to how much
3817 * of its size to allocate for them in each axis. A container is
3818 * supposed to, after normalizing the weights of its children (with
3819 * weight hints), distribute the space it has to layout them by those
3820 * factors – most weighted children get larger in this process than
3823 * @skipline weight_set
3825 * @note Default weight hint values are 0.0, for both axis.
3827 * Now we add the box as a resize_object to win informing that when
3828 * the size of the win changes so should the box's size. And finally
3829 * we make it visible.
3832 * @until visibility_set
3834 * Radio is a widget that allows for one or more options to be
3835 * displayed and have the user choose only one of them. It contains an
3836 * indicator, an optional label and an optional icon object. While
3837 * it's possible to have a group of only one radio they, are normally
3838 * used in groups of 2 or more.
3840 * We will create the box with the C++ binding method, passing our
3841 * window object as parent and then setting box's layout as
3844 * And now we create a radio with the C++ binding method, passing our
3845 * window object as parent. Since this is the first radio in our group
3846 * we set the group to be the radio, so we can set the other radios in
3852 * We also set the text, then state value of this radio to 1 and
3853 * the value pointer to @p val, since val is @p 1 this has the
3854 * additional effect of setting the radio value to @p 1.
3859 * For this radio we choose the standard home icon, the icon will be
3860 * created with the same method and setting the icon as content of
3866 * When using the elm::box the packing method of the subobj - radio
3867 * in this case - should be defined. There are four possible methods:
3869 * @li @c pack_start(subobj_) - Add an object to the beginning of the
3870 * pack list. Pack @c subobj_ into the box obj, placing it first in
3871 * the list of children objects. The actual position the object will
3872 * get on screen depends on the layout used. If no custom layout is
3873 * set, it will be at the top or left, depending if the box is
3874 * vertical or horizontal, respectively.
3876 * @li @c pack_end(subobj_) - Add an object at the end of the pack
3877 * list. Pack @c subobj_ into the box obj, placing it last in the list
3878 * of children objects. The actual position the object will get on
3879 * screen depends on the layout used. If no custom layout is set, it
3880 * will be at the bottom or right, depending if the box is vertical or
3881 * horizontal, respectively.
3883 * @li @c pack_before(subobj_, before_) - Adds an object to the box
3884 * before the indicated object. This will add the @c subobj_ to the
3885 * box indicated before the object indicated with @c before_. If
3886 * before is not already in the box, results are undefined. Before
3887 * means either to the left of the indicated object or above it
3888 * depending on orientation.
3890 * @li @c pack_after(subobj_, after_) - Adds an object to the box
3891 * after the indicated object. This will add the @c subobj_ to the box
3892 * indicated after the object indicated with @c after_. If after is
3893 * not already in the box, results are undefined. After means either
3894 * to the right of the indicated object or below it depending on
3897 * In this and most examples we use pack_end by choice and
3900 * @skipline pack_end
3902 * The function size_hint_weight_set works with radio the same way
3903 * as with box, as above.
3905 * @skipline weight_set
3907 * The function @c size_hint_align_set for C++ bindings originated
3908 * from C bindings function evas_object_size_hint_align_set, that is
3909 * EFL Evas type function. With this function we set the hints for an
3910 * object's alignment. The parameters are:
3912 * @li x - Double, ranging from 0.0 to 1.0 or with the special value
3913 * EVAS_HINT_FILL, to use as horizontal alignment hint.
3915 * @li y - Double, ranging from 0.0 to 1.0 or with the special value
3916 * EVAS_HINT_FILL, to use as vertical alignment hint.
3918 * These are hints on how to align an object inside the boundaries of
3919 * a container/manager. Accepted values are in the 0.0 to 1.0 range,
3920 * with the special value EVAS_HINT_FILL used to specify "justify" or
3921 * "fill" by some users. In this case, maximum size hints should be
3922 * enforced with higher priority, if they are set. Also, any padding
3923 * hint set on objects should add up to the alignment space on the
3924 * final scene composition.
3926 * For the horizontal component, 0.0 means to the left, 1.0 means to
3927 * the right. Analogously, for the vertical component, 0.0 to the top,
3928 * 1.0 means to the bottom.
3930 * This is not a size enforcement in any way, it's just a hint that
3931 * should be used whenever appropriate.
3933 * @skipline align_set
3935 * @note Default alignment hint values are 0.5, for both axis.
3937 * To end the settings of radio we'll make it visible and with our
3938 * lambda type function we output the current value of @p val. In this
3939 * example we are using @a std::bind to bind the parameters of our
3940 * lambda function to return as @a std::function object to @p cb_val
3941 * which was declare as @p auto. Now we just have to add @p cb_val as
3942 * changed radio callback of our radio.
3947 * @see To learn more consult @ref lambda.
3949 * The creation of our second radio is almost identical, using the
3950 * same method we create radio2 passing win as parent. We also set the
3951 * text, then state value of this radio to 2 and the value pointer to
3952 * @p val. This radio will be added in the same group as the first
3958 * Then we set the standard file icon, the icon will be created with
3959 * the same method and then set the icon as content of radio.
3964 * As before, we set packing method of radio2 in the box, the weight,
3965 * alignment and visibility of radio2. Then add cb_val as callback
3966 * when the radio changes.
3971 * For our third and fourth radios we'll omit the icon and set the
3972 * value to 3 and 4, respectively, we'll also add them to the group of
3976 * @until radio4.callback
3978 * Finally we just have to make our window visible and set it's size,
3979 * then run the elm mainloop, starting to handle events and drawing
3985 * The full code for this example can be found at @ref radio_cxx_example_01.cc
3987 * The example will look like this:
3989 * @image html screenshots/radio_cxx_example_01.png
3990 * @image latex screenshots/radio_cxx_example_01.eps width=\textwidth
3992 * @example radio_cxx_example_01.cc
3996 * @page separator_cxx_example_01 Separator with C++ Binding
3997 * @dontinclude separator_cxx_example_01.cc
3999 * Separator is a very thin object used to separate other objects,
4000 * wich can be vertical or horizontal.
4002 * This example shows how to create a window and separate in two
4003 * parts, each one will be filled with a background color to show the
4004 * division. The @a separator is used to visually mark the division
4005 * between two parts.
4007 * The first part consists of including the headers. In this case we
4008 * are only working with the Elementary and Evas C++ bindings.
4010 * @skip Elementary.hh
4013 * @attention If necessary the C and/or the C++ headers should be
4014 * include here as well.
4016 * Now we need to actually start the code and set the elm_policy,
4017 * which defines for a given policy group/identifier a new policy's
4018 * value, respectively. In this example the only policy we need to
4019 * set a value for is @c ELM_POLICY_QUIT, possibles values for it are:
4021 * @li @p ELM_POLICY_QUIT_NONE: Never quit the application
4024 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the
4025 * application's last window is closed;
4027 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the
4028 * application's last window is hidden;
4030 * @n @skip EAPI_MAIN int
4031 * @until elm_policy_set
4033 * As you can see, the policy we chose was to quit when the last win
4034 * is hidden as opose to examples with the C bindings where we
4035 * perpetually set it to quit when last win was closed. This changed
4036 * was necessary because in C++ binding as the elm mainloop stop
4037 * running all object are destroyed, references are unreferenced and
4038 * events at ELM_MAIN() because of this. ??
4040 * @see elm_policy_set()
4042 * Next step is creating an Elementary window, where win calls a
4043 * constructor and sets the type of the win to ELM_WIN_BASIC
4044 * (Elm_Win_Type), which is the indicated type for most of our
4045 * examples. Here we also set the title that will appear at the top of
4046 * our window and then the autohide state for it.
4048 * The autohide works similarly to @p autodel, automatically handling
4049 * "delete,request" signals when set to @p true, with the difference
4050 * that it will hide the window, instead of destroying it.
4052 * It is specially designed to work together with @p
4053 * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting
4054 * Elementary's main loop when all the windows are hidden.
4057 * @until autohide_set
4059 * @note @p autodel and @a autohide are not mutually exclusive. The
4060 * window will be destructed if both autodel and autohide is set to @p
4061 * EINA_TRUE or @p true.
4063 * Now let's create the background with the C++ binding method, passing
4064 * our window as parent.
4068 * The function @c size_hint_weight_set for C++ bindings originated
4069 * from C bindings function evas_object_size_hint_weight_set, that is
4070 * EFL Evas type function. With this function we set the hints for an
4071 * object's weight. The parameters are:
4073 * @li x - Nonnegative double value to use as horizontal weight hint.
4075 * @li y - Nonnegative double value to use as vertical weight hint.
4077 * This is not a size enforcement in any way, it's just a hint that
4078 * should be used whenever appropriate. This is a hint on how a
4079 * container object should resize a given child within its area.
4081 * Containers may adhere to the simpler logic of just expanding the
4082 * child object's dimensions to fit its own (see the EVAS_HINT_EXPAND
4083 * helper weight macro in the EFL Evas Documentation) or the complete
4084 * one of taking each child's weight hint as real weights to how much
4085 * of its size to allocate for them in each axis. A container is
4086 * supposed to, after normalizing the weights of its children (with
4087 * weight hints), distribute the space it has to layout them by those
4088 * factors – most weighted children get larger in this process than
4091 * @skipline weight_set
4093 * @note Default weight hint values are 0.0, for both axis.
4095 * Now we add the background as a resize-object to win informing that
4096 * when the size of the win changes so should the background's size
4097 * and setting it's visibility. You can change the background's color
4098 * using color_set, if not, the default color will be used.
4101 * @until visibility_set
4103 * To put a box in the window we also need to set it's parent. By
4104 * default, box object arranges their contents vertically from top to
4105 * bottom. By calling this function with horizontal as @a true, the
4106 * box will become horizontal, arranging contents from left to right.
4111 * The value that we set EFL Evas function size_hint_weight_set
4112 * expands the box to cover all win's area and adding it as a
4113 * resize_object to win informing that when the size of the win
4114 * changes so should the box's size. In the end we make the box
4120 * Now we create a retangle, like before, we just need to setting it's
4121 * parent. After created, we set the color to show the difference
4122 * between the next rectangle and define the minimun size of each side
4123 * by using size_hint_min_set(minimum width, minimum height).
4128 * As in the background, the value we set EFL Evas function
4129 * size_hint_weight_set expands the background to cover all area
4130 * defined in size_hint_min_set. We also need to expand the rectangle
4131 * to fill the area if the win's size change, if not, win can change
4132 * it's size and the rectangle will only fill it's own previous area.
4136 * The function @c size_hint_align_set for C++ bindings originated
4137 * from C bindings function evas_object_size_hint_align_set, that is
4138 * EFL Evas type function. With this function we set the hints for an
4139 * object's alignment. The parameters are:
4141 * @li x - Double, ranging from 0.0 to 1.0 or with the special value
4142 * EVAS_HINT_FILL, to use as horizontal alignment hint.
4144 * @li y - Double, ranging from 0.0 to 1.0 or with the special value
4145 * EVAS_HINT_FILL, to use as vertical alignment hint.
4147 * These are hints on how to align an object inside the boundaries of
4148 * a container/manager. Accepted values are in the 0.0 to 1.0 range,
4149 * with the special value EVAS_HINT_FILL used to specify "justify" or
4150 * "fill" by some users. In this case, maximum size hints should be
4151 * enforced with higher priority, if they are set. Also, any padding
4152 * hint set on objects should add up to the alignment space on the
4153 * final scene composition.
4155 * For the horizontal component, 0.0 means to the left, 1.0 means to
4156 * the right. Analogously, for the vertical component, 0.0 to the top,
4157 * 1.0 means to the bottom.
4159 * This is not a size enforcement in any way, it's just a hint that
4160 * should be used whenever appropriate.
4162 * @skipline align_set
4164 * @note Default alignment hint values are 0.5, for both axis.
4166 * Now we only need to set the visibility of the rectangle and add our
4167 * retangle to box with the packing method of the subobj - rectangle
4168 * in this case. There are four possible methods:
4170 * @li @c pack_start(subobj_) - Add an object to the beginning of the
4171 * pack list. Pack @c subobj_ into the box obj, placing it first in
4172 * the list of children objects. The actual position the object will
4173 * get on screen depends on the layout used. If no custom layout is
4174 * set, it will be at the top or left, depending if the box is
4175 * vertical or horizontal, respectively.
4177 * @li @c pack_end(subobj_) - Add an object at the end of the pack
4178 * list. Pack @c subobj_ into the box obj, placing it last in the list
4179 * of children objects. The actual position the object will get on
4180 * screen depends on the layout used. If no custom layout is set, it
4181 * will be at the bottom or right, depending if the box is vertical or
4182 * horizontal, respectively.
4184 * @li @c pack_before(subobj_, before_) - Adds an object to the box
4185 * before the indicated object. This will add the @c subobj_ to the
4186 * box indicated before the object indicated with @c before_. If
4187 * before is not already in the box, results are undefined. Before
4188 * means either to the left of the indicated object or above it
4189 * depending on orientation.
4191 * @li @c pack_after(subobj_, after_) - Adds an object to the box
4192 * after the indicated object. This will add the @c subobj_ to the box
4193 * indicated after the object indicated with @c after_. If after is
4194 * not already in the box, results are undefined. After means either
4195 * to the right of the indicated object or below it depending on
4198 * In this and most examples we use pack_end by choice and
4199 * practicality. In this part of the code we also make rectangle
4205 * Once we have our first rectangle in the box we create and add our
4206 * separator. Using the same approach, we setting it's parent. Since
4207 * our box is in horizontal mode it's a good idea to set the separator
4208 * to be horizontal too. Finishing with the visibility and packing
4211 * @skip elm::separator
4214 * After all this, we just need to create another rectangle, setting
4215 * the color, size hints, make rect2 visible and packing in the
4216 * box. Don't forget to set the win's visibility as true.
4219 * @until win.visibility
4221 * Finally we just have to start the elm mainloop, starting to handle
4222 * events and drawing operations.
4227 * The full code for this example can be found at @ref separator_cxx_example_01.cc .
4229 * This example will look like:
4231 * @image html screenshots/separator_cxx_example_01.png
4232 * @image latex screenshots/separator_cxx_example_01.eps width=\textwidth
4234 * @example separator_cxx_example_01.cc
4238 * @page slider_cxx_example Slider widget example with C++ Binding
4239 * @dontinclude slider_cxx_example.cc
4241 * This code places seven Elementary slider widgets on a window, each of
4242 * them exemplifying a part of the widget's API.
4244 * The first part consists of including the headers. In this
4245 * case we are only working with the Elementary C++ binding and thus
4246 * we need only to include him.
4248 * @skipline Elementary.hh
4250 * @attention If necessary the C and/or the C++ headers should be
4251 * include here as well.
4253 * Now we need to actually start the code and set the elm_policy,
4254 * which defines for a given policy group/identifier a new policy's
4255 * value, respectively. In this example the only policy we need to
4256 * set a value for is @c ELM_POLICY_QUIT, possibles values for it are:
4258 * @li @p ELM_POLICY_QUIT_NONE: Never quit the application
4261 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the
4262 * application's last window is closed;
4264 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the
4265 * application's last window is hidden;
4268 * @until elm_policy_set
4270 * As you can see, the policy we chose was to quit when the last win
4271 * is hidden as opose to examples with the C bindings where we
4272 * perpetually set it to quit when last win was closed. This changed
4273 * was necessary because in C++ binding as the elm mainloop stop
4274 * running all object are destroyed, references are unreferenced and
4275 * events are stopped at ELM_MAIN().
4277 * @see For more details consult elm_policy_set
4279 * Next step is creating an Elementary window, in this example we use
4280 * the C++ binding method with the elm_win_util_standard_add that is a
4281 * elm_win_legacy function, better explained below. And then we set
4282 * the autohide state for it.
4284 * @p elm_win_util_standard_add (const char *name, const char *tittle)
4285 * Adds a window object with standard setup.
4289 * @li @p name - The name of the window;
4291 * @li @p title - The title for the window.
4293 * This creates a window but also puts in a standard background with
4294 * @p elm_bg_add(), as well as setting the window title to @p
4295 * title. The window type created is of type @c ELM_WIN_BASIC, with
4296 * the @c NULL as the parent widget. Returns the created object or @c
4299 * The autohide works similarly to @p autodel, automatically handling
4300 * "delete,request" signals when set to @p true, with the difference
4301 * that it will hide the window, instead of destroying it.
4303 * It is specially designed to work together with @p
4304 * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting
4305 * Elementary's main loop when all the windows are hidden.
4308 * @until autohide_set
4310 * @note @p autodel and @a autohide are not mutually exclusive. The
4311 * window will be destructed if both autodel and autohide is set to @p
4312 * EINA_TRUE or @p true.
4314 * Now let's create a box with the C++ binding method, passing our
4315 * window object as parent, we'll use this box to contain our slider
4320 * To better understand, the function @c size_hint_weight_set for C++
4321 * bindings originated from C bindings function
4322 * evas_object_size_hint_weight_set, that is EFL Evas type function.
4323 * With this function we set the hints for an object's weight. The
4326 * @li x - Nonnegative double value to use as horizontal weight hint.
4328 * @li y - Nonnegative double value to use as vertical weight hint.
4330 * This is not a size enforcement in any way, it's just a hint that
4331 * should be used whenever appropriate. This is a hint on how a
4332 * container object should resize a given child within its area.
4334 * Containers may adhere to the simpler logic of just expanding the
4335 * child object's dimensions to fit its own (see the EVAS_HINT_EXPAND
4336 * helper weight macro in the EFL Evas Documentation) or the complete
4337 * one of taking each child's weight hint as real weights to how much
4338 * of its size to allocate for them in each axis. A container is
4339 * supposed to, after normalizing the weights of its children (with
4340 * weight hints), distribute the space it has to layout them by those
4341 * factors – most weighted children get larger in this process than
4344 * @skipline weight_set
4346 * @note Default weight hint values are 0.0, for both axis.
4348 * Then we add the box as a resize-object to win informing that when
4349 * the size of the win changes so should the box's size. Remember
4350 * always to set the box visibility to true.
4355 * Now we'll create our slider, using the C++ binding method and set
4356 * it's size hint that works with slider the same way as with box, for
4357 * more, look above. This is the default slider.
4362 * The function @c size_hint_align_set for C++ bindings originated
4363 * from C bindings function evas_object_size_hint_align_set, that is
4364 * EFL Evas type function. With this function we set the hints for an
4365 * object's alignment. The parameters are:
4367 * @li x - Double, ranging from 0.0 to 1.0 or with the special value
4368 * EVAS_HINT_FILL, to use as horizontal alignment hint.
4370 * @li y - Double, ranging from 0.0 to 1.0 or with the special value
4371 * EVAS_HINT_FILL, to use as vertical alignment hint.
4373 * These are hints on how to align an object inside the boundaries of
4374 * a container/manager. Accepted values are in the 0.0 to 1.0 range,
4375 * with the special value EVAS_HINT_FILL used to specify "justify" or
4376 * "fill" by some users. In this case, maximum size hints should be
4377 * enforced with higher priority, if they are set. Also, any padding
4378 * hint set on objects should add up to the alignment space on the
4379 * final scene composition.
4381 * For the horizontal component, 0.0 means to the left, 1.0 means to
4382 * the right. Analogously, for the vertical component, 0.0 to the top,
4383 * 1.0 means to the bottom.
4385 * This is not a size enforcement in any way, it's just a hint that
4386 * should be used whenever appropriate.
4390 * @note Default alignment hint values are 0.5, for both axis.
4392 * When using the elm box the packing method of the subobj - slider
4393 * in this case - should be defined. There are four possible methods:
4395 * @li @c pack_start(subobj_) - Add an object to the beginning of the
4396 * pack list. Pack @c subobj_ into the box obj, placing it first in
4397 * the list of children objects. The actual position the object will
4398 * get on screen depends on the layout used. If no custom layout is
4399 * set, it will be at the top or left, depending if the box is
4400 * vertical or horizontal, respectively.
4402 * @li @c pack_end(subobj_) - Add an object at the end of the pack
4403 * list. Pack @c subobj_ into the box obj, placing it last in the list
4404 * of children objects. The actual position the object will get on
4405 * screen depends on the layout used. If no custom layout is set, it
4406 * will be at the bottom or right, depending if the box is vertical or
4407 * horizontal, respectively.
4409 * @li @c pack_before(subobj_, before_) - Adds an object to the box
4410 * before the indicated object. This will add the @c subobj_ to the
4411 * box indicated before the object indicated with @c before_. If
4412 * before is not already in the box, results are undefined. Before
4413 * means either to the left of the indicated object or above it
4414 * depending on orientation.
4416 * @li @c pack_after(subobj_, after_) - Adds an object to the box
4417 * after the indicated object. This will add the @c subobj_ to the box
4418 * indicated after the object indicated with @c after_. If after is
4419 * not already in the box, results are undefined. After means either
4420 * to the right of the indicated object or below it depending on
4423 * In this and most examples we use pack_end by choice and
4424 * practicality, in this part of the code we also make slider visible.
4429 * As you see, the defaults for a slider are:
4432 * @li no values on indicator or unit labels
4434 * Actually it's pretty useless this way. So let's learn how to
4437 * Creating the second slider, the difference being that we set a text
4443 * Creating the first icon as standard "home" and not resizable and
4444 * finally add icon as content for the second slider.
4449 * Our second icon is the standard "folder", also not resizable and
4450 * with add it also to the second slider.
4455 * The same as before, the size hints weight, align will be setted and
4456 * the packing method for the second slider. Also making it visible.
4461 * If the bar size need to be changed, it can be done with span set function,
4462 * that doesn't accounts other widget's parts size. Also the bar can starts
4463 * with a not default value (0.0), as we done on third slider:
4468 * So far, users won't be able to see the slider value. If it's required,
4469 * it can be displayed in two different areas, units label or above
4472 * Let's place a units label on our widget, and also let's set minimum and
4473 * maximum value, by default it uses 0.0 and 1.0:
4478 * If above the indicator is the place to display the value, just set
4479 * it. Also, is possible to invert a bar, as you can see:
4484 * But if you require to use a function a bit more customized to show
4485 * the value, is possible to registry a callback function that will be
4486 * called to display unit or indicator label. For this we suggest you
4487 * use a lambda type function.
4492 * In this case, a function to free this will be required, also a
4497 * @see To learn more consult @ref lambda.
4499 * Now we add our two labdas as indicators for our sixth slider and
4500 * set the hints, packing method and visibility for our slider.
4505 * For our seventh slider we'll show that slider can also be displayed
4511 * Finally the last slider will exemplify how to listen to slider's
4512 * signals, <tt> changed </tt> and <tt> delay,changed </tt>. First we
4513 * need to implement callback functions that will simply print
4514 * slider's value, using lambda again:
4520 * The first callback function should be called everytime value changes,
4521 * the second one only after user stops to increment or decrement. Try
4522 * to keep arrows pressed and check the difference.
4525 * @until callback_delay
4527 * Finally we just have to make our window visible. Then run the elm
4528 * mainloop, starting to handle events and drawing operations.
4533 * See the full @ref slider_cxx_example.cc "example", whose window should
4534 * look like this picture:
4536 * @image html screenshots/slider_cxx_example.png
4537 * @image latex screenshots/slider_cxx_example.eps width=\textwidth
4539 * @example slider_cxx_example.cc
4543 * @page spinner_cxx_example Spinner widget example with C++ Binding
4544 * @dontinclude spinner_cxx_example.cc
4546 * This code places seven Elementary spinner widgets on a window, each of
4547 * them exemplifying a part of the widget's API.
4549 * The first part consists of including the headers. In this
4550 * case we are only working with the Elementary C++ binding and thus
4551 * we need only to include him.
4553 * @skipline Elementary.hh
4555 * @attention If necessary the C and/or the C++ headers should be
4556 * include here as well.
4558 * Now we need to actually start the code and set the elm_policy,
4559 * which defines for a given policy group/identifier a new policy's
4560 * value, respectively. In this example the only policy we need to
4561 * set a value for is @c ELM_POLICY_QUIT, possibles values for it are:
4563 * @li @p ELM_POLICY_QUIT_NONE: Never quit the application
4566 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the
4567 * application's last window is closed;
4569 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the
4570 * application's last window is hidden;
4573 * @until elm_policy_set
4575 * As you can see, the policy we chose was to quit when the last win
4576 * is hidden as opose to examples with the C bindings where we
4577 * perpetually set it to quit when last win was closed. This changed
4578 * was necessary because in C++ binding as the elm mainloop stop
4579 * running all object are destroyed, references are unreferenced and
4580 * events are stopped at ELM_MAIN().
4582 * @see For more details consult elm_policy_set
4584 * Next step is creating an Elementary window, in this example we use
4585 * the C++ binding method with the elm_win_util_standard_add that is a
4586 * elm_win_legacy function, better explained below. And then we set
4587 * the autohide state for it.
4589 * @p elm_win_util_standard_add (const char *name, const char *tittle)
4590 * Adds a window object with standard setup.
4594 * @li @p name - The name of the window;
4596 * @li @p title - The title for the window.
4598 * This creates a window but also puts in a standard background with
4599 * @p elm_bg_add(), as well as setting the window title to @p
4600 * title. The window type created is of type @c ELM_WIN_BASIC, with
4601 * the @c NULL as the parent widget. Returns the created object or @c
4604 * The autohide works similarly to @p autodel, automatically handling
4605 * "delete,request" signals when set to @p true, with the difference
4606 * that it will hide the window, instead of destroying it.
4608 * It is specially designed to work together with @p
4609 * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting
4610 * Elementary's main loop when all the windows are hidden.
4613 * @until autohide_set
4615 * @note @p autodel and @a autohide are not mutually exclusive. The
4616 * window will be destructed if both autodel and autohide is set to @p
4617 * EINA_TRUE or @p true.
4619 * A box arranges objects in a linear fashion, governed by a layout
4620 * function that defines the details of this arrangement. The box will
4621 * use an internal function to set the layout to a single row,
4622 * vertical by default.
4624 * Now let's create the box with the C++ binding method, passing our
4625 * window object as parent.
4627 * @skipline elm::box
4629 * To better understand, the function @c size_hint_weight_set for C++
4630 * bindings originated from C bindings function
4631 * evas_object_size_hint_weight_set, that is EFL Evas type function.
4632 * With this function we set the hints for an object's weight. The
4635 * @li x - Nonnegative double value to use as horizontal weight hint.
4637 * @li y - Nonnegative double value to use as vertical weight hint.
4639 * This is not a size enforcement in any way, it's just a hint that
4640 * should be used whenever appropriate. This is a hint on how a
4641 * container object should resize a given child within its area.
4643 * Containers may adhere to the simpler logic of just expanding the
4644 * child object's dimensions to fit its own (see the EVAS_HINT_EXPAND
4645 * helper weight macro in the EFL Evas Documentation) or the complete
4646 * one of taking each child's weight hint as real weights to how much
4647 * of its size to allocate for them in each axis. A container is
4648 * supposed to, after normalizing the weights of its children (with
4649 * weight hints), distribute the space it has to layout them by those
4650 * factors – most weighted children get larger in this process than
4653 * @skipline weight_set
4655 * @note Default weight hint values are 0.0, for both axis.
4657 * Now we add the box as a resize_object to win informing that
4658 * when the size of the win changes so should the box's
4659 * size. And finally we make it visible.
4662 * @until visibility_set
4664 * Now we create our spinner with the C++ method, this first one will
4665 * the default spinner.
4669 * As you see, the defaults for a spinner are:
4673 * @li min value set to 0
4675 * @li max value set to 100
4677 * @li step value set to 1
4679 * @li label format set to "%0.f"
4681 * The function size_hint_weight_set works with spinner the same way
4682 * as with box, as seem above.
4684 * @skipline weight_set
4686 * The function @c size_hint_align_set for C++ bindings originated
4687 * from C bindings function evas_object_size_hint_align_set, that is
4688 * EFL Evas type function. With this function we set the hints for an
4689 * object's alignment. The parameters are:
4691 * @li x - Double, ranging from 0.0 to 1.0 or with the special value
4692 * EVAS_HINT_FILL, to use as horizontal alignment hint.
4694 * @li y - Double, ranging from 0.0 to 1.0 or with the special value
4695 * EVAS_HINT_FILL, to use as vertical alignment hint.
4697 * These are hints on how to align an object inside the boundaries of
4698 * a container/manager. Accepted values are in the 0.0 to 1.0 range,
4699 * with the special value EVAS_HINT_FILL used to specify "justify" or
4700 * "fill" by some users. In this case, maximum size hints should be
4701 * enforced with higher priority, if they are set. Also, any padding
4702 * hint set on objects should add up to the alignment space on the
4703 * final scene composition.
4705 * For the horizontal component, 0.0 means to the left, 1.0 means to
4706 * the right. Analogously, for the vertical component, 0.0 to the top,
4707 * 1.0 means to the bottom.
4709 * This is not a size enforcement in any way, it's just a hint that
4710 * should be used whenever appropriate.
4712 * @skipline align_set
4714 * @note Default alignment hint values are 0.5, for both axis.
4716 * When using the elm::box the packing method of the subobj - spinner
4717 * in this case - should be defined. There are four possible methods:
4719 * @li @c pack_start(subobj_) - Add an object to the beginning of the
4720 * pack list. Pack @c subobj_ into the box obj, placing it first in
4721 * the list of children objects. The actual position the object will
4722 * get on screen depends on the layout used. If no custom layout is
4723 * set, it will be at the top or left, depending if the box is
4724 * vertical or horizontal, respectively.
4726 * @li @c pack_end(subobj_) - Add an object at the end of the pack
4727 * list. Pack @c subobj_ into the box obj, placing it last in the list
4728 * of children objects. The actual position the object will get on
4729 * screen depends on the layout used. If no custom layout is set, it
4730 * will be at the bottom or right, depending if the box is vertical or
4731 * horizontal, respectively.
4733 * @li @c pack_before(subobj_, before_) - Adds an object to the box
4734 * before the indicated object. This will add the @c subobj_ to the
4735 * box indicated before the object indicated with @c before_. If
4736 * before is not already in the box, results are undefined. Before
4737 * means either to the left of the indicated object or above it
4738 * depending on orientation.
4740 * @li @c pack_after(subobj_, after_) - Adds an object to the box
4741 * after the indicated object. This will add the @c subobj_ to the box
4742 * indicated after the object indicated with @c after_. If after is
4743 * not already in the box, results are undefined. After means either
4744 * to the right of the indicated object or below it depending on
4747 * In this and most examples we use pack_end by choice and
4748 * practicality. In this part of the code we also make spinner
4754 * In our second spinner we are altering the format. It will put a
4755 * text before and after the value, and also format value to display
4756 * two decimals. As with the first spinner, we create the second with
4757 * the same C++ method, set the alignment and the weight, choose the
4758 * packing method and make it visible.
4763 * The third one will use a customized step, define new minimum and maximum
4764 * values and enable wrap, so when value reaches minimum it jumps to maximum,
4765 * or jumps to minimum after maximum value is reached. Format is set to display
4771 * The fourth uses @c vertical style, so instead of left and right arrows,
4772 * top and bottom are displayed. Also the change interval is reduced, so
4773 * user can change value faster.
4778 * In the fifth the user won't be allowed to set value directly, i.e., will
4779 * be obligate change value only using arrows:
4784 * The sixth widget will receive a lot of special values, so
4785 * instead of reading numeric values, user will see labels for each one.
4786 * Also direct edition is disabled, otherwise users would see the numeric
4787 * value on edition mode. User will be able to select a month in this widget:
4792 * Finally the last widget will exemplify how to listen to widget's
4793 * signals, <tt> changed </tt> and <tt> delay_changed </tt>.
4795 * We start the same way as previously, creating spinner, setting
4796 * alignment and weight, choosing the packing method, making it
4797 * visible and editable.
4802 * Our spinner will output it's value or delay value every time the
4803 * std::function object is called. In this example we are using @a
4804 * std::bind to bind the parameters of each lambda function, that
4805 * captures sp7 by reference and then get it's value or delay value to
4806 * finally output it.
4808 * The first function changed, that was declare as auto, will output
4809 * the new value. For this we need to add it to the
4810 * @p callback_changed
4815 * The second function changed, that was also declare as auto, will
4816 * output the new delay value. For this we need to add it to the @p
4817 * callback_delay_changed.
4822 * To learn more consult @ref lambda.
4824 * The first callback function should be called everytime value
4825 * changes, the second one only after user stops to increment or
4826 * decrement. Try to keep arrows pressed and check the difference.
4828 * Finally we just have to make our window visible. Then run the elm
4829 * mainloop, starting to handle events and drawing operations.
4834 * See the full code for this example at @ref spinner_cxx_example.cc .
4836 * This example will look like this:
4838 * @image html screenshots/spinner_cxx_example.png
4839 * @image latex screenshots/spinner_cxx_example.eps width=\textwidth
4840 * @example spinner_cxx_example.cc
4844 * @page table_cxx_example_01 Table Example with C++ binding - Homogeneous
4845 * @dontinclude table_cxx_example_01.cc
4847 * In this example we add four labels to a homogeneous table that has a padding
4848 * of 5px between cells.
4850 * The first part consists of including the headers. In this
4851 * case we are only working with the Elementary C++ binding and thus
4852 * we need only to include him.
4854 * @skipline Elementary.hh
4856 * @attention If necessary the C and/or the C++ headers should be
4857 * include here as well.
4859 * Now we need to actually start the code and set the elm_policy,
4860 * which defines for a given policy group/identifier a new policy's
4861 * value, respectively. In this example the only policy we need to
4862 * set a value for is @c ELM_POLICY_QUIT, possibles values for it are:
4864 * @li @p ELM_POLICY_QUIT_NONE: Never quit the application
4867 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the
4868 * application's last window is closed;
4870 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the
4871 * application's last window is hidden;
4874 * @until elm_policy_set
4876 * As you can see, the policy we chose was to quit when the last win
4877 * is hidden as opose to examples with the C bindings where we
4878 * perpetually set it to quit when last win was closed. This changed
4879 * was necessary because in C++ binding as the elm mainloop stop
4880 * running all object are destroyed, references are unreferenced and
4881 * events are stopped at ELM_MAIN().
4883 * @see For more details consult elm_policy_set
4885 * Next step is creating an Elementary window, in this example we use
4886 * the C++ binding method with the elm_win_util_standard_add that is a
4887 * elm_win_legacy function, better explained below. And then we set
4888 * the autohide state for it.
4890 * @p elm_win_util_standard_add (const char *name, const char *tittle)
4891 * Adds a window object with standard setup.
4894 * @li @p name - The name of the window;
4896 * @li @p title - The title for the window.
4898 * This creates a window but also puts in a standard background with
4899 * @p elm_bg_add(), as well as setting the window title to @p
4900 * title. The window type created is of type @c ELM_WIN_BASIC, with
4901 * the @c NULL as the parent widget. Returns the created object or @c
4904 * And we also set the autohide state for win, autohide works
4905 * similarly to @p autodel, automatically handling "delete,request"
4906 * signals when set to @p true, with the difference that it will hide
4907 * the window, instead of destroying it.
4909 * It is specially designed to work together with @p
4910 * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting
4911 * Elementary's main loop when all the windows are hidden.
4914 * @until autohide_set
4916 * @note @p autodel and @a autohide are not mutually exclusive. The
4917 * window will be destructed if both autodel and autohide is set to @p
4918 * EINA_TRUE or @p true.
4920 * Now we construct the elm table and for this we use the C++ method
4921 * below, setting it's parent.
4923 * @skipline ::elm::table
4925 * We then add table as a resize_object to win informing that when the
4926 * size of the win changes so should the box's size and make it
4932 * Next step is to set the padding, in this case 5px and as we chosen
4933 * for this example homogeneous_set to true.
4936 * @until homogeneous
4938 * We'll create for each cell on this table a simple elm_lable, using
4939 * the C++ method below, setting it's parent. Set the text for the
4940 * labels and make each visible. The parameters for packing the labels
4941 * in our table will be better explain below.
4946 * When using pack in our table we are adding a child to a packing
4947 * location of the table. The parameters are:
4949 * pack (evas::object @a subobj,
4955 * @li subobj - The subobject to be added to the table
4957 * @li column - Column number
4959 * @li row - Row number
4961 * @li colspan - Number of columns that the subobj will occuppy
4963 * @li rowspan - Number of rows that the subobj will occuppy
4965 * @note All positioning inside the table is relative to rows and
4966 * columns, so a value of 0 for @a column and @a row, means the top
4967 * left cell of the table. And for example, value of 2 for @a colspan and @a
4968 * rowspan indicates that the subobj will occuppy two column and two rows,
4969 * thus occuppying 4 cells in total.
4971 * Finally we just have to make our window visible. Then run the elm
4972 * mainloop, starting to handle events and drawing operations.
4977 * @See Full code for this example: @ref table_cxx_example_01.cc .
4979 * Our example will look like this:
4981 * @image html screenshots/table_cxx_example_01.png
4982 * @image latex screenshots/table_cxx_example_01.eps width=\textwidth
4983 * @example table_cxx_example_01.cc
4987 * @page table_cxx_example_02 Table Example with C++ binding - Heterogeneous
4988 * @dontinclude table_cxx_example_02.cc
4990 * For our second example we'll create a table with 4 rectangles in
4991 * it. Since our rectangles are of different sizes our table won't be
4994 * The first part consists of including the headers. In this
4995 * case we are only working with the Elementary C++ binding and thus
4996 * we need only to include him.
4998 * @skipline Elementary.hh
5000 * @attention If necessary the C and/or the C++ headers should be
5001 * include here as well.
5003 * Now we need to actually start the code and set the elm_policy,
5004 * which defines for a given policy group/identifier a new policy's
5005 * value, respectively. In this example the only policy we need to
5006 * set a value for is @c ELM_POLICY_QUIT, possibles values for it are:
5008 * @li @p ELM_POLICY_QUIT_NONE: Never quit the application
5011 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the
5012 * application's last window is closed;
5014 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the
5015 * application's last window is hidden;
5018 * @until elm_policy_set
5020 * As you can see, the policy we chose was to quit when the last win
5021 * is hidden as opose to examples with the C bindings where we
5022 * perpetually set it to quit when last win was closed. This changed
5023 * was necessary because in C++ binding as the elm mainloop stop
5024 * running all object are destroyed, references are unreferenced and
5025 * events are stopped at ELM_MAIN().
5027 * @see For more details consult elm_policy_set
5029 * Next step is creating an Elementary window, in this example we use
5030 * the C++ binding method with the elm_win_util_standard_add that is a
5031 * elm_win_legacy function, better explained below. And then we set
5032 * the autohide state for it.
5034 * @p elm_win_util_standard_add (const char *name, const char *tittle)
5035 * Adds a window object with standard setup.
5038 * @li @p name - The name of the window;
5040 * @li @p title - The title for the window.
5042 * This creates a window but also puts in a standard background with
5043 * @p elm_bg_add(), as well as setting the window title to @p
5044 * title. The window type created is of type @c ELM_WIN_BASIC, with
5045 * the @c NULL as the parent widget. Returns the created object or @c
5048 * And we also set the autohide state for win, autohide works
5049 * similarly to @p autodel, automatically handling "delete,request"
5050 * signals when set to @p true, with the difference that it will hide
5051 * the window, instead of destroying it.
5053 * It is specially designed to work together with @p
5054 * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting
5055 * Elementary's main loop when all the windows are hidden.
5058 * @until autohide_set
5060 * @note @p autodel and @a autohide are not mutually exclusive. The
5061 * window will be destructed if both autodel and autohide is set to @p
5062 * EINA_TRUE or @p true.
5064 * Now we construct the elm table and for this we use the C++ method
5065 * below, passing windows as it's parent.
5067 * @skipline ::elm::table
5069 * We then add table as a resize_object to win informing that when the
5070 * size of the win changes so should the table's size and make it
5071 * visible. The last configuration for table is to set homogeneous as
5075 * @until homogeneous
5077 * For each cell of this table we are going to create a unique @p
5078 * evas::rectangle, each with diferent colors and sizes.
5080 * Let's see a snip of the code on how we constructed our rectangles
5081 * and setted the colors.
5095 * For each rectangle we also setted the size_hint_min that hints for
5096 * an object's minimum size. This is not a size enforcement in any
5097 * way, it's just a hint that should be used whenever appropriate.
5099 * @dontinclude table_cxx_example_02.cc
5100 * @skipline size_hint
5102 * @skipline size_hint
5104 * @skipline size_hint
5106 * @skipline size_hint
5108 * When using pack in our table we are adding a child to a packing
5109 * location of the table. The parameters are:
5111 * pack (evas::object @a subobj,
5117 * @li subobj - The subobject to be added to the table
5119 * @li column - Column number
5121 * @li row - Row number
5123 * @li colspan - Number of columns that the subobj will occuppy
5125 * @li rowspan - Number of rows that the subobj will occuppy
5127 * @note All positioning inside the table is relative to rows and
5128 * columns, so a value of 0 for @a column and @a row, means the top
5129 * left cell of the table. And for example, value of 2 for @a colspan
5130 * and @a rowspan indicates that the subobj will occuppy two column
5131 * and two rows, thus occuppying 4 cells in total.
5133 * So for each rectangle we are setting a specific location and how
5134 * many cells it's occupying, better seem below:
5136 * @dontinclude table_cxx_example_02.cc
5145 * Finally we just have to make our window visible. Then run the elm
5146 * mainloop, starting to handle events and drawing operations.
5151 * @See Full code for this example: @ref table_cxx_example_02.cc .
5153 * Our example will look like this:
5155 * @image html screenshots/table_cxx_example_02.png
5156 * @image latex screenshots/table_cxx_example_02.eps width=\textwidth
5158 * @example table_cxx_example_02.cc
5162 * @page thumb_cxx_example_01 Thumb - Generating thumbnails with C++ Binding
5163 * @dontinclude thumb_cxx_example_01.cc
5165 * This example shows how to create a simple thumbnail object with
5166 * Elementary C++ Binding.
5168 * The first part consists of including the headers. In this case we
5169 * need Elementary C++ binding, iostream and sstream libraries.
5171 * @skip Elementary.hh
5174 * @attention All necessary Enlightenment, Elementary, C and/or C++
5175 * headers should be include here as well.
5177 * Starting the main code and telling elementary that we need Ethumb
5178 * to generate the thumbnails:
5181 * @until elm_need_ethumb
5183 * Then, we use app_info_set to access the image that we are using for
5188 * Now let's set the elm_policy, which defines for a given policy
5189 * group/identifier a new policy's value, respectively. In this
5190 * example the only policy we need to set a value for is @c
5191 * ELM_POLICY_QUIT, possibles values for it are:
5193 * @li @p ELM_POLICY_QUIT_NONE: Never quit the application
5196 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the
5197 * application's last window is closed;
5199 * @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the
5200 * application's last window is hidden;
5202 * @skipline elm_policy_set
5204 * As you can see, the policy we chose was to quit when the last win
5205 * is hidden as opose to examples with the C bindings where we
5206 * perpetually set it to quit when last win was closed. This changed
5207 * was necessary because in C++ binding as the elm mainloop stop
5208 * running all object are destroyed, references are unreferenced and
5209 * events are stopped at ELM_MAIN().
5211 * @see For more details consult elm_policy_set
5213 * Next step is creating an elementary window, in this example we use
5214 * the C++ binding method with the elm_win_util_standard_add that is a
5215 * elm_win_legacy function, better explained below. And then we set
5216 * the autohide state for it.
5218 * @p elm_win_util_standard_add (const char *name, const char *tittle)
5219 * Adds a window object with standard setup.
5222 * @li @p name - The name of the window;
5224 * @li @p title - The title for the window.
5226 * This creates a window but also puts in a standard background with
5227 * @p elm_bg_add(), as well as setting the window title to @p
5228 * title. The window type created is of type @c ELM_WIN_BASIC, with
5229 * the @c NULL as the parent widget. Returns the created object or @c
5232 * The autohide works similarly to @p autodel, automatically handling
5233 * "delete,request" signals when set to @p true, with the difference
5234 * that it will hide the window, instead of destroying it.
5236 * It is specially designed to work together with @p
5237 * ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting
5238 * Elementary's main loop when all the windows are hidden.
5241 * @until autohide_set
5243 * @note @p autodel and @a autohide are not mutually exclusive. The
5244 * window will be destructed if both autodel and autohide is set to @p
5245 * EINA_TRUE or @p true.
5247 * Creating our thumb and setting it's parent, using C++ method.
5251 * For our callbacks we are using lambda type functions to create
5252 * then, note that all three only show a message, for when our thumb
5253 * generation is starting, stoping and it's return error.
5256 * @until generate_error
5258 * @note To learn more about Lambda Function and its use in Elementary
5259 * consult @ref lambda.
5261 * Continuing with our thumb, we'll set a size, set it to not be
5262 * editable, set the file and after that, we can start creating
5263 * thumbnail objects. They are very similar to image or icon objects:
5268 * As you can see, the main different function here is reload(), which
5269 * will check if the options of the Ethumb client have changed. If so,
5270 * it will re-generate the thumbnail, and show the new one.
5272 * Notice in this example that the thumbnail object is displayed on
5273 * the size of the window (320x320 pixels), but the thumbnail
5274 * generated and stored has size 160x160 pixels. That's why the
5275 * picture seems upscaled.
5277 * Ideally, you will be generating thumbnails with the size that you
5278 * will be using them.
5280 * Finishing with thumb we set the weight hint. To better understand,
5281 * the function @c size_hint_weight_set for C++ bindings originated
5282 * from C bindings function evas_object_size_hint_weight_set, that is
5283 * EFL Evas type function. With this function we set the hints for an
5285 * The parameters are:
5287 * @li x - Nonnegative double value to use as horizontal weight hint.
5289 * @li y - Nonnegative double value to use as vertical weight hint.
5291 * This is not a size enforcement in any way, it's just a hint that
5292 * should be used whenever appropriate. This is a hint on how a
5293 * container object should resize a given child within its area.
5295 * Containers may adhere to the simpler logic of just expanding the
5296 * child object's dimensions to fit its own (see the EVAS_HINT_EXPAND
5297 * helper weight macro in the EFL Evas Documentation) or the complete
5298 * one of taking each child's weight hint as real weights to how much
5299 * of its size to allocate for them in each axis. A container is
5300 * supposed to, after normalizing the weights of its children (with
5301 * weight hints), distribute the space it has to layout them by those
5302 * factors – most weighted children get larger in this process than
5305 * @skipline weight_set
5307 * @note Default weight hint values are 0.0, for both axis.
5309 * Then we add the thumb as a resize-object to win informing that when
5310 * the size of the win changes so should the thumb's size. Remember
5311 * always to set the thumb visibility to true.
5316 * Now we only have to set the size for our window and make it
5320 * @until visibility_set
5322 * And finally, start the elm mainloop, starting to handle events and
5323 * drawing operations.
5328 * The full source code can be found at @ref thumb_cxx_example_01.cc
5330 * @image latex screenshots/thumb_cxx_example_01.eps width=\textwidth
5331 * @example thumb_cxx_example_01.cc